MrAsterisco / homebridge-hisense-tv

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

ValueError: Unsupported callback API version: version 2.0 added a callback_api_version, see migrations.md for details #53

Closed ttaggorf closed 1 month ago

ttaggorf commented 3 months ago

Describe The Bug:

After weeks and weeks of trying to get this plugin to work, as a lot of the perquisites are now on new versions, I am still unable to 'pair' the TV. The latest error I'm getting is...

ValueError: Unsupported callback API version: version 2.0 added a callback_api_version, see migrations.md for details

To Reproduce:

Running script:

python3 hisensetv.py 172.16.0.13 --authorize --ifname ens18 --certfile tvcert.cer --keyfile tvkey.key

Expected behavior:

As per the readme - I'd expect the TV to produce a code and the script ask for this.

Logs:

sysadmin@pve-homebridge-1:/var/lib/homebridge/node_modules/homebridge-hisense-tv-remotenow/bin$ python3.8 hisensetv.py 172.16.0.13 --authorize --ifname ens18 --certfile tvcert.cer --keyfile tvkey.key

[2024-04-11 21:40:02,732] [INFO    ] SSL context created with cert file (tvcert.cer) and private key (tvkey.key)

[2024-04-11 21:40:02,733] [INFO    ] Network interface MAC Address: bc:24:11:87:ec:e9

Traceback (most recent call last):
  File "hisensetv.py", line 6, in <module>
    __main__.main()
  File "/var/lib/homebridge/node_modules/homebridge-hisense-tv-remotenow/bin/hisensetv/__main__.py", line 130, in main
    with tv:
  File "/var/lib/homebridge/node_modules/homebridge-hisense-tv-remotenow/bin/hisensetv/__init__.py", line 124, in __enter__
    self._mqtt_client = mqtt.Client(self.client_id)
  File "/usr/local/lib/python3.8/dist-packages/paho/mqtt/client.py", line 766, in __init__
    raise ValueError(

ValueError: Unsupported callback API version: version 2.0 added a callback_api_version, see migrations.md for details

Plugin Config:

Show your Homebridge config.json here, remove any sensitive information.

Screenshots:

Environment:

Thanks.

MrAsterisco commented 3 months ago

Hey @ttaggorf !

I'm sorry you're going through this. As I mentioned in other issues, this plugin has very specific requirements which also include things you may not be able to control, such as that your HiSense model must be one of the supported ones.

As of now, I don't have an HiSense TV anymore myself, so I'm not actively using this plugin, but I'm trying to give as much support as I can for the sake of the community. Please bear with me on this as not being able to test it directly makes it really hard to give recommendations.

I quickly googled your error and it seems a new version of the paho-mqtt dependency has been released which introduced breaking changes (see this question on StackOverflow). The new version requires a change on the underlying Python script, but in the meantime I would recommend to force-install the previous version:

pip install --force-reinstall -v "paho-mqtt==1.6.1"

Please let me know if this works, so I can update the README.

ttaggorf commented 3 months ago

Great, thanks.

It seems that has fixed the main issues, I was able to run the authorise script and get a setup code in the Homebridge logs. However, more issues arise...

[14/04/2024, 19:52:55] [HiSenseTV] Adding new accessory: Living Room TV
Setup Payload:
X-HM://0024HDZMXXP5T
Enter this code with your HomeKit app on your iOS device to pair with Homebridge:

    ┌────────────┐     
    │ 612-32-809 │     
    └────────────┘     

[14/04/2024, 19:52:55] Living Room TV 28F4 is running on port 43333.
[14/04/2024, 19:52:55] Please add [Living Room TV 28F4] manually in Home app. Setup Code: 612-32-809
[14/04/2024, 19:52:55] Homebridge v1.7.0 (HAP v0.11.1) (Homebridge 6809) is running on port 51301.

I'm then getting the following error every few seconds in Homebridge logs

[14/04/2024, 19:52:55] [HiSenseTV] An error occurred while fetching inputs: TypeError: Cannot read properties of null (reading 'join')

And within the Home app on iOS, the TV is there and shows as paired but all the inputs are 'Unknown' and the state is 'Unknown'. Powering on and off doesn't affect the TV in real life.

Thanks.

MrAsterisco commented 3 months ago

Glad to hear that installing the previous version fixed the first issue (I updated the README with this information)!

So, that error, although not the clearest, means that your TV isn't responding in a format that the plugin knows. In some cases, turning on and off works anyway, but inputs don't work (the specific error is thrown because the result of the request for listing inputs is not an array).

A very similar issue was also reported in #12 , but the reporter stopped responding, so I was not able to investigate further.

By any chance, does killing the Home app and restarting it fixes/improves the situation?

LeLunZ commented 1 month ago

Great, thanks.

It seems that has fixed the main issues, I was able to run the authorise script and get a setup code in the Homebridge logs. However, more issues arise...

[14/04/2024, 19:52:55] [HiSenseTV] Adding new accessory: Living Room TV
Setup Payload:
X-HM://0024HDZMXXP5T
Enter this code with your HomeKit app on your iOS device to pair with Homebridge:

    ┌────────────┐     
    │ 612-32-809 │     
    └────────────┘     

[14/04/2024, 19:52:55] Living Room TV 28F4 is running on port 43333.
[14/04/2024, 19:52:55] Please add [Living Room TV 28F4] manually in Home app. Setup Code: 612-32-809
[14/04/2024, 19:52:55] Homebridge v1.7.0 (HAP v0.11.1) (Homebridge 6809) is running on port 51301.

I'm then getting the following error every few seconds in Homebridge logs

[14/04/2024, 19:52:55] [HiSenseTV] An error occurred while fetching inputs: TypeError: Cannot read properties of null (reading 'join')

And within the Home app on iOS, the TV is there and shows as paired but all the inputs are 'Unknown' and the state is 'Unknown'. Powering on and off doesn't affect the TV in real life.

Thanks.

I came across this error when my TV wasn't turned on or no connection was possible. If you power on your TV. Wait 10 seconds. Restart the home app a few times the inputs will start to show up.

This currently is a bit annoying, but possible to work around so I am also thinking about adding this to the README.

LeLunZ commented 1 month ago

Closed in favor of #59