Hi all,
I would like to set timer for some of my light components in HA.
Just curious, is there any available Lovelace UI Card that could easily set timer for our light entity in HA frontend?
Thanks.
Hi all,
I would like to set timer for some of my light components in HA.
Just curious, is there any available Lovelace UI Card that could easily set timer for our light entity in HA frontend?
Thanks.
a lovelace card will only display entities, not do anything with them
You’d need to create an input_select (for predefined timers) or input_number (for free text, with all the possible human error typos that this would bring)
display the input_select in lovelace and create an automation when this changes.
It’s actually very easy using an input_number
which you can display Lovelace using a simply entity card.
I’ll put something together for you when I get a chance hopefully later tonight or in the morning (I’m in Australia and its evening now)
Ok, I decided to just rip straight into it. This is a basic version of what you could do. It could also be done with the timer component, scripts, all sorts of variations.
input_number:
light_timer:
name: Light timer
min: 1
max: 60
step: 1
icon: mdi:camera-timer
unit_of_measurement: min
automation:
- alias: 'Timed Light'
initial_state: 'on'
trigger:
- platform: state
entity_id: input_number.light_timer
action:
- service: light.turn_on
entity_id: light.YOUR_LIGHT_ENTITY
- delay: "00:{{ states('input_number.light_timer')|int }}:00"
- service: light.turn_off
entity_id: light.YOUR_LIGHT_ENTITY
As I said, this is basic. Hopefully it will give you an idea of one way that it can be acheived. As for the Lovelace side, simply create a entity card with the input_number.light_timer
and whenever you change the slider, it will turn the light on for that amount of time. (as long as I don’t have a mistake in my code )
Will test and revert back.
Hello,
This work with you? I have been around with a problem with de convertion to minutes the hass says that is not in the corret format. Can you help?
Thanks a lot
What code are you using?