been a while since I’ve posted anything, but thought I would share my script for a Sonos Sleep timer that takes a number input rather than a fixed number.
I use a button entity with an icon to run the script from the dashboard and an entity card for the time input (actual a number input, but its used as time)
I have a number helper that has a step size of 1, a max of whatever you want in minutes(I have 120 minutes as max), minutes as unit of measurement and an entity Id of input_number.sleep_timer
In theory , possibly, it depends if you service that your calling requires a sleep_time , this is not really a timer script its more of a way of being able to input the number in the sleep_time variable that the sonos.set_sleep_timer service requires an integer for.
if you want to turn your air con off at a certain time then I have an automation for that ,
I was helped with this automation on this thread here
Thanks for your reply. After I replied I found the specific sonos timer function.
Thank you too for your link I had a quick look, and I mean really quick more like a gander and possibly saw that the timer function is setup as an input time format. While that would work for me of course I was more thinking of an actual timer which generally comes with a tv or natively with an airco. I did find a sleep timer blue print but I haven’t figured out how to set that up yet. iow how I setup the input time on the dashboard and then say start the countdown and when your done switch off the air con
Unfortunately unless the integration you want to use for the switch of your air con , has a service with a timer built in like the sonos timer, you will have to create a timer automation that on completion, triggers another automation or script that calls the service for the switch to turn off .
As far as the template goes for the input number you can use my example above as the value for the timer and a little of the link I posted about making an automation to turn switches off.
Plus the timer integration should help with some examples
Of course if you really get stuck you can of course post a thread with what you’ve done and ask for some help .