Why is this combined template failing to indicate it is "on"?

I have two templates named Dusk Luminance and Dusk Elevation. I've combined these two into the combined template below named Dusk Combined. Currently the Dusk Luminance and Dusk Elevation sensors are both in the "on" state. Yet the combined template below remains "off". Any idea what could be causing this behavior?

{{ is_state('binary_sensor.dusk_luminance', 'on') or
is_state('binary_sensor.dusk_elevation', 'on') }}

-Thanks

Looks fine, post where you’re seeing it report “off”

Developer Tools indicates it is off. Also, when I select the condition in an automation it says it did not pass.

While it doesn't address the question of the state of your entity, you can't test a Trigger Condition like that... The condition Test function is outside the actual automation, since the automation isn't running, there isn't a trigger.id value to compare against. The condition Test tool should always fail when used on a Trigger Condition.

Did you mean for that to be a State Condition, maybe?


Have you checked the template, and its parts, in the Template Editor? What is the result if you paste the following into the editor?

{{ states('binary_sensor.dusk_luminance') }}
{{ is_state('binary_sensor.dusk_luminance', 'on') }}

{{ states('binary_sensor.dusk_elevation') }}
{{ is_state('binary_sensor.dusk_elevation', 'on') }}


{{ is_state('binary_sensor.dusk_luminance', 'on') or
is_state('binary_sensor.dusk_elevation', 'on') }}

Currently the Dusk Elevation and Dusk Luminance are both in the "on" state. I assumed combining them with an "OR" statement would cause it to be in the "on" state if one or the other is in the on state. Currently they are both in the "on" state.

You need to check in the Template Editor.

Showing us a screenshot of a section of a dashboard card without the card config doesn't help us. All of those could be completely different entities or you could need to refresh your browser cache.

I'm getting this error when I try and paste the first one:

That's not the Template Editor... that's "Set State" portion of the States tool... you need to click the "Template" tab.

Thanks. The template editor shows false for all of these:

I don't get it, the dusk_luminance sensor for example is definitely on:

Based on the results from the Template Editor, it looks like those are not the correct entity IDs. You need to find the correct entity IDs for those two sensors.

Thanks, I'll take a look at this tomorrow.

Are these perhaps Template Sensors rather than Template Binary Sensors? Can you show us the setup of one or both of these sensors?

They're both binary sensors. I think I'm using the wrong entities in my combined template.

-Thanks

1 Like

Then you should be using the entity_id you see in your screenshots for your template.

1 Like

I changed the "Dusk Combined" template to the following, which toggles On/Off when I change the 'on' to 'off' in either statement. So I think this is correct.

-Thanks

{{ is_state('binary_sensor.sun_sunset_template', 'on') or
is_state('binary_sensor.aqara_t1_light_sensor_luminance_template', 'on') }}