Hello,
I’m trying to Make a picture element with a scheduling in which I want to mark one element depending on the time of the day.
Is it possible to put something like an icon in a position depending the hour of the day, with a template condition similar to:
{% if ((now().hour >= 1) and (now().hour <= 2)) %}
...
{% endif %}
I don’t know if this is possible at all or if there’s another possibility.
Any ideas are welcome.
I’ve solved creating a sensor to get the hour of the day:
sensor:
- platform: template
sensors:
hora:
friendly_name: 'Hour'
unit_of_measurement: 'hours'
value_template: "{{ now().hour }}"
And a picture elements with conditionals:
type: picture-elements
image: /local/background.png
elements:
- type: conditional
conditions:
- entity: sensor.hour
state: '4'
elements:
- type: image
image: local/image4.png
style:
top: 50%
left: 50%
width: 100%
- type: conditional
conditions:
- entity: sensor.hour
state: '5'
elements:
- type: image
image: local/image5.png
style:
top: 50%
left: 50%
width: 100%
...