Template Binary Sensor - Why is is listening for only one of my events?

I have a Template Binary Sensor I want to use to control a dehumidifier. I want that control to depend of a Schedule, and I have a water sensor near it that should register as ‘Dry’.

I think I have it coded up properly, but is says it’s only listening for one event - always the first one.

{{
is_state('schedule.bc_hydro_off_peak', 'on') 
and
is_state('binary_sensor.both_status_ce2a85c65f64', 'Dry')
}}

This template listens for the following state changed events:

  • Entity: schedule.bc_hydro_off_peak

When I reverse the condition:

{{
is_state('binary_sensor.both_status_ce2a85c65f64', 'Dry')
and
is_state('schedule.bc_hydro_off_peak', 'on') 
}}

This template listens for the following state changed events:

  • Entity: binary_sensor.both_status_ce2a85c65f64

So both events seem to be valid, but why doen’t it listen for both of them?

I am somewhat new to the whole Home Assistant environment, it could easily be the case that I just don’t have the right format for my condition. Any ideas?

I don’t know, but try this:

{{ (
is_state('binary_sensor.both_status_ce2a85c65f64', 'Dry')
and
is_state('schedule.bc_hydro_off_peak', 'on') 
)
}}

Damn those () :grinning:

At one point I did try the extra () around everything, it didn’t help.

Oddly enough, now the exact same code does work. It seems to be a weird issue in HA, but I don’t have a good way of reproducing it.

2 Likes

My comment was just a bit of silliness. Glad it is working now!!