florianholzapfel / panasonic-viera

MIT License
54 stars 21 forks source link

Is it possible to retrieve TV's status? #21

Open akloeckner opened 5 years ago

akloeckner commented 5 years ago

I would love to see whether the TV is currently playing. Or which input it is on. Is it possible to get that info? And relay it to home assistant?

sgthree commented 4 years ago

You can find out whether the tv is on by taking advantage of a bug in the code. Issue a get_mute command. You will either get a response if the tv is on, or it will throw and exception. If it throws an exception, the tv is turned off. Unfortunately the remote will no longer work, as it is out of sync with the tv. To fix this, increment _session_seq_num by one and you are good to go

Marc1974 commented 4 years ago

Hello, I would like to track (with Homeassistant) when the TV is or on/off. So I came to this library. Switching off the TV with the remote is not triggering an exception on a Panasonic Viera TX-40DX730W. The Android TV App (TV Remote 2) seems to know if the TV is on / off as the on/off Button in the App changes the color if the TV is. Any chance to figure out how the App is doing it ?

akloeckner commented 4 years ago

@sgthree, thanks for your reply! I was actually trying to find out whether the TV was playing something (in the home-assistant sense). Home assistant already uses the exception trick to check if the TV is online, I believe.

enesbcs commented 4 years ago

A new function "upnp_service_subscribe()" appeared in the lib. Although i am unable to use it neither with nrc/ddd.xml nor nrc/event_0 to track TV status. I've only got "HTTP Error 400: Bad request"