wiinc1
(BW)
October 1, 2022, 8:28pm
1
I finally got the routine to work to gradually increase the lamps in the bedroom starting at 6:15AM, but I’d like to avoid waking up at that time during the weekend.
Where did I go wrong when I added the weekday condition?
action:
- service: light.turn_on
data:
entity_id: light.graham_lamp
brightness: 5
- repeat:
sequence:
- service: light.turn_on
data:
entity_id: light.graham_lamp
brightness: "{{ state_attr('light.graham_lamp', 'brightness') | int + 10}}"
- delay: "00:00:03"
until:
condition: and
conditions:
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
- condition: template
value_template: "{{ state_attr('light.graham_lamp', 'brightness') | int >= 254 }}"
- condition: state
entity_id: light.graham_lamp
state: "off"
pedolsky
(Pedolsky)
October 1, 2022, 8:48pm
2
Put it in the condition section.
123
(Taras)
October 1, 2022, 8:55pm
3
According to your example, it will gradually increase the light’s brightness until all three of the following conditions are fulfilled:
It’s a weekday.
Brightness exceeds 254.
The light is off
.
How can the last two conditions be satisfied together? They require the light to be simultaneously off
and be at maximum brightness.
Maybe you wanted to logically OR the last two conditions?
I agree with pedolsky that the weekday condition doesn’t belong in the repeat-until.
tom_l
October 2, 2022, 2:39am
4
Also if you use this sensor:
You can simplify this:
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
To:
- condition: state
entity_id: binary_sensor.workday
state: 'on'
It has the advantage of excluding public holidays as well as weekends.
wiinc1
(BW)
October 16, 2022, 8:07pm
5
Thanks I’ll give that a try.
wiinc1
(BW)
October 23, 2022, 4:38pm
6
I updated the routine with the workday sensor, but I must have messed up the condition statements because it is still turning on during the weekends.
Any help would be appreciated!
- id: morningBrianLampOn
alias: "Brian lamp turned on at specific time"
trigger:
- at: "06:15:00"
platform: time
condition:
- condition: state
entity_id: binary_sensor.workday
state: "on"
action:
- service: light.turn_on
data:
entity_id: light.graham_lamp
brightness: 5
- repeat:
sequence:
- service: light.turn_on
data:
entity_id: light.graham_lamp
brightness: "{{ state_attr('light.graham_lamp', 'brightness') | int + 10}}"
- delay: "00:00:03"
until:
condition: and
conditions:
- condition: template
value_template: "{{ state_attr('light.graham_lamp', 'brightness') | int >= 255 }}"
- condition: state
entity_id: light.graham_lamp
state: "off"
123
(Taras)
October 23, 2022, 5:07pm
7
- id: morningBrianLampOn
alias: "Brian lamp turned on at specific time"
trigger:
- platform: time
at: "06:15:00"
condition:
- condition: template
value_template: '{{ 1 <= now().isoweekday() <= 5 }}'
action:
- variables:
lamp: light.graham_lamp
- service: light.turn_on
target:
entity_id: '{{ lamp }}'
data:
brightness: 5
- repeat:
sequence:
- service: light.turn_on
target:
entity_id: '{{ lamp }}'
data:
brightness_step: 10
- delay: "00:00:03"
until: "{{ state_attr(lamp, 'brightness') >= 255 or is_state(lamp, 'off') }}"