hey all, first time post, so this is a difficult one. I have an issue. Short explanation:
i want my window blinds to open at 7:40 ONLY on workdays, but not in the weekend public holidays or when i’m on holiday. I had it working with the ‘workday’ integration, however updating confuration.yaml every time we take an extra day off, is not nice. So i thought: Let’s just add my google calendar. If i put some sort of holiday in there, it should also NOT open my curtains at 7:40. However, i can’t get this to work as expected. I’ve checked many posts, but nothing seems to solve my problem. Here’s the automation i’ve created:
alias: Rolgordijn slaapkamer om 7:40 werkdagen
description: ""
trigger:
- platform: time
at: "07:40:00"
condition:
- condition: and
conditions:
- condition: template
value_template: >-
{{ 'vakantie' in state_attr('calendar.mycalendar_hotmail_com',
'message') }}
- condition: state
entity_id: binary_sensor.workday_sensor
state: "on"
action:
- device_id: 2227a42488aff6919d3910d84469965f
domain: cover
entity_id: cover.rolgordijn_kamer
type: set_position
position: 100
mode: single
any guidance on where my brain is failing on me and what i’m doing wrong?
The state and attributes of a calendar entity relate to the next (or current) event. So, you need to check if the event held in the entity is for the current day.
There is an attribute that provides the date and time of the event.
It’s not guaranteed and that’s why one shouldn’t use a calendar’s attributes in conditions.
For example, the calendar’s attributes may not report the next/current event if there are two concurrently scheduled events or if there’s an All Day event.
OK, so am i getting it right in saying: I should use the calendar trigger to “set a holiday” boolean based on whether or not i have a holiday that day and use THAT one in a condition for my blinds?
and manually setting the “workday” state does seem like a bad idea because it will probably be overwritten at some point and probably won’t work for multiple day holidays… (right?)
update on my progress… i dediced indeed it’s better to create a boolean value with a button toggle on my homescreen to possibly do it manually if i want to. I then created an automation to also automagically set it through my calendar events. I hope this works… anyone any clues on how to “fast” test this?: