Binary sensor template from Calendar entry

Hi All.

I’m trying to make a binary sensor helper from calendar entries.

What I’m looking to do (and is partially working ) is create 3 binary sensors that change state when a calendar entry is active but all sensors are triggering at the same time.

I’ve created 3 Template helper binary sensors. Orange, Black and Blue to track which rubbish bin is due for collection.

The binary sensor triggers from the calendar and resets after the event but all three trigger regardless of what the calendar entry is.

Here’s what I have which seems to ignore the calendar summary and trigger all.

binary_sensor.black with template {{ states('calendar.house', 'Black bin') }}
binary_sensor.blue - {{ states('calendar.house', 'Blue bin') }}
binary_sensor.orange - {{ states('calendar.house', 'Orange bin') }}

What am I missing to specify a trigger from a specific event name?

Thanks

A calendar entity’s state will only be “on” or “off”… your second arguments are nonsense and just ignored, so all three templates turn “on”/true as soon as the calendar event becomes active.

For an selective active event you want to combine an is_state() and an is_state_attr():

{{ is_state('calendar.house', 'on') and
is_state_attr('calendar.house', 'message', 'Black bin') }}
1 Like

Thank you very much. This worked perfectly. I’d been reading about templates for about 2 days but still can’t get my head around them.

Here’s where it’s used; as an indicator for the following day on my NS Panel. Top blue recycling symbol.