I am using the Binary workday sensor and it is working fine during the week. I would like to have a different time setup for the weekend if possible. I have searched the forums and tried many different things to get the timers to work for [sat, sun] but have had no luck. the workday sensor follows the same time all week and the router turns on at 3pm and off at 8pm. I tried to add [sat, sun] to the sensor with no success. Thanks for your help.
binary_sensor:
- platform: workday
country: US
workdays: [mon, tue, wed, thu, fri]
- alias: Turn on Wifi workdays
trigger:
platform: time
at: '15:00:00'
condition:
- condition: state
entity_id: 'binary_sensor.workday_sensor'
state: 'on'
action:
service: switch.turn_on
entity_id: switch.router
- alias: Turn off Wifi workdays
trigger:
platform: time
at: '20:00:00'
condition:
- condition: state
entity_id: 'binary_sensor.workday_sensor'
state: 'off'
action:
service: switch.turn_off
entity_id: switch.router
- alias: Turn on Wifi weekends
trigger:
platform: time
at: '09:00:00'
condition:
- condition: time
weekday:
- sat
- sun
- condition: state
entity_id: 'binary_sensor.workday_sensor'
state: 'on'
action:
service: switch.turn_on
entity_id: switch.router
- alias: Turn off Wifi weekends
trigger:
platform: time
at: '23:00:00'
condition:
- condition: time
weekday:
- sat
- sun
- condition: state
entity_id: 'binary_sensor.workday_sensor'
state: 'off'
action:
service: switch.turn_off
entity_id: switch.router`
You’re sure that your router is switched off at 20h on weekdays?
The condition says it only turns off when it not a workday, i.e. on the weekend.
And forget about trying to add Saturday and Sunday to the condition - your workday sensor already gives you that information.
Workday = on => Mon - Fri
Workday = off => Sat - Sun
The switch seems to follow the 3pm on and 8pm off no matter what day of the week it is. Is there a better way to do a weekday and weekend on-off schedule. I would like to have the switch on from 8am to 11pm on weekends. Thanks.
Thank You for the help. I will have to try your example later this week. For the section I copied below what needs to be put into the groups.yaml? When i look under my entity id’s i have a group.all_switches or group.all_automatons. There is nothing in my group.ymal file. I will try it without this section as maybe that part of the augment isn’t needed.
condition:
- condition: state
entity_id: group.people
state: 'home'
This is the automation setup I have now and it is working great. Just wanted to post it here in case it helps someone else who is looking for something similar. Thank you for your help.
- alias: Turn on Wifi workdays
trigger:
platform: time
at: '15:00:00'
condition:
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
action:
service: switch.turn_on
entity_id: switch.router
- alias: Turn off Wifi workdays
trigger:
platform: time
at: '20:00:00'
condition:
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
action:
service: switch.turn_off
entity_id: switch.router
- alias: Turn on Wifi weekends
trigger:
platform: time
at: '08:00:00'
condition:
- condition: time
weekday:
- sat
- sun
action:
service: switch.turn_on
entity_id: switch.router
- alias: Turn off Wifi weekends
trigger:
platform: time
at: '23:00:00'
condition:
- condition: time
weekday:
- sat
- sun
action:
service: switch.turn_off
entity_id: switch.router