Where Does FHEM Store Config and State?
FHEM keeps its config, logs and state in the install tree, usually under /opt/fhem on Linux. What lives where.
Last updated
FHEM centers on its install folder, commonly /opt/fhem. Device definitions live in fhem.cfg at the root while logs, backups and state branch below it. There is no separate home directory layout.
That single tree design makes moves simple and risky at once. Copy everything with the service stopped for a consistent snapshot. Editing the running config from two places invites overwrites, so pick the frontend or the file per session.
Where FHEM stores this, by platform
/opt/fhem
Install root with fhem.cfg, logs, backups and state below it. Stop the service before copying. Exact subfolder names may vary by install method, so confirm against the running setup.
/opt/fhem/fhem.cfg
Main device and automation definitions. State and readings persist in the restore and log trees beside it. Version control this file; it is the whole automation.
Frequently asked questions
How do I migrate FHEM to a new host?
Copy the whole install tree with FHEM stopped, especially fhem.cfg plus the log and restore folders. Config and device state travel together. Restart on the new host with matching Perl modules or devices stay silent.
Where is the main FHEM config?
In fhem.cfg at the install root, edited from the web frontend under Edit files. The frontend writes the same file, so hand edits and UI edits share one source of truth. Keep a versioned copy before big changes.
Notice an outdated path? Let us know.