DIY $5 sensor that monitors your TV

Hi everyone!

Just wanted to share how I reliably track the state of my TV using a NodeMCU and ESPHome

Check it out :smiley:


Good idea! But the esp probably takes some time to build up wifi and tell HA that it’s online. How long is that time?

Edit: I see that you are a Samsung owner as well. Damn that tizen lol, we really need to get creative with these TV’s

About 2 secs IME. You can probably speed it up with fast_connect

1 Like

For me, the ESP takes around 10ish seconds for everything to connect and the state change. It’s not that big of a deal for us since we take some time to settle in before actually starts watching. I didn’t know there was a fast_connect option but now I’m definitely adding it to my config.

Yes! Tizen… I’ve tried all the Samsung tv (custom or not) components and nothing works! Finally led me to buy an IR remote and use such a sensor :joy:

1 Like

You can also reduce connection time by setting a static IP for the ESP and reserve it in your router, that bypasses the whole DHCP process which should also save you some time. May not be as useful for a TV monitor but monitoring other things using the same principle could be more time sensitive.

1 Like

I would rather use the USB as an input to read the state.
That way you can use the ESP to do more than just be off most of the day.
Just get the red wire from the USB cable and put a resistor in series to one of the pins.

1 Like

What else would you use it for? I mean I know there are probably dozens of use cases but I can’t think of one right now. Probably monitor other devices nearby like consoles?

I do exactly this, but just by using a ping sensor and an esp with a static ip address.

I have a number of motion controlled lights, but when the TV is on the automation doesn’t run

1 Like

Very cool! :smiley:

I also have a little buzzer connected to the ESP. Each time it powers up it gives a little beep which is a really nice indicator that someone has turned on the TV. I wanted it to also beep when the power cuts out but there doesn’t seem a way to do it.

Nice idea! Do the same thing with the power on and off of the chromecast :stuck_out_tongue:

1 Like

You don’t need to do both.

You can also plug your TV in a smart socket.

And monitor power consumption. This should be much faster.

I’m going to expand mine to look at the TV box also since that does not have an API I can look at if it’s on or off.

I have connected a servo that flips a switch on a “one in - two out HDMI” switch.

I have a microphone connected to my ESP which reads the volume played by my speaker system, if it’s too loud it sends a json string to my receiver to lower the volume (for short sudden stuff happening on TV).

I will connect a IR receiver to it that will give me the option to set the threshold (of the microphone) with the remote so I don’t have to use HA.

There is lots of things you can do with a device that is on, not much with a device that is off.


If you keep cutting the power to the ESP then that won’t work.
If you instead have the ESP on then you can add that as a service.

1 Like

Yes, I imagine it will be a lot faster as well (almost simultaneous) for the state to change (if the USB is an input). Going to try it when I get our order of micro USB cables. Thanks for the idea :+1:

Nice project! Once I saw this, i got the nodeMCU to make it :slight_smile:

1 Like

Why not? If you set a static IP within the range of DHCP you certainly need to reserve otherwise it could potentially be used by another device first.

Wow, that sounds like a ton of value for a single ESP, nice!

There is lots of things you can do with a device that is on, not much with a device that is off.

Indeed, haha.

Have you added the resistor to the usb cable? Would love a set of instructions if you did.