gians-it
(Gians It)
1
I would like to set different effect depending on the time of day e.g. afternoon a different effect to night effect
three possibilities come to mind:
with condition:
- condition: time
after: '14:00:00'
or trigger:
trigger:
- platform: time
after: '14:00:00'
data_template:
topic: wled/aaee12/api
payload: '[FX=00] Solid'
but I think the best solution is in payload something similar:
payload: '{% if after: '14:00:00' * [FX=00] Solid *
I don’t know if it is possible to do it directly in the payload,
please have you some suggestions?
jocnnor
(Jim O'Connor)
2
There is no ‘after’ for a time trigger. If there was, this would trigger every single second after 14:00:00 lol.
The simplest would be something like the following:
trigger:
# Create a trigger for each time point you want
- platform: time
at: "14:00:00"
- platform: time
at: "20:00:00"
- platform: time
at: "08:00:00"
action:
- service: mqtt.publish
data:
topic: wled/aaee12/api
payload: >
{% if trigger.now.hour == 8 %}
[FX=00] Solid
{% elif trigger.now.hour == 14 %}
[FX=01] Solid
{% else %}
[FX=02] Default
{% endif %}
gians-it
(Gians It)
3
thank you very much for your help, I wanted to add a motion sensor but it seems to ignore it
trigger:
- platform: state
entity_id: binary_sensor.sensor_A1
to: 'on'
payload: >
{% if trigger.now.hour == 8 %}
{ is_state('binary_sensor.sensor_A1', 'on') }}
[FX=00] Solid
{% elif trigger.now.hour == 14 %}
{ is_state('binary_sensor.sensor_A1', 'on') }}
[FX=01] Solid
{% else %}
[FX=02] Default
{% endif %}
nickrout
(Nick Rout)
4
jocnnor
(Jim O'Connor)
5
A state trigger doesn’t have “trigger.now.hour”. That is special to a time trigger.
You’d just have to use {% if now().hour == 14 %}
I mean, you could do that in the original one too.
gians-it
(Gians It)
6
thank you so much for your useful ideas