MrAsterisco / homebridge-hisense-tv

A Homebridge plugin to control RemoteNow-compatible HiSense TVs.
MIT License
18 stars 8 forks source link

Do not crash when the TV doesn't respond to "sources" #50

Open gjlamb opened 10 months ago

gjlamb commented 10 months ago

Describe Your Problem: Reinstalling due to SD card failure in Hoobs raspberry pi. Installed plugin and connected to TV. Error in logs. Power button not doing anything in Apple Home app.

Logs: 21/08/2023, 17:09:56Hisense Tv Remotenow BridgeHiSenseTVERRORAn error occurred while fetching inputs: TypeError: Cannot read properties of null (reading 'join')

Show the Homebridge logs here, remove any sensitive information.


**Plugin Config:**
{
    "platform": "HiSenseTV",
    "devices": [
        {
            "id": "HiSenseTV",
            "name": "HiSense",
            "ipaddress": "192.168.68.60",
            "macaddress": "80:CB:BC:83:9B:9E",
            "sslmode": "custom",
            "sslcertificate": "~/cert.cer",
            "sslprivatekey": "~/key.pkcs8"
        }
    ]
}
```json
Show your Homebridge config.json here, remove any sensitive information.

Screenshots:

Environment:

MrAsterisco commented 10 months ago

Hey @gjlamb !

Have you paired the TV after reinstalling?

gjlamb commented 10 months ago

Yes. Get the code successfully to pair.

Found a closed issue so moved cert files from ~/ to new folder in plugin directory. Chmod 777 directory and files for good measure. Same error.

On 21 Aug 2023, at 5:26 pm, Alessio Moiso @.***> wrote:

Hey @gjlamb https://github.com/gjlamb !

Have you paired the TV after reinstalling?

— Reply to this email directly, view it on GitHub https://github.com/MrAsterisco/homebridge-hisense-tv/issues/50#issuecomment-1685792928, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMCBWUNJ4E5QQZ2C4SSP6MDXWMEQTANCNFSM6AAAAAA3X55AKI. You are receiving this because you were mentioned.

MrAsterisco commented 10 months ago

Do you have other logs around the type error one?

gjlamb commented 10 months ago

Thats all the log I see in Hoobs console. If theres another location from RPi system I can get them

MrAsterisco commented 10 months ago

Could you try using the Python script directly? Does it work?

gjlamb commented 10 months ago

Is there documentation on command examples?On 24 Aug 2023, at 5:25 pm, Alessio Moiso @.***> wrote: Could you try using the Python script directly? Does it work?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

gjlamb commented 10 months ago

The authorize command runs finesudo python3.9 hisensetv.py 192.168.68.60 --authorize --ifname wlan0 --certfile ../keys/cert.cer --keyfile ../keys/key.pkcs8I tried this if that’s what you were @.:/var/lib/hoobs/hisensetvremotenowbridge/node_modules/homebridge-hisense-tv-remotenow/bin$ sudo python3.9 hisensetv.py 192.168.68.60 --key menu --certfile ../keys/cert.cer --keyfile ../keys/key.pkcs8[2023-08-24 17:46:51,374] [INFO    ] SSL context created with cert file (../keys/cert.cer) and private key (../keys/key.pkcs8)Traceback (most recent call last):  File "/var/lib/hoobs/hisensetvremotenowbridge/node_modules/homebridge-hisense-tv-remotenow/bin/hisensetv/init.py", line 61, in get_mac_address    interface = netifaces.ifaddresses(ifname)ValueError: You must specify a valid interface name.During handling of the above exception, another exception occurred:Traceback (most recent call last):  File "/var/lib/hoobs/hisensetvremotenowbridge/node_modules/homebridge-hisense-tv-remotenow/bin/hisensetv.py", line 6, in     main.main()  File "/var/lib/hoobs/hisensetvremotenowbridge/node_modules/homebridge-hisense-tv-remotenow/bin/hisensetv/main.py", line 125, in main    tv = HisenseTv(  File "/var/lib/hoobs/hisensetvremotenowbridge/node_modules/homebridge-hisense-tv-remotenow/bin/hisensetv/init.py", line 116, in init    self._mac = get_mac_address(network_interface)  File "/var/lib/hoobs/hisensetvremotenowbridge/node_modules/homebridge-hisense-tv-remotenow/bin/hisensetv/init.py", line 64, in get_mac_address    raise HisenseTvError("Unknown network interface: " + ifname)hisensetv.HisenseTvError: Unknown network @.:/var/lib/hoobs/hisensetvremotenowbridge/node_modules/homebridge-hisense-tv-remotenow/bin$ Sent from my iPadOn 24 Aug 2023, at 5:25 pm, Alessio Moiso @.***> wrote: Could you try using the Python script directly? Does it work?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

MrAsterisco commented 10 months ago

Yes, you can find the documentation of the Python script here.

gjlamb commented 10 months ago

Looks like it does work from @.:/var/lib/hoobs/hisensetvremotenowbridge/node_modules/homebridge-hisense-tv-remotenow/bin$ sudo python3.9 hisensetv.py 192.168.68.60 --get volume --ifname wlan0 --certfile ../keys/cert.cer --keyfile ../keys/key.pkcs8[2023-08-24 17:55:09,507] [INFO    ] SSL context created with cert file (../keys/cert.cer) and private key (../keys/key.pkcs8)[2023-08-24 17:55:09,509] [INFO    ] Network interface MAC Address: 1e:6f:97:19:3c:e7{    "voice_type": 2}Sent from my iPadOn 24 Aug 2023, at 5:51 pm, Alessio Moiso @.> wrote: Yes, you can find the documentation of the Python script here.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

MrAsterisco commented 10 months ago

Can you invoke it with --get sources?

gjlamb commented 10 months ago

No @.:/var/lib/hoobs/hisensetvremotenowbridge/node_modules/homebridge-hisense-tv-remotenow/bin$ sudo python3.9 hisensetv.py 192.168.68.60 --get sources --ifname wlan0 --certfile ../keys/cert.cer --keyfile ../keys/key.pkcs8[2023-08-24 17:59:09,303] [INFO    ] SSL context created with cert file (../keys/cert.cer) and private key (../keys/key.pkcs8)[2023-08-24 17:59:09,305] [INFO    ] Network interface MAC Address: 82:cf:77:df:34:81Traceback (most recent call last):  File "/var/lib/hoobs/hisensetvremotenowbridge/node_modules/homebridge-hisense-tv-remotenow/bin/hisensetv/init.py", line 207, in _wait_for_response    return self._queue[topic].get(block=True, timeout=self.timeout)  File "/usr/lib/python3.9/queue.py", line 179, in get    raise Empty_queue.EmptyThe above exception was the direct cause of the following exception:Traceback (most recent call last):  File "/var/lib/hoobs/hisensetvremotenowbridge/node_modules/homebridge-hisense-tv-remotenow/bin/hisensetv.py", line 6, in     main.main()  File "/var/lib/hoobs/hisensetvremotenowbridge/node_modules/homebridge-hisense-tv-remotenow/bin/hisensetv/main.py", line 141, in main    output = func()  File "/var/lib/hoobs/hisensetvremotenowbridge/node_modules/homebridge-hisense-tv-remotenow/bin/hisensetv/init.py", line 54, in wrapper    return func(self, args, kwargs)  File "/var/lib/hoobs/hisensetvremotenowbridge/node_modules/homebridge-hisense-tv-remotenow/bin/hisensetv/init.py", line 573, in get_sources    return self._wait_for_response(topic=self._our_topic)  File "/var/lib/hoobs/hisensetvremotenowbridge/node_modules/homebridge-hisense-tv-remotenow/bin/hisensetv/init.py", line 209, in _wait_for_response    raise HisenseTvTimeoutError(hisensetv.HisenseTvTimeoutError: failed to recieve a response in 10.000sSent from my iPadOn 24 Aug 2023, at 5:58 pm, Alessio Moiso @.***> wrote: Can you invoke it with --get sources?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

MrAsterisco commented 10 months ago

Looks like the TV isn't responding to the command, which is what causing the plugin to fail. Not much that we can do there: have you tried restarting the TV?

gjlamb commented 10 months ago

I did a restart this morning after an update.

No problem. I think this model has never really worked well with the plugin. Best I could get was power but haven’t been able to get that either lately.

On Thu, 24 Aug 2023 at 6:07 pm, Alessio Moiso @.***> wrote:

Looks like the TV isn't responding to the command, which is what causing the plugin to fail. Not much that we can do there: have you tried restarting the TV?

— Reply to this email directly, view it on GitHub https://github.com/MrAsterisco/homebridge-hisense-tv/issues/50#issuecomment-1691209592, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMCBWUMDD3DC5HF5TBQRQ53XW4DTDANCNFSM6AAAAAA3X55AKI . You are receiving this because you were mentioned.Message ID: @.***>

-- Greg Lamb e: @.*** t: +61 419 222661 (WhatsApp) p: PO Box 602, Broadway, NSW 2007 Australia

MrAsterisco commented 10 months ago

The plugin doesn't work if it cannot get the list of sources. That's definitely something we could improve: I don't have an HiSense TV anymore, so I can't really make changes to the plugin as I wouldn't be able to test it anymore, but I'd be happy to support you doing this change.

gjlamb commented 10 months ago

Happy to gather info and test but I’m not a coder so couldn’t do it myself.Sent from my iPadOn 24 Aug 2023, at 6:12 pm, Alessio Moiso @.***> wrote: The plugin doesn't work if it cannot get the list of sources. That's definitely something we could improve: I don't have an HiSense TV anymore, so I can't really make changes to the plugin as I wouldn't be able to test it anymore, but I'd be happy to support you doing this change.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

MrAsterisco commented 10 months ago

I'll leave this issue open, then. Let's hope somebody can pick it up 😊

LeLunZ commented 1 month ago

@gjlamb do you still have the tv? If yes, I upgraded the plugin you could install the latest beta version. I am interested in if the plugin still crashes for you.