Bit late to the conversation but I store last_on
and last_off
as part of any IoT switch, this is also sent to MQTT. When the state changes, I record the on_duration
and off_duration
:
The calculations are done by a single function node that enriches the known_devices
data both in the global variable and MQTT.
The updated
and updated_by
properties are ones that I now use as standard all over the place since my flows have got a bit complex. It means that it is much quicker to go tweak something a year or so later when you've forgotten what bit of flow does what. The naming convention is <nr instance>/<flow tab>/<group of nodes>/<fn/node or fn/node name>
.