Group Automation how to get numeric state?

Hi,

Right now I have the automation below to alert me if any sensors battery goes below 20%:

- id: '1600331979995'
  alias: Notify Sensors Battery Low
  description: ''
  trigger:
  - below: '20'
    entity_id: sensor.0x00158d000234ba98_battery,sensor.0x00158d00023708de_battery,sensor.0x00158d0002370d90_battery,sensor.0x00158d0002375bcf_battery,sensor.0x00158d000275307a_battery,sensor.0x00158d00027531b7_battery,sensor.0x00158d0002ad12ba_battery,sensor.0x00158d0002b55b1e_battery,sensor.0x00158d0002bf52e3_battery,sensor.0x00158d0002bf53f4_battery,sensor.0x00158d0002c0d239_battery,sensor.0x00158d0002c0d256_battery,sensor.0x00158d0002c0d298_battery,sensor.0x00158d0002c0d2af_battery,sensor.0x00158d0002c0e190_battery,sensor.0x00158d0002c397b2_battery,sensor.0x00158d0002c397fe_battery,sensor.0x00158d0002c39869_battery,sensor.0x00158d000401922a_battery,sensor.0x00158d00040245db_battery,sensor.0x00158d000465b174_battery
    platform: numeric_state
  condition: []
  action:
  - data_template:
      message: The {{ trigger.from_state.attributes.friendly_name }} needs to be replaced,
        it just has {{ trigger.to_state.state }}% battery left.
      title: One Sensor battery is almost empty!
    service: notify.notify
  mode: single

It is working just fine, but I would rather have all the entities in a single group?
What is the easiest way to use a group in this automation maintaining the simple logic?

Thanks

I believe in 0.115 you will be able to create a Template Trigger that can monitor a group’s members (by using the expand function). Otherwise, no, what you suggested can’t be done.

Thanks! Do you have any more info on that feature?

I believe it was this PR that changed how expand is handled within a Template Trigger.

1 Like