Binary Sensor if any sensors in a group go Unavailable or Unknown

Hi Folks. I have a list of entities in a group.

In groups.yaml

  - sensor.tank_top
  - sensor.tank_middle
  - sensor.tank_bottom
  - sensor.tank_inlet
  - sensor.tank_outlet
  - sensor.landing

I am trying to create a binary sensor or sensor that goes ‘true’ or ‘on’ if any goes unknown or unavailable

This was my attempt in configuration.yaml

  - binary_sensor:
      - name: Boiler Faults
        state: >
          {{ is_state('group.CHHW_Sensors')|selectattr('state','in',['unavailable','unknown','none']) }}

Any help?

  - binary_sensor:
      - name: Boiler Faults
        state: >
          {{ expand('group.chhw_sensors') | selectattr('state', 'in', ['unavailable', 'unknown', 'none']) | list | count  > 0 }}

To be verified: does a group’s state value change to unavailable if the state value of one of its members changes to unavailable?

Answer: No.

According to the documentation, all members of the group must be unavailable for the group’s state to become unavailable.

The group state is unavailable if all group members are unavailable.

1 Like