I have a chromecast with google tv connected to the tv. Unfortunately the state of the chromecast is always ‘off’. Even when I touch the power on button on the remote, the state doesn’t change. However, my tv powers on via HDMI-CEC.
The tv is an older model (sony bravia kdl w656a) and can’t be integrated in Home Assistant.
How can I get the on/off state of the tv? Can I read the cec commands from the chromecast or something?
Or should I get a smart plug that measures the energy of the tv? And which one should I get that doesn’t need a extra hub?
Or should I ping my tv every x seconds?
Ping usually works, but there could be a few seconds delay.
A faster way is to connect a ESP to the TVs USB (if it switches off with the TV).
The more DIY version of the above is to power the ESP elsewhere and only read the voltage of the USB port.
Keep in mind the USB is 5 volt and you need to put a voltage divider to bring it down to ~3-3.3 volt for the ESP to read it.
The DIY version will be instantaneous and report on/off where as powering the ESP from the TV will be on/unavailable (you could template it to on/off).
A smart plug might be the simplest solution. The diy route would be able to be powered all the time vs by the tv usb. The tv usb device would have to power up and connect to your network before it would report to HA, so there will be a delay.
That could work.
You just flash it with ESPhome and create an entity on the ESP to transmit to HA.
Just make sure the USB port works as we believe first.
Just plug in a wired mouse or a keyboard with lights or something that will make it visible that it’s on or off.
The full DIY version has the advantage that you have a board that you can use all the time for other purposes.
Temperature or humidity?
Perhaps your remote has a few buttons you don’t use? Add an IR receiver to the ESP and you can control the Chromecast.
I did that, I can fast forward or skip to x minutes in a casted show.
Keep in mind, if you want to add more stuff to your ESP then you need a bigger board like ESP8266 or ESP32.
Most likely the 8266 is good enough.
What part do you need help with?
It will require some soldering, are you OK with that?
And you will need two resistors of some value I can look up later.
And cables to wire it all.
It is really simple.
that’s one of the options, I’m trying to find the easiest and cheapest one.
The best would be to get the state from Chromecast when pressing the power button on the remote. But that’s not possible? Or should I try something like this? Android TV - Home Assistant
I have that TV and I use a esp8266 plugged into the USB on the side of the TV. I use MQTT to tell me if it’s on/off with ESPHome. There is a 10-15 second delay when I turn the TV off at night. I think I needed to change a setting in the TV’s setup (it’s been a long time) & I get a messge on the TV when I turn it on that the USB is in use.
I got it working by adding the chromecast as an android tv device
After power on, the state is paused, idle, playing or whatever
After power off the state is like this!
Have you tried to cut the data wires on the USB cable?
I believe that will stop the message.
If you have an old USB mini cable and there is a 5 volt pin then it’s an easy test to see if it works.
Mini cables are not used much either anymore so sacrifice one is not a big deal.
You should consider marking your answer as the solution to your question. It will mark the thread as solved and highlight the answer. This way in the future when people search, they will know there is a solution in this post.