Hello,
couldn´t really think of any better topic name.
Was looking to upgrade my Automation for my Power Outlets for an LED Strip and a Self Made Word Clock.
Befor I had the Automation running like this:
alias: Steckdose Treppe
description: ""
trigger:
- platform: time
at: "18:00:00"
id: Winter
- platform: time
at: "20:00:00"
id: Sommer
condition: []
action:
- choose:
- conditions:
- condition: trigger
id:
- Sommer
- condition: and
conditions:
- condition: time
weekday:
- fri
- sat
- type: is_illuminance
condition: device
device_id: f6007e9d07e27321337b181db0cef632
entity_id: 1d01f5bb2505081e984f0fb5f0551b13
domain: sensor
below: 30
sequence:
- parallel:
- type: turn_on
device_id: 0890cfd24a47a09dc7cb2045d5aaacc7
entity_id: fa333c09b4e12ef1a505889a17f127bd
domain: switch
- type: turn_on
device_id: 423537b057c24cea606f78946ba8dd49
entity_id: e0757ac0389a54f4bc86b9ef5e82b3af
domain: switch
- delay:
hours: 3
minutes: 30
seconds: 0
milliseconds: 0
- parallel:
- type: turn_off
device_id: 0890cfd24a47a09dc7cb2045d5aaacc7
entity_id: fa333c09b4e12ef1a505889a17f127bd
domain: switch
- type: turn_off
device_id: 423537b057c24cea606f78946ba8dd49
entity_id: e0757ac0389a54f4bc86b9ef5e82b3af
domain: switch
- conditions:
- condition: trigger
id:
- Sommer
- condition: and
conditions:
- condition: time
weekday:
- tue
- wed
- mon
- thu
- sun
- type: is_illuminance
condition: device
device_id: f6007e9d07e27321337b181db0cef632
entity_id: 1d01f5bb2505081e984f0fb5f0551b13
domain: sensor
below: 30
sequence:
- parallel:
- type: turn_on
device_id: 0890cfd24a47a09dc7cb2045d5aaacc7
entity_id: fa333c09b4e12ef1a505889a17f127bd
domain: switch
- type: turn_on
device_id: 423537b057c24cea606f78946ba8dd49
entity_id: e0757ac0389a54f4bc86b9ef5e82b3af
domain: switch
- delay:
hours: 2
minutes: 0
seconds: 0
milliseconds: 0
- parallel:
- type: turn_off
device_id: 0890cfd24a47a09dc7cb2045d5aaacc7
entity_id: fa333c09b4e12ef1a505889a17f127bd
domain: switch
- type: turn_off
device_id: 423537b057c24cea606f78946ba8dd49
entity_id: e0757ac0389a54f4bc86b9ef5e82b3af
domain: switch
- choose:
- conditions:
- condition: trigger
id:
- Winter
- condition: and
conditions:
- condition: time
weekday:
- fri
- sat
- type: is_illuminance
condition: device
device_id: f6007e9d07e27321337b181db0cef632
entity_id: 1d01f5bb2505081e984f0fb5f0551b13
domain: sensor
below: 20
sequence:
- parallel:
- type: turn_on
device_id: 0890cfd24a47a09dc7cb2045d5aaacc7
entity_id: fa333c09b4e12ef1a505889a17f127bd
domain: switch
- type: turn_on
device_id: 423537b057c24cea606f78946ba8dd49
entity_id: e0757ac0389a54f4bc86b9ef5e82b3af
domain: switch
- delay:
hours: 4
minutes: 30
seconds: 0
milliseconds: 0
- parallel:
- type: turn_off
device_id: 0890cfd24a47a09dc7cb2045d5aaacc7
entity_id: fa333c09b4e12ef1a505889a17f127bd
domain: switch
- type: turn_off
device_id: 423537b057c24cea606f78946ba8dd49
entity_id: e0757ac0389a54f4bc86b9ef5e82b3af
domain: switch
- conditions:
- condition: trigger
id:
- Winter
- condition: and
conditions:
- condition: time
weekday:
- mon
- tue
- wed
- thu
- sun
- type: is_illuminance
condition: device
device_id: f6007e9d07e27321337b181db0cef632
entity_id: 1d01f5bb2505081e984f0fb5f0551b13
domain: sensor
below: 20
sequence:
- parallel:
- type: turn_on
device_id: 0890cfd24a47a09dc7cb2045d5aaacc7
entity_id: fa333c09b4e12ef1a505889a17f127bd
domain: switch
- type: turn_on
device_id: 423537b057c24cea606f78946ba8dd49
entity_id: e0757ac0389a54f4bc86b9ef5e82b3af
domain: switch
- delay:
hours: 3
minutes: 0
seconds: 0
milliseconds: 0
- parallel:
- type: turn_off
device_id: 0890cfd24a47a09dc7cb2045d5aaacc7
entity_id: fa333c09b4e12ef1a505889a17f127bd
domain: switch
- type: turn_off
device_id: 423537b057c24cea606f78946ba8dd49
entity_id: e0757ac0389a54f4bc86b9ef5e82b3af
domain: switch
mode: single
It worked perfectly fine, the problem with this version, it triggers at a certain time. I wanted it to trigger with the lighting from outside.
So i wrote this automation:
alias: Test Treppe
description: ""
trigger:
- type: illuminance
platform: device
device_id: 00c9c38b8c5df27f19ffab4bc75d269d
entity_id: 24a59d61024585b94750e98d4dfb156b
domain: sensor
below: 10
id: Treppe An
- type: illuminance
platform: device
device_id: 00c9c38b8c5df27f19ffab4bc75d269d
entity_id: 24a59d61024585b94750e98d4dfb156b
domain: sensor
below: 10
id: Treppe An WE
- platform: time
at: "21:01:00"
id: "Treppe Aus "
- platform: time
at: "23:01:00"
id: Treppe Aus WE
condition: []
action:
- choose:
- conditions:
- condition: trigger
id:
- Treppe An
- condition: time
after: "15:00:00"
before: "21:00:00"
weekday:
- mon
- tue
- wed
- thu
- sun
sequence:
- type: turn_on
device_id: 0890cfd24a47a09dc7cb2045d5aaacc7
entity_id: fa333c09b4e12ef1a505889a17f127bd
domain: switch
- type: turn_on
device_id: 423537b057c24cea606f78946ba8dd49
entity_id: e0757ac0389a54f4bc86b9ef5e82b3af
domain: switch
- conditions:
- condition: trigger
id:
- Treppe An WE
- condition: time
after: "15:00:00"
before: "23:00:00"
weekday:
- fri
- sat
sequence:
- type: turn_on
device_id: 0890cfd24a47a09dc7cb2045d5aaacc7
entity_id: fa333c09b4e12ef1a505889a17f127bd
domain: switch
- type: turn_on
device_id: 423537b057c24cea606f78946ba8dd49
entity_id: e0757ac0389a54f4bc86b9ef5e82b3af
domain: switch
- conditions:
- condition: trigger
id:
- "Treppe Aus "
- condition: time
weekday:
- mon
- tue
- wed
- thu
- sun
sequence:
- type: turn_off
device_id: 0890cfd24a47a09dc7cb2045d5aaacc7
entity_id: fa333c09b4e12ef1a505889a17f127bd
domain: switch
- type: turn_off
device_id: 423537b057c24cea606f78946ba8dd49
entity_id: e0757ac0389a54f4bc86b9ef5e82b3af
domain: switch
- conditions:
- condition: trigger
id:
- Treppe Aus WE
- condition: time
weekday:
- sat
- fri
sequence:
- type: turn_off
device_id: 0890cfd24a47a09dc7cb2045d5aaacc7
entity_id: fa333c09b4e12ef1a505889a17f127bd
domain: switch
- type: turn_off
device_id: 423537b057c24cea606f78946ba8dd49
entity_id: e0757ac0389a54f4bc86b9ef5e82b3af
domain: switch
mode: single
I tried it by changing the times so I don´t have to wait until 21:00 o´clock and it worked.
My question is, is there an easier way to write the automation and is it possible that this part of the automation doesn´t trigger when the sockets are already on? because its kinda pointless if it does.
alias: Test Treppe
description: ""
trigger:
- type: illuminance
platform: device
device_id: 00c9c38b8c5df27f19ffab4bc75d269d
entity_id: 24a59d61024585b94750e98d4dfb156b
domain: sensor
below: 10
id: Treppe An
- type: illuminance
platform: device
device_id: 00c9c38b8c5df27f19ffab4bc75d269d
entity_id: 24a59d61024585b94750e98d4dfb156b
domain: sensor
below: 10
id: Treppe An WE
- platform: time
at: "21:01:00"
id: "Treppe Aus "
- platform: time
at: "23:01:00"
id: Treppe Aus WE
Best regards,
Alex