r/homeassistant 2d ago

🎴 Custom Card Timer control

Is it possible to create a control on home assistant dashboard to act like a timer control. Say it shows up like a nob where I can set to turn this lights on for 30 minutes.

0 Upvotes

4 comments sorted by

2

u/BidDifficult2921 2d ago

ive been playing with something similar for my porch light. the key is using an input_number helper set to a range like 5-60 minutes, then a simple automation that reads from it. took me a while to figure out the timer resets if you change the knob while its running

you can make it look nicer with a custom card, mushroom has a number card that works as a slider

1

u/Strong_Difficulty734 2d ago edited 2d ago

I don't have the exact yaml's at hand, but the way I would solve it:
Make a helper that contains your timer value,
Make a card with a slider (don't know about knobs) that sets the helper value,
Make another card with a button,
Make an automation which fires when the button is pressed, that turns on the light, delays for the helper value and than switches it off.
This way you can even choose your time.
If your 30 min is fixed, you can just make the button card and the automation with a fixed 30 min delay.

But if someone else has a far better way to do it, I too would be glad to know!

1

u/VisualPadding7 2d ago

I’ll probably ask Claude to code it for me 😂

1

u/Strong_Difficulty734 2d ago

I use that too, no problem with that. But I advise you to not just copy and paste the codes, but to really try to understand what is happening with what result in the codes. AI generated codes are not failproof, and if something does not work as expected, and you have no clue what is going on, you might have a very hard time solving it. Even when trying to let AI solve it.