influxdata / telegraf

Agent for collecting, processing, aggregating, and writing metrics, logs, and other arbitrary data.
https://influxdata.com/telegraf
MIT License
14.55k stars 5.56k forks source link

Reading KNX message from bus after reconnect / x minutes after last telegram was received #15117

Open userwithoutpassword opened 6 months ago

userwithoutpassword commented 6 months ago

Use Case

Some KNX telegrams are written to the bus in intervals, others are not (you have to send a read request) or just when their value changes. Same values change very rarely for example summer/winter state for heating (maybe only 2 times per year).

After reconnect some values could have been changed during the connection was offline.

Expected behavior

A solution could be how it is done in Home Assistant by adding an option called "sync_state"

sync_state boolean | string | integer (Optional, default: true)

Actively read the value from the bus. The maximum time interval (<minutes>) is 1440. The following values are valid

true equivalent to “expire 60” (default)
false no GroupValueRead telegrams will be sent to the bus
every <minutes> to update it regularly every <minutes>
expire <minutes> to read the state from the KNX bus when no telegram was received for <minutes>
<minutes> equivalent to “expire <minutes>”
init to just initialize the state on startup

Since the KNX Bus has a limited bandwidth its not a good idea send a read request for all groupaddresses at the same time. Maybe this can be solved by reading them at different (random) seconds.

Lets say you want to read 100 values every 60minutes. The solution could be not reading them all at exactly 60min and 0 seconds but instead reading them at random seconds.

The same after reconnect. Maybe using the first 30 or 60seconds for reading all data that telegrams/second on the KNX Bus doesnt get too high. If its too high and the bus is "full" KNX devices only try to send 3 times and if thats not possible (because the bus is "full" ) they give up and you dont get an answer.

Actual behavior

see "use case"

Additional info

No response

srebhan commented 6 months ago

@userwithoutpassword a sync_on_startup option would make sense. PRs are welcome! ;-)