-
-
Notifications
You must be signed in to change notification settings - Fork 90
Different log intervals with MQTT
BSB-LAN's internal logging feature only supports one logging interval for all logged parameters. While this is fine for most use cases, it might be desirable to have longer log intervals for parameters like outside temperature, and shorter ones for parameters like flow temperature or burner modulation.
By making use of the /poll
topic right underneath the main MQTT topic, BSB-LAN can be instructed to update those parameters published to that topic. The trick now is to publish different parameters to /poll
at different intervals, for example parameter 8700 for outside temperature every 10 minutes, and parameter 8950 for flow temperature every minute.
If you have a local server in your network with mosquitto
installed, you can use the cron job functionality to realize this. A cron job that shall update parameters 8700 and 8740 from device ID 0 every 10 minutes and parameters 8326 from device ID 1 and 8950 from device ID 0 every minute would look like this:
*/1 * * * * /path/to/mosquitto_pub -h my.mosquitto-broker.local -u USER -P PASSWORD -m "/0/51/8950,/1/50/8326" -t BSB-LAN/poll
*/10 * * * * /path/to/mosquitto_pub -h my.mosquitto-broker.local -u USER -P PASSWORD -m "/0/51/8700,/0/50/8740" -t BSB-LAN/poll
Home Assistant offers the possibility to create automations that can, for example, at specified intervals. Rather than adding one automation for each interval, several intervals can be combined into one, at least when writing the automation directly in YAML. Taking the same example as in the cron job section, such an automation could look like this:
alias: Update parameters
description: This automation updates the parameters in the payload every one and five minutes respectively.
triggers:
- trigger: time_pattern
minutes: /5
variables:
parameters: /0/51/8700,/0/51/8740
- trigger: time_pattern
minutes: /1
variables:
parameters: /1/50/8326,/0/51/8950
actions:
- data:
topic: BSB-LAN/poll
payload: "{{parameters}}"
action: mqtt.publish
mode: single
Other parameters and/or intervals can be added if so desired. It should only be noted that the BSB/LPB bus speed does not allow for more than 20-25 requests per minute, so that limit should be kept in view, especially when in this case the trigger for "every minute" and the trigger for "every five minutes" will be called at the same time.
Quick links:
BSB-LAN manual | BSB-LAN latest version | BSB-LAN bug report | BSB-LAN discussions