Before I had to switch to the latest HA (it’s been a while by the way), which has the configuration manager built it, my Automation used to work for my coffee machine,
To turn the coffee machine ON on Weekends I had something similar to this
(documentation link https://www.home-assistant.io/docs/scripts/conditions/)
condition:
condition: time
weekday:
- sat
- sun
But this hasn’t been working for a long time now since the UI configuration introduction, as there is no choice in the UI to specify Day
I manually edited the configuration and tried this:
- action:
- data:
entity_id: switch.coffee
service: switch.turn_on
alias: Coffee Machine On, Weekends
trigger:
- at: 00:06:00
platform: time
condition:
- weekday: sat
condition: time
- weekday: sun
condition: time
Still does not work.
How does one specify a day condition now?
Thanks gbboy, I appreciate your response.
I’ve made the adjustment, don’t have much time to test now, but I’ll know this weekend.
I’ll update this ticket then.
When the trigger kicks in for the conditions to be checked, it’s 6AM. Therefore you don’t need to check if 6AM is after 5AM and before 7AM - it normally is
The only condition you need to check for is if it’s the weekend.
Here’s my automation that also checks, if somebody is home.
I set up before I knew that conditions are generally evaluated as ‘and’ (while triggers are treated as ‘or’) so that part could be taken out.
- alias: NespressoPlug - turn on weekends
trigger:
platform: time
at: '07:00:00'
condition:
condition: and
conditions:
- condition: state
entity_id: group.people
state: 'home'
- condition: time
weekday:
- sat
- sun
action:
- service: homeassistant.turn_on
entity_id: switch.nespressoplug
The title of your post made me think first of one of my favorite components called Workday. It may add some additional capability or even simplify your automation.
Thank you gbboy chairstacker VdkaShaker
I really appreciate your responses.
Based on gbboy’s comments I had set up my automation like this.
alias: Coffee Machine On, Weekends
trigger:
- at: 00:06:00
platform: time
condition:
- after: 00:05:00
before: 00:07:00
condition: time
weekday:
- sat
- sun
action:
- data:
entity_id: switch.coffee
service: switch.turn_on
As it can been seen, I had a typo with the trigger time and it triggered at 12:06 AM instead of 06:00 AM lol
But it worked.
Thanks chairstacker for clarifying that I don’t need to specify the before and the after, that makes sense.
Also, you gave me good idea about also checking if someone is home, I’ve been burnt before on that.
Finally though I like VdkaShaker 's solution the most, as that suites my needs better, because I also wanted to have it triggered on holidays, and that’s exactly what I needed.
I quickly setup a test
alias: Test
trigger:
- at: 06:30
platform: time
condition:
- condition: state
entity_id: binary_sensor.workday
state: 'off'
action:
- data:
message: Weekend is now triggered.
title: Test
service: notify.pushbullet
And it triggered at 6:30 AM
I’ll add checking home with VdkaShaker’s solution and that would be perfect.
Many thanks to all three of you.
Have a good weekened