AntonioMeireles / homebridge-vieramatic

Homebridge plugin for Panasonic™ Viera™ TVs (includes support for 2018 and later models)
Apache License 2.0
43 stars 9 forks source link

current method of detecting power status is not universal across all generations [was: TV Model TH-55GX740H does not respond to `/pac/ddd.xml` even it is turned on] #43

Closed alexlau811 closed 3 years ago

alexlau811 commented 3 years ago

Describe your issue I am a user of TH-55GX740H model. My TV does not respond to /pac/ddd.xml even it is turned on.

Even if I turn it on, the tv.isTurnedOn() will always return false.

Issue Context

Here is my curl result regardless of whether my TV is on or in standby mode.

➜  ~ curl -vvv http://192.168.50.215/pac/ddd.xml
*   Trying 192.168.50.215...
* TCP_NODELAY set
* Connected to 192.168.50.215 (192.168.50.215) port 80 (#0)
> GET /pac/ddd.xml HTTP/1.1
> Host: 192.168.50.215
> User-Agent: curl/7.64.1
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Server: Panasonic AVC Server/1.00
< Connection: close
< Cache-Control: no-cache,no-store
< Content-Length: 0
< P3P: 10
<
* Closing connection 0

If I have forced the tv.isTurnedOn() to return true, everything works as expected.

AntonioMeireles commented 3 years ago

Hi!

thanks for reporting!

this one is definitively interesting, in the sense that is totally unexpected.

for context, bellow, is what i get in mine ...

and the weird part is that so far seemed to work for most people (and your set is even from same year as mine).

So, some questions:

Thanks in advance && cheers from the other side of the world

António

AntonioMeireles commented 3 years ago

btw,

are you certain that on your TV on Menu -> Network -> TV Remote App Settings the following settings are all turned ON:

?

thanks in advance

alexlau811 commented 3 years ago

Dear António

4.720 and it said it is the most updated one.

I am new to this plugin so I am sorry I cannot tell if it is recent or not.

URL TV ON TV OFF
http://YOUR_TV_IP:55000/nrc/ddd.xml 200 200
http://YOUR_TV_IP:55000/nrc/sdd_0.xml 200 200
http://YOUR_TV_IP:55000/dms/ddd.xml 200 200
http://YOUR_TV_IP:55000/dms/sdd_0.xml 200 200
http://YOUR_TV_IP:55000/dms/sdd_1.xml 200 200
http://YOUR_TV_IP:55000/dmr/ddd.xml 200 200
http://YOUR_TV_IP:55000/dmr/sdd_0.xml 200 200
http://YOUR_TV_IP:55000/dmr/sdd_1.xml 200 200
http://YOUR_TV_IP:55000/dmr/sdd_2.xml 200 200
http://YOUR_TV_IP:55000/pac/ddd.xml 400 400
http://YOUR_TV_IP:55000/pac/sdd_0.xml 400 400

accessories/vieramatic.json

{"4D454930-0200-1000-8001-80C755B86C63":{"data":{"inputs":{"hdmi":[{"id":"1","name":"NowTV","hidden":0},{"id":"2","name":"Switch","hidden":0},{"id":"3","name":"MyTV","hidden":0}],"applications":{"0":{"name":"Apps Market","id":"0387878700000102","hidden":1},"1":{"name":"Netflix","id":"0010000200000001","hidden":0},"2":{"name":"YouTube","id":"0070000200190001","hidden":1},"3":{"name":"Amazon Prime Video","id":"0010000100190001","hidden":1},"4":{"name":"WOWtv","id":"0030000500000001","hidden":1},"5":{"name":"é
                                               å½±ç
                                                   éè¦","id":"0387878700000013","hidden":1},"6":{"name":"éè¦æå","id":"0387878700000003","hidden":1},"7":{"name":"Browser","id":"007777770018A002","hidden":1},"8":{"name":"USBå享","id":"0387878700000015","hidden":1},"9":{"name":"Audio Link","id":"0387878700000141","hidden":1},"10":{"name":"Calendar","id":"0387878700150020","hidden":1},"11":{"name":"VIERA Link","id":"0387878700000016","hidden":1},"12":{"name":"UTV","id":"0030005100000001","hidden":1},"13":{"name":"SHOUTcast Radio","id":"0070000400000001","hidden":1},"14":{"name":"AccuWeather.com","id":"0070000C00000001","hidden":1},"15":{"name":"Digital Concert Hall","id":"0076002307170001","hidden":1},"16":{"name":"Notification Center","id":"0387878700000140","hidden":1},"17":{"name":"Smart Speaker Settings","id":"0387878700000146","hidden":1}},"TUNER":{"hidden":0}},"specs":{"friendlyName":"55GX740_Series","modelName":"Panasonic VIErA","modelNumber":"TH-55GX740H","manufacturer":"Panasonic","serialNumber":"4D454930-0200-1000-8001-80C755B86C63","requiresEncryption":true}}}}

homebridge config.json

{
    "bridge": {
        "name": "Homebridge 8626",
        "username": "0E:CE:40:A3:86:26",
        "port": 51437,
        "pin": "682-13-362"
    },
    "accessories": [],
    "platforms": [
        {
            "name": "Config",
            "port": 8581,
            "platform": "config"
        },
        {
            "tvs": [
                {
                    "ipAddress": "192.168.50.215",
                    "encKey": "========hidden========",
                    "appId": "AdaVBLgn63lm5w==",
                    "hdmiInputs": [
                        {
                            "id": "1",
                            "name": "NowTV"
                        },
                        {
                            "id": "2",
                            "name": "Switch"
                        },
                        {
                            "id": "3",
                            "name": "MyTV"
                        }
                    ],
                    "customVolumeSlider": true
                }
            ],
            "platform": "PanasonicVieraTV"
        },
        {
            "username": "========hidden========",
            "password": "========hidden========",
            "countryCode": "HK",
            "devices": [
                {
                    "ipAddress": "192.168.50.51",
                    "serialNumber": "E2X-HK-MNA0753A",
                    "enableAutoModeWhenActivating": true,
                    "enableOscillationWhenActivating": true,
                    "isNightModeEnabled": true,
                    "isJetFocusEnabled": false,
                    "isContinuousMonitoringEnabled": true,
                    "isTemperatureSensorEnabled": true,
                    "isHumiditySensorEnabled": true,
                    "isAirQualitySensorEnabled": true,
                    "isSingleSensorAccessoryModeEnabled": true,
                    "isSingleAccessoryModeEnabled": true,
                    "isFullRangeHumidity": false
                }
            ],
            "platform": "DysonPureCoolPlatform"
        }
    ]
}

Yes

AntonioMeireles commented 3 years ago

XXL thanks.

i'm officially puzzled. can you please install Panasonic's own "Panasonic TV Remote TV 3" mobile app (IOS install link and Android install link) and confirms that it behaves when interacting with your TV ?

thanks for your patience!

yahms commented 3 years ago

i only just picked up a S610 series second hand today, and have noticed a similar thing as this issue. current power state of tv isnt accurate.

Homekit just updates TV status to off after i have turned it on.

Also, while its in a state of TV being on but homekit thinking its off, if i hit the power button in the apple home app, the tv turns OFF and the home status flips to on, though it returns to off again anyway. Its clearly possible to poll the status of the tv because the Panasonic TV Remote 3 app on my phone can do it (**EDIT the colour of the light beside the power button in the App accurately reflects the TVs current power state). not much of a coder / dev but ill try pull what info i can.

TH-60CS610A Firmware 4.019 (latest, apparently) i dont have a 'networked standby' option but 'powered on by Apps' seems to do that for me (makes the light orange when 'off', not red)

Re HTTP status codes:

ON: curl -I -X GET http://10.8.16.79:55000/nrc/ddd.xml - 200 curl -I -X GET http://10.8.16.79:55000/nrc/sdd_0.xml - 200 curl -I -X GET http://10.8.16.79:55000/dms/ddd.xml - 200 curl -I -X GET http://10.8.16.79:55000/dms/sdd_0.xml - 200 curl -I -X GET http://10.8.16.79:55000/dms/sdd_1.xml - 200 curl -I -X GET http://10.8.16.79:55000/dmr/ddd.xml - 200 curl -I -X GET http://10.8.16.79:55000/dmr/sdd_0.xml - 200 curl -I -X GET http://10.8.16.79:55000/dmr/sdd_1.xml - 200 curl -I -X GET http://10.8.16.79:55000/dmr/sdd_2.xml - 200 curl -I -X GET http://10.8.16.79:55000/pac/ddd.xml - 400 curl -I -X GET http://10.8.16.79:55000/pac/sdd_0.xml - 400

OFF: curl -I -X GET http://10.8.16.79:55000/nrc/ddd.xml - 200 curl -I -X GET http://10.8.16.79:55000/nrc/sdd_0.xml - 200 curl -I -X GET http://10.8.16.79:55000/dms/ddd.xml - 200 curl -I -X GET http://10.8.16.79:55000/dms/sdd_0.xml - 200 curl -I -X GET http://10.8.16.79:55000/dms/sdd_1.xml - 200 curl -I -X GET http://10.8.16.79:55000/dmr/ddd.xml - 400 curl -I -X GET http://10.8.16.79:55000/dmr/sdd_0.xml - 400 curl -I -X GET http://10.8.16.79:55000/dmr/sdd_1.xml - 400 curl -I -X GET http://10.8.16.79:55000/dmr/sdd_2.xml - 400 curl -I -X GET http://10.8.16.79:55000/pac/ddd.xml - 400 curl -I -X GET http://10.8.16.79:55000/pac/sdd_0.xml - 400

config.json (snippet) { "tvs": [ { "ipAddress": "10.8.16.79", "hdmiInputs": [], "customVolumeSlider": true } ], "platform": "PanasonicVieraTV" }

vieramatic.json: {"4D454930-0200-1000-8001-A813744DD5A2":{"data":{"inputs":{"hdmi":[],"applications":{"0":{"name":"Apps Market","id":"0387878700000062","hiden":1},"1":{"name":"Screen Market","id":"0387878700000064","hiden":1},"2":{"name":"Media Player","id":"0387878700000032","hiden":1},"3":{"name":"Media Server","id":"0387878700000014","hiden":1},"4":{"name":"Mirroring","id":"0387878700000049","hiden":1},"5":{"name":"USB Sharing","id":"0387878700000015","hiden":1},"6":{"name":"Web Browser","id":"0077777700140002","hiden":1},"7":{"name":"Netflix","id":"0010000200000001","hiden":1},"8":{"name":"ABC iview","id":"0030000300000001","hiden":1},"9":{"name":"SBS On Demand","id":"0076001906000001","hiden":1},"10":{"name":"Digital Concert Hall","id":"0076002307000001","hiden":1},"11":{"name":"YouTube","id":"0070000200000001","hiden":1},"12":{"name":"Recorded TV","id":"0387878700000013","hiden":1},"13":{"name":"TV Guide","id":"0387878700000003","hiden":1},"14":{"name":"VIERA Link","id":"0387878700000016","hiden":1},"15":{"name":"TV","id":"0387878700000001","hiden":1},"16":{"name":"Main Menu","id":"0387878700000009","hiden":1},"17":{"name":"AccuWeather.com","id":"0070000C00000001","hiden":1},"18":{"name":"TuneIn","id":"0010001800000001","hiden":1}},"TUNER":{"hiden":1}},"specs":{"friendlyName":"Pan","modelName":"Panasonic VIErA","modelNumber":"S610","manufacturer":"Panasonic","serialNumber":"4D454930-0200-1000-8001-A813744DD5A2","requiresEncryption":false}}}}

AntonioMeireles commented 3 years ago

@yahms,

a quickie - other that the lack of accuracy of the power status between reality and homebridge/homekit are you able to power down the TV via homekit ?

AntonioMeireles commented 3 years ago

@yahms

would it be too much to ask you for some wireshark captures between the Panasonic's mobile app and the TV ?

yahms commented 3 years ago

@yahms,

a quickie - other that the lack of accuracy of the power status between reality and homebridge/homekit are you able to power down the TV via homekit ?

@AntonioMeireles yes i am

@yahms

would it be too much to ask you for some wireshark captures between the Panasonic's mobile app and the TV ?

@AntonioMeireles ill attempt that tomorrow. its late where i am :)

AntonioMeireles commented 3 years ago

@yahms

whatever suits you. :-) && thanks for your patience!

AntonioMeireles commented 3 years ago

@alexlau811

trying to spot a better heuristic to detect actual TVs power status, as you and @alexlau811 just showed that current approach isn't as universal as it was supposed to be :|

yahms commented 3 years ago

ios-openapp-off-on.pcapng.gz

@AntonioMeireles attached packet capture tv state was on to start with

opened app turned off tv turn on tv

should be a few seconds between the groups of packets so you can see what is what

.79 is tv .107 is phone.

can run it again if you need other things done, another order, or more time between

AntonioMeireles commented 3 years ago

OK, thanks - greatly appreciated!. it's using an UPnP sub to grab status of TV. refactored plugin to work that way for my TV (and should also work for yours) just now - mess is if it will work for all models that were working so far. Even Panasonic app seems to be confused by their API volatility as they induce few ISEs in your TV ... still digging.

AntonioMeireles commented 3 years ago

@alexlau811 @yahms

could you both plz give a try to homebridge-vieramatic=2.0.11-beta.2 ? (needs to be installed manually - npm install homebridge-vieramatic=2.0.11-beta.2 as plain update won't do since i've tagged it as beta.)

hopefully will work for both your use cases :-)

Thanks again for your patience!

yahms commented 3 years ago

That did it for me! Flipping switch (technically pressing a button) on Panasonic remote app either to on or off meant HomeKit updated the status and kept it. Could control from Home and see Panasonic remote app update accordingly too. Joyous

Thanks heaps for your work here @AntonioMeireles

@alexlau811 interested to hear how you go too

AntonioMeireles commented 3 years ago

@alexlau811

ping.

AntonioMeireles commented 3 years ago

@alexlau811, please confirm that issue is fixed also for your case in current shipping release (as of now 2.0.11)

alexlau811 commented 3 years ago

@AntonioMeireles Sorry for being away for a few days.

And the 2.0.11 version works perfectly! It can detect whether it is turned on or off.

Thank you again!

AntonioMeireles commented 3 years ago

@alexlau811

great to hear!

closing. feel free to bug again if issues arise.

thanks once again for your patience