Does checking an automation condition for sensor trigger Zigbee traffic?

I have an automation that triggers every 5 seconds and checks whether a TRV valve is ON or OFF in a condition. If the TRV valve is ON - it switches on the boiling water heater.

Since the TRV is on batteries, I’m concerned if checking the TRV valve sensor in a condition that runs every 5 seconds is going to generate lot of Zigbee traffic and therefore drain the battery?

Is checking a sensor condition going through Zigbee at all or is it just a local DB/config check inside the HA server?

- id: '1678438273272'
  alias: test
  description: ''
  trigger:
  - platform: time_pattern
    seconds: '5'
  condition:
  - condition: state
    entity_id: binary_sensor.0x003c84fffef2cf55_valve_state
    state: 'on'
  action:
  - delay:
      hours: 0
      minutes: 10
      seconds: 0
      milliseconds: 0
  mode: single

Instead of using a Time Pattern Trigger to check the TRV’s state every 5 seconds, have you considered using a State Trigger that detects when the TRV’s state changes from off to on?

  alias: example 
  trigger:
    - platform: state
      entity_id: binary_sensor.0x003c84fffef2cf55_valve_state
      from: 'off'
      to: 'on'
  condition: []
  action:
    ... etc ...

No, I haven’t. That is because I have 5 TRVs that expose binary_sensors but also 3 switches that control the floor heating valves on my first floor.
So that is total of 8 different states of 2 types - binary_sensor and switch.

Can I reliably use state trigger in this case? How do I combine the binary_sensor with the switch? Can I place them in the same group and check for the group state on/off?

Furthermore, I would really like to get an answer for my question above - does checking a sensor in a condition generate zigbee traffic or is it just a local DB call for HASS?

The condition is checking the binary_sensor’s state as recorded in Home Assistant’s State Machine. The value in the State Machine is supplied by the binary_sensor’s underlying integration. The integration gets the binary_sensor’s state based on its IOT Class (local push, local polling, etc). For example, if the integration is local push, it updates the binary_sensor’s state, in the State Machine, only when the physical device’s state actually changes.

You can use a single State Trigger to monitor multiple binary_sensors and switches.

I think I’m missing something obvious here but I would really like to understand your proposal for achieving this via State Trigger.

I have created a Binary Sensor group (let’s call it trv_heating) and included all of my 5 TRVs binary sensors inside.
I also created a Switch group (let’s call it floor_heating) and included the 3 floor heating valve switches.

The way this works to my understanding is that floor_heating will be ON in case at least one of the 3 floor heating valve switches is ON. Similarly, the trv_heating will be ON in case at least one of the 5 TRV binary sensors is ON, and OFF otherwise.

Now I have to create an Automation with a State Trigger.

alias: example 
  trigger:
    - platform: state
    entity_id:
    - switch.is_any_heating_on
    - binary_sensor.is_any_trv_heating_on
    from: 'off'
    to: 'on'
  condition: []
  action:
    ... etc ...

→ this will trigger if either trv_heating becomes ON or floor_heating becomes ON.
That will work and I understand that completely.

However, how do I achieve the opposite direction from ON → OFF?

alias: example 
  trigger:
    - platform: state
    entity_id:
    - switch.is_any_heating_on
    - binary_sensor.is_any_trv_heating_on
    from: 'on'
    to: 'off'
  condition: []
  action:
    ... etc ...

If I do it like that - this will trigger if any of the floor_heating/trv_heating moves from ON → OFF while I wish it would trigger if BOTH floor_heating AND trv_heating move from ON → OFF.
How do I do that?

Actually, I think I got it:

platform: state
entity_id:
  - switch.is_any_heating_on
  - binary_sensor.is_any_trv_heating_on
from: "on"
to: "off"

condition: and
conditions:
  - condition: state
    entity_id: switch.is_any_heating_on
    state: "off"
  - condition: state
    entity_id: binary_sensor.is_any_trv_heating_on
    state: "off"