[ANNOUNCE] node-red-contrib-sleep-timer

I have created a node which implements the logic of a TV sleep timer. I was unable to find a node which implemented this long if without a lot of external work in the flow.

I originally implemented this as a flow, but converted to to my very first node and node-red module.

I use this to add sleep timer support which integrates with Emby and Sonos and is controlled by physical buttons on the bedside, so it’s much easier than fiddling with the remote!

You can set, increment, decrement, stop and query the timer, the logic of the timer is documented in the README.md

Could you post something that shows how you expect this node to be used as its not leaping out at me as to how its going to be easier than using the TV remote

1 Like

I use it with w raspberry pi. I have physical buttons, one which sets a timer for an initial period, and one to increment and decrement the timer.

I don’t have to go hunting for the remote, getting to the timer on the TV can be tricky depending on where it is in the menu’s due to CEC. One of our TV’s (a Sony) it’s almost impossible without entering a PlayStation esq series of buttons to get to the sleep timer if you are on an input that is using CEC.

we exclusively use Emby as well on nvidia shields, we have no other sources and both movies and live tv are done through Emby. When I activate or change the sleep timer node-red displays a message in Emby showing the time left. When it gets to 60 seconds it also announces on Sonos using text to speech that the tv is about to go off, gives you ample warning to press the increment button to extend the timer if needed.

1 Like

Just as a further example, here's my flow for the bedroom TV. I appreciate that it may not be useful for a lot of folks and it may be a niche kind of node!

To flesh out a bit from what I said above, I'm using Pi Zero's with touchphats on them for our TV in the bedroom and the TV in our eldests room, just being able to touch a physical (but capacitive touch) switch to start it off is convenient. I suffer with insomnia due to health problems, so it's much easier & quicker for me to do this, it also means that I no longer need the normal TV remote and can control everything with the pi and the Nvidia shield remote.

This actually came about from wanting to be able to send the TV to sleep from Android TV or from Emby (to remove the need for the real tv remote), but it seems that is not possible, so when I installed node-red a few days back I realised I could implement the functionality myself using some of the TV control nodes that were available. I couldn't however find a timer that worked in the manner I needed without a whole load of extra logic, so I implemented it originally in a function node, but decided just to make the leap to a proper node to tidy some stuff up - it also proved as a learning exercise so that I could create an Emby node as well, which I've done, but I'm currently working on more functionality before I release that.

I figured it may be useful to other folks, so I'd make it available incase it was. I'm sure there are a load more use cases for a timer that works like this that don't involve a TV, maybe a sleep timer for a lamp or something.


Hi. There is no need to post images to imgur. Just drag and drop or paste image from clipboard.

This looks great, exactly what I've been looking for in a timer, but i'm having trouble getting the sleep-timer to start. Is there a specific payload format that needs to be sent to it? I've tried setting msg.payload to start or increment, but neither seem to actually start the timer. Also, how is the payload timout period supposed to be passed to the node?

The topic should be set to one of start, stop, increment, decrement or remaining

for the first 4, the payload is a number which is the number of minutes to set or to adjust the timer.

for remaining, the payload isn't used.

I use this myself every night, so it works nicely...let me know how you get on.

Thanks! That worked perfectly!

I took the liberty of submitting a pull request for your readme to hopefully help anybody else with the same questions I had. Feel free to accept, modify, or ignore it.


Awesome. I have merged your changes in, I admit it could probably do with a bit more info and maybe an example etc.

Would you mind posting the code of this flow, rather than just the picture, please?

Thank you!

This topic was automatically closed after 60 days. New replies are no longer allowed.