Hello everybody
I made a card with a timer and its power button, and this works … Now I want to add a smart button, but I can’t enter the code, kindly someone could help me.
Thank you
this is the code used:
homeassistant:
input_number:
minuti_luci:
name: Minuti Timer Luci
initial: 1
min: 1
max: 20
step: 1
icon: mdi:timer
timer:
light_on:
name: Timer Luci
automation:
- alias: Luci accese timer acceso
trigger:
platform: state
entity_id:
- switch.switch_pompa_di_ricircolo
to: 'on'
action:
service: timer.start
entity_id: timer.light_on
data_template:
duration: "{{ (states('input_number.minuti_luci')|int(2) * 60)|timestamp_custom('%H:%M:%S',false) }}"
- alias: Luci spente timer cancellato
trigger:
platform: state
entity_id:
- switch.switch_pompa_di_ricircolo
to: 'off'
action:
service: timer.cancel
entity_id: timer.light_on
- alias: Luci spente fine timer
trigger:
platform: event
event_type: timer.finished
event_data:
entity_id: timer.light_on
action:
service: switch.turn_off
data_template:
entity_id:
- switch.switch_pompa_di_ricircolo