Iterating over a group, want to check an alternate item, sometimes

This is going to just be a quick reply. I’ll try to come back later. Poke me if I forget.

  1. Design Pattern: Associated Items

  2. Design Patterns: Generic Is Alive

In the above scheme you have an item to represent the online status of the device. When ever any item associated with that device receives an update you send command to that online status switch. In you case both the sensor reading and the battery will update the online switch. Expire binding turns the switch off 24 hours, or what ever you want, after the last update letting you know the device is offline.

This is particularly easy to implement with MQTT as your online switch can just subscribe to all messages for that device and update itself without needing a rule.

In the morning you can loop through the online Switches and generate your report, or report it immediately when it goes offline.

1 Like