Trigger on any group member change status to "off"

Hey all,
i have a bit list of devices i monitor on my network with a pingtest.
the idea being that if anyone of them go offline, i would get a notification to go and fix it (eg. why has the network printer stopped working)

i have all these in a group, but when one of the devices changes to “off” the whole group stays “on” overall.

is there a way to work out if “any” member of a group state has changed?

- alias: "Monitored Devices Status"
  id: MonitoriedDevicesStatus
  trigger:
    - platform: state
      entity_id: group.all_ips
      to: 'off'
  action:
    - service: notify.notify
      data:
        message: "test"
    - service: persistent_notification.create
      data:
        message: "test"
        title: "Group IP Test"

You could just create an automation that triggers on any of your entities changing to OFF. In the action you will be able to identify the triggering entity (and show that in a notification).

how do you mean sorry, do you have an example? thats what im trying to do in my example ive shown

Untested:

- alias: "Monitored Devices Status"
  id: MonitoriedDevicesStatus
  trigger:
    - platform: state
      entity_id: 
        - binary_sensor.ip_one
        - binary_sensor.ip_two
        - binary_sensor.ip_three
      to: 'off'
  action:
    - service: notify.notify
      data_template:
        message: 'Network device {{ trigger.to_state.attributes.friendly_name }} is not responding.'
    - service: persistent_notification.create
      data_template:
        message: 'Network device {{ trigger.to_state.attributes.friendly_name }} is not responding.'
        title: "Monitored Devices Status"```

thanks!

this works for me:

- alias: 'Notify if device offline for 2 minutes'                                                                                                   
  trigger:
    - platform: state
      entity_id: 
        - binary_sensor.pingtest_fingbox
        - binary_sensor.pingtest_linktap
        - binary_sensor.pingtest_netgeargym
        - binary_sensor.pingtest_netgearhallway
      to: 'off'
      for:
        hours: 0
        minutes: 2
        seconds: 0
  action:
    - service: persistent_notification.create
      data_template:
        message: >-
          {{ trigger.from_state.attributes.friendly_name }} has been offline for over 2 minutes
        title: "Device Offline"
    - service: notify.notify
      data_template:
        title: 'Device Offline'
        message: >-
          {{ trigger.from_state.attributes.friendly_name }} has been offline for over 2 minutes

using a group would make this a LOAD easier however

Why? You only set it up once. When you need to monitor a new device, you need to add it to the group anyway. What’s the difference with adding it to the automation?

1 Like

groups would keep everything in one place as a set list.

if i wanted to create more automations using that group, then i wouldnt need to update that automation list each time.

The default for a group is to be on if any of the entities is on. However you can change that so it is only on if all of the entities are on. Just add the following to the group configuration:

  all: true

This way the group will change to off whenever any of the entities change to off.

Now, having said that, you’ll only get a notification when the first entity goes off. If a second goes off the automation won’t trigger again (until all of the entities go back on and then one goes off.)

So, if you want the automaton to trigger whenever any of the entities goes off, then it’s best to do as @metbril suggested and simply list each entity separately.

But if you really want to use a group, and still get a notification whenever any of the entities goes off, there is a way to do that using an event trigger and a condition.

1 Like