I made an automation for the upstairs hallway, but I can’t make it work the way I like it.
The setup is simple. A lamp that can be operated by 2 action switches.
The following is what I have in mind, and it works that way.
During the day the light is on for 100% (day mode)
After sunset the light is on for 30% and switches off automatically after 5 minutes (night mode)
After a double-click the light is always on at 100% (day / night mode)
What I can’t figure out is “night mode”.
If the switch is pressed once during the night mode, you always have to wait 5 minutes before the automation is released.
Can this be accomplished in any other way?
Here is my automation:
alias: Overloop verlichting
description: Overdag of na "dubbel-klik" altijd 100%; Zon onder -> 30%
trigger:
- platform: mqtt
topic: zigbee2mqtt/overloop-1
- platform: mqtt
topic: zigbee2mqtt/overloop-2
condition:
- condition: template
value_template: '{{ trigger.payload_json["action"] in ["single", "double"] }}'
action:
- choose:
- conditions:
- condition: or
conditions:
- condition: template
value_template: '{{ trigger.payload_json["action"] == "double" }}'
- condition: sun
before: sunset
after: sunrise
sequence:
- service: light.toggle
target:
entity_id: light.overloop
data:
brightness_pct: 100
- conditions:
- condition: template
value_template: '{{ trigger.payload_json["action"] == "single" }}'
sequence:
- service: light.turn_on
target:
entity_id: light.overloop
data:
brightness_pct: 30
- delay:
hours: 0
minutes: 5
seconds: 0
milliseconds: 0
- service: light.turn_off
target:
entity_id: light.overloop
data: {}
default: []
mode: single