Hi,
I’m trying to set a slider with hour/minute to a certain action. (e.g. hour and minutes in the HA interface to turn on a specific light or trigger the alarm).
I’ve ready and used several examples, but cannot do the trigger. Here is my code, adapted from one alarmclock that is very similar to what I want:
group: alarmclock: name: Default Time to Action entities: - sensor.alarm_time - input_slider.alarmhour - input_slider.alarmminutes
sensor:
- platform: template
sensors:
alarm_time:
friendly_name: 'Alarm'
value_template: '{% if states.input_slider.alarmhour.state|round(0)|string|length == 1 %}0{% endif %}{{ states.input_slider.alarmhour.state|round(0)|string }}:{% if states.input_slider.alarmminutes.state|round(0)|string|length == 1 %}0{% endif %}{{ states.input_slider.alarmminutes.state|round(0)|string }}'
entity_id:
- input_slider.alarmminutes
- input_slider.alarmhour
relative_alarm_time:
value_template: '{{ states.input_slider.alarmhour.state|float|multiply(60) + states.input_slider.alarmminutes.state|float - (now().hour|float|multiply(60) + now().minute)}}'
unit_of_measurement: "min"
entity_id:
- sensor.time
- platform: time_date
display_options:
- 'time'
input_slider:
alarmhour:
name: Hour
icon: mdi:timer
initial: 7
min: 5
max: 22
step: 1
alarmminutes:
name: Minutes
icon: mdi:timer
initial: 0
min: 0
max: 55
step: 5
Know, my problem is with the action… I’ve tested several actions but i cannot get this to work…
Can you point me to some example?
Tks!