tom_l
April 23, 2024, 6:01am
23
Also you cant use this service template if you are adjusting the brightness.
The light turn off action does not accept a brightness value. This will generate errors and stop your automation.
Use Dave’s original automation and just change the brightness to include the template.
alias: Alfresco LED Strip Auto
description: Alfresco LED Strip Auto
trigger:
- platform: state
entity_id:
- binary_sensor.paradox_z6_alfresco_pir
to: "on"
- platform: state
entity_id:
- binary_sensor.alfresco_presence_sensor_f9a541_pir_sensor
to: "on"
- platform: state
entity_id:
- binary_sensor.paradox_z3_garage_door
to: "on"
action:
- service: light.turn_on
data:
brightness_pct: >
{% if 6 <= now().hour < 21 %}
60
{% else %}
30
{% endif %}
target:
entity_id: light.alfresco_led_strip
- delay: "00:02:00"
- service: light.turn_off
data: {}
target:
entity_id: light.alfresco_led_strip
trace:
stored_traces: 20
mode: restart
tux1980
(Wolli Marx)
April 23, 2024, 6:04am
24
Means I cannot use variables here (service: light.turn_{{ trigger.to_state.state }})
So I have just to create an own service for each action (on/off)?
alias: Motion Detection - TRADFRI Leon Tür
description: ""
trigger:
- platform: state
entity_id:
- binary_sensor.tradfri_leon_tuer_bewegung
to: "on"
- platform: state
entity_id:
- binary_sensor.tradfri_leon_tuer_bewegung
to: "off"
for:
minutes: 3
condition: []
action:
- service: light.turn_on
data:
brightness_pct: |
{% if 6 <= now().hour < 21 %}
60
{% else %}
20
{% endif %}
target:
entity_id: light.flur_oben_light
- service: light.turn_off
target:
entity_id: light.flur_oben_light
mode: restart
Ah you already put in an example above, just saw. Yeah thats what I mean I guess.
tom_l
April 23, 2024, 6:05am
25
No that will immediately turn off your lights after turning them on. At least it would if it was indented correctly.
Just use what I posted above.
tux1980
(Wolli Marx)
April 24, 2024, 2:07am
27
Hi.
Yes it seems like working and though the restart option, e.g. when working in the basemant to 20 Minutes, the light does not went out since each restarting will set off the 2 minute down-counter again. Right?
Thes was heloing a lot @tom_l .
tux1980
(Wolli Marx)
May 2, 2024, 3:12pm
28
Hi,
after some time observation - the issue that the light-bulbs are went off to early even though passing the sensors in very short Intervalls (seconds). I really do not know what I’m doing wrong here. The bulbs are just supposed to switch off AFTER the last passing of one of the three sensors for at least two minutes.
these is the yaml file, the other ones, there are looking exactly the same except for the motion sensors id of course.
Am I missing something?
alias: Motion Detection - EG HM Sensor
description: ""
trigger:
- platform: state
entity_id:
- binary_sensor.bewegungsmelder_eg_bewegung
to: "on"
action:
- service: light.turn_on
data:
brightness_pct: |
{% if 6 <= now().hour < 21 %}
60
{% else %}
40
{% endif %}
target:
entity_id: light.flur_eg_01_light
- service: light.turn_on
data:
brightness_pct: |
{% if 6 <= now().hour < 21 %}
60
{% else %}
40
{% endif %}
target:
entity_id: light.flur_eg_02_light_2
- service: light.turn_on
data:
brightness_pct: |
{% if 6 <= now().hour < 21 %}
60
{% else %}
40
{% endif %}
target:
entity_id: light.flur_eg_03_light
- service: light.turn_on
data:
brightness_pct: |
{% if 6 <= now().hour < 21 %}
60
{% else %}
40
{% endif %}
target:
entity_id: light.flur_eg_04_light
- delay: "00:02:00"
- service: light.turn_off
target:
entity_id: light.flur_eg_01_light
data: {}
- service: light.turn_off
target:
entity_id: light.flur_eg_02_light_2
data: {}
- service: light.turn_off
target:
entity_id: light.flur_eg_03_light
data: {}
- service: light.turn_off
target:
entity_id: light.flur_eg_04_light
data: {}
mode: restart
1 Like