Logging FHT Updates to a Database with FHEM DbLog Setup
Logging FHT updates to a database in FHEM: db.conf setup, the readings worth storing, and why a logged FHT command is not an executed one.
Wren CallowayHow does logging FHT updates to a database work in FHEM?
Logging FHT updates to a database comes down to a fixed schema and one device definition in FHEM. DbLog ships as module 93_DbLog.pm and writes every matching device message into two tables, current and history, both built from the same seven columns: TIMESTAMP, DEVICE, TYPE, EVENT, READING, VALUE, UNIT (FHEMWiki, DbLog, last edited January 7, 2024). An FHT80b sends a seven-line status report about four times an hour and moves its valve position every two minutes, so an unfiltered device stores rows nobody plots (FHEMWiki, FHT80b, last edited September 22, 2023).
Connection parameters live in db.conf, separate from fhem.cfg: define logdb DbLog ./db.conf .*:.* takes every device message, while .*:(measured-temp|desired-temp|actuator).* takes three readings from every device (FHEMWiki, DbLog, January 7, 2024). The current table only fills when DbLogType is Current or Current/History, and rows that must leave the FHEM box belong on the bus-and-alerts path in enterprise logging and alerting.
Which FHT readings are worth logging to a database?
The FHT80b status packet carries seven readings, and the valve position in it changes about every two minutes. A block on the FHEMWiki FHT80b page (last edited September 22, 2023) lists actuator, measured-temp, battery, lowtemp, window, windowsensor and warnings from an ELV / eQ-3 thermostat driving up to eight FHT8v valve actuators.
- measured-temp — the curve fht.gplot draws on its second axis.
- desired-temp — the setpoint you sent.
- actuator — the physical result in percent.
- window and windowsensor — the explanation for a night-time drop.
- battery and warnings — the row you want when a thermostat goes quiet.
DbLogExclude drops readings, DbLogInclude keeps an allow list, and event-min-interval state:900 writes a state at most every 900 seconds, which is 15 minutes (FHEMWiki, DbLog, January 7, 2024). Plot definitions need the same switch, so fht.gplot gains four DbLog lines for measured-temp, actuator, desired-temp and window (FHEMWiki, DbLog, January 7, 2024).
Which database should FHT logs use, SQLite or MySQL?
SQLite covers a single FHEM server, and index creation on a 15 GB file took about 15 minutes on a Mac mini with an SSD. That figure comes from the FHEMWiki DbLog page (last edited January 7, 2024), which also records a 23 GB SQLite file restored only after its dump was split into 10,000,000-row transactions. On Windows the same steps follow FHEM setup on Windows Home Server.
| SQLite | MySQL / MariaDB | PostgreSQL | |
|---|---|---|---|
| Where rows live | One file, e.g. /opt/fhem/fhem.db | A server reached over the network | A server reached over the network |
| How the guide creates it | Create history and current in the sqlite3 shell |
Import db_create_mysql.sql, creating a database named fhem | Import db_create_postgresql.sql, creating a schema named fhem |
| Limit it calls out | Very large files fail on a single-transaction import | MariaDB listens on 3307, not 3306, on some Synology boxes | None called out in the guide |
Both engines take the same index: CREATE INDEX Search_Idx ON history (DEVICE, READING, TIMESTAMP) follows the Device -> Reading -> Date -> Value order behind nearly every FHEM plot query, and it can grow the database by up to a third (FHEMWiki, DbLog, January 7, 2024). The guide calls the hardware underneath more important than the engine, and recommends MySQL or MariaDB once the history table outgrows the machine.
Why does a logged FHT update not mean the valve moved?
FHEM logs an FHT command as sent the moment the radio adapter takes it, and an FHT80b only accepts a command every 115+x seconds, about two minutes. Undeliverable commands wait in the adapter’s FHT buffer even though the FHEM log lists them as dispatched (FHEMWiki, Kommunikationsprobleme mit FHT, last edited February 17, 2019). An FHZ1x00 holds about 40 bytes, roughly eight FHT commands, while a CULv3 or CUN holds 200 bytes, roughly forty (FHEMWiki, FHT80b, last edited September 22, 2023).
The Bundesnetzagentur caps 868.000 to 868.600 MHz at a 1% duty cycle, 36 seconds of transmission per hour, and states that “Die Gesamtsendezeit kann auf mehrere Intervalle aufgeteilt werden” — the total transmit time can be spread across intervals (Bundesnetzagentur Vfg 45/2016, quoted in FHEMWiki, 1% Regel, last edited October 18, 2019). Five desired-temp changes sent together still need 9 to 10 minutes to reach the last thermostat, and one hub holds about 10 to 12 FHT rooms in practice. That gap is why actuator belongs beside desired-temp, and why logging from .NET to RabbitMQ via Log4Net meets the same queue-and-retry problem on a Windows host.
Logging FHT Updates to a Database: Common Questions
How many FHT readings should FHEM log by default? Three: measured-temp, desired-temp and actuator. A device defined as .*:.* writes every device message instead, battery status and keepalives included, and those rows grow the history table faster than any plot reads it (FHEMWiki, DbLog, January 7, 2024). Narrow the define line, then set DbLogExclude per device.
Which database should FHT logs use, SQLite or MySQL? SQLite for one FHEM server, MySQL or MariaDB once the history table outgrows it. The FHEMWiki DbLog page reports indexing a 15 GB SQLite file took about 15 minutes on a Mac mini with an SSD (FHEMWiki, DbLog, January 7, 2024), and calls for a real database server at very large sizes.
What does FHEM log when an FHT command sits in the adapter buffer? A row that reads as sent and was not executed. Undeliverable commands stay in the FHT command buffer of the CUL or CUNO although FHEM logs them as dispatched (FHEMWiki, Kommunikationsprobleme mit FHT, last edited February 17, 2019). Log actuator beside desired-temp and read the queue with get CUL raw T02.
Can a new FHT80b still be bought for an FHEM install? No. FHEMWiki’s communication page says “Das FHT System ist seit 2017 abgekündigt” (FHEMWiki, Kommunikationsprobleme mit FHT, last edited February 17, 2019). Installed gear keeps logging into DbLog unchanged, and that page points to MAX or HomeMatic for replacements.