-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Individual register MQTT export throttling.
Since all registers in a block are read on one go on MODBUS, which is probably efficient, it is hard to find a good trade-off between getting fast updates on config changes and events, vs. not being flooded with continuous measurements. Added a simple throttling option, to set the minimum interval between samples on chosen sensors. Turned throttling on on fan RPM measurements (10sec) and the 5 temperature sensor registers (20sec) Added MQTT retain bit per register, default on, and turned it off for the measurement sensors above and the clock registers. Made it possible to flag in the RegisterManager::Visitor to visit only if the throttle timer is also signaling ready - used by MQTT visitor. This throttling function required 32bits extra memory per register. Chose to not go full 32 bit on the time stamping to save space, and to reduce the number of divisions on checking, chose a power of 2 factor resolution. So, throttle times have a resolution of 256ms, and timestamps are stored as 16-bit values in units of 256ms. This means the max configurable throttle time is 0xffff * 256ms = 16777s or 4.6hrs. Remark that the values exported, when throttling, may be up to the polling period of the register block old, but I gather e.g. temperatures should change pretty slowly, while the fan speed jiggling reported are probably inaccuracy on the sensors. Tested by adding a delta time measurement in a MQTT subscriber and printing, looks OK: 00:24:13;178: systemair/temperature/exhaust : 13.5 dt 24.2 00:24:13;242: systemair/clock/second : 9 dt 1.1 00:24:14;537: systemair/clock/second : 10 dt 1.3 00:24:15;423: systemair/clock/second : 11 dt 0.9 00:24:17;284: systemair/fan/supply/rpm : 3120 dt 10.7 00:24:17;345: systemair/fan/extract/rpm : 2820 dt 10.8 00:24:17;345: systemair/clock/second : 13 dt 1.9 00:24:17;962: systemair/temperature/extract : 20.9 dt 20.3 00:24:18;025: systemair/clock/second : 14 dt 0.7 00:24:19;220: systemair/clock/second : 15 dt 1.2 00:24:20;126: systemair/clock/second : 16 dt 0.9 00:24:21;469: systemair/clock/second : 17 dt 1.3 00:24:22;366: systemair/clock/second : 18 dt 0.9 00:24:26;472: systemair/clock/second : 22 dt 4.1 00:24:27;563: systemair/fan/supply/rpm : 2820 dt 10.3 00:24:27;610: systemair/fan/extract/rpm : 2580 dt 10.3 00:24:27;611: systemair/clock/second : 23 dt 1.1 00:24:28;225: systemair/clock/second : 24 dt 0.6 00:24:29;214: systemair/clock/second : 25 dt 1.0 00:24:31;173: systemair/temperature/protection : 21.3 dt 21.2 00:24:31;221: systemair/clock/second : 27 dt 2.0 00:24:32;059: systemair/clock/second : 28 dt 0.8 00:24:33;421: systemair/temperature/exhaust : 13.8 dt 20.2 00:24:33;467: systemair/clock/second : 29 dt 1.4 00:24:34;403: systemair/clock/second : 30 dt 0.9 00:24:35;759: systemair/clock/second : 31 dt 1.4 00:24:36;656: systemair/clock/second : 32 dt 0.9 00:24:38;501: systemair/fan/supply/rpm : 2820 dt 10.9 00:24:38;563: systemair/fan/extract/rpm : 2580 dt 11.0 00:24:38;563: systemair/temperature/extract : 21.1 dt 20.6 00:24:38;563: systemair/clock/second : 34 dt 1.9 00:24:39;178: systemair/clock/second : 35 dt 0.6 00:24:40;553: systemair/clock/second : 36 dt 1.4 00:24:41;439: systemair/clock/second : 37 dt 0.9 00:24:42;798: systemair/clock/second : 38 dt 1.4 00:24:43;697: systemair/clock/second : 39 dt 0.9 00:24:45;238: systemair/clock/second : 41 dt 1.5 00:24:46;148: systemair/clock/second : 42 dt 0.9 00:24:47;505: systemair/clock/second : 43 dt 1.4 00:24:48;500: systemair/fan/supply/rpm : 3060 dt 10.0 00:24:48;564: systemair/fan/extract/rpm : 2820 dt 10.0 00:24:49;068: systemair/clock/second : 45 dt 1.6 00:24:50;049: systemair/clock/second : 46 dt 1.0 00:24:52;005: systemair/clock/second : 48 dt 2.0 00:24:52;051: systemair/temperature/protection : 21.6 dt 20.9 00:24:52;888: systemair/clock/second : 49 dt 0.9 00:24:53;616: systemair/temperature/exhaust : 13.8 dt 20.2 00:24:54;230: systemair/clock/second : 50 dt 1.3 00:24:55;239: systemair/clock/second : 51 dt 1.0 00:24:55;287: systemair/temperature/intake : 10.3 dt 45.3 00:24:56;588: systemair/clock/second : 52 dt 1.3
- Loading branch information
Showing
10 changed files
with
231 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.