bendavid / aiopylgtv

Library to control webOS based LG Tv devices
MIT License
145 stars 47 forks source link

subscribe_power_state breaks webOS2 #9

Closed vide closed 4 years ago

vide commented 4 years ago

Hello, and first of all thanks for this library! I was trying to get my LG TVs work with Home Assistant and I discovered it uses this library. Trying the basic example it works out of the box with my newer LG TV with WebOS3 but to make it work with the other TV with WebOS2 I have to comment out https://github.com/bendavid/aiopylgtv/blob/master/aiopylgtv/webos_client.py#L233 otherwise I always get

Traceback (most recent call last):
  File "/home/vide/tmp/lg.py", line 14, in <module>
    asyncio.get_event_loop().run_until_complete(runloop(client))
  File "/usr/lib/python3.7/asyncio/base_events.py", line 579, in run_until_complete
    return future.result()
  File "/home/vide/tmp/lg.py", line 7, in runloop
    await client.connect()
  File "/home/vide/.local/lib/python3.7/site-packages/aiopylgtv/webos_client.py", line 137, in connect
    return await self.connect_result
  File "/home/vide/.local/lib/python3.7/site-packages/aiopylgtv/webos_client.py", line 239, in connect_handler
    self.subscribe_sound_output(self.set_sound_output_state),
  File "/home/vide/.local/lib/python3.7/site-packages/aiopylgtv/webos_client.py", line 694, in subscribe_power_state
    return await self.subscribe(callback, ep.GET_POWER_STATE)
  File "/home/vide/.local/lib/python3.7/site-packages/aiopylgtv/webos_client.py", line 631, in subscribe
    uri, payload=payload, cmd_type="subscribe", uid=uid
  File "/home/vide/.local/lib/python3.7/site-packages/aiopylgtv/webos_client.py", line 618, in request
    raise PyLGTVCmdException(f"Invalid request response {response}")
aiopylgtv.webos_client.PyLGTVCmdException: Invalid request response {'type': 'error', 'id': 3, 'error': '404 no such service or method', 'payload': {}}

btw Home Assistant doesn't work with WebOS3 either but that's another topic :)

bendavid commented 4 years ago

Fixed by https://github.com/bendavid/aiopylgtv/commit/9a20b9b5cfbfc488e7fd6bee2c3f36db5713c724 (though this will need a related change in home assistant to make state tracking work properly for older webos versions)

vide commented 4 years ago

Thanks! Yeah I see that in Home Assistant devel branch they are pinning to 0.3.0 right now.

On a side note, the problem I had with Home Assistant and the webOS pairing was due to a missing library libf77blas.so.3 which in turns comes from the numpy dependency which it's a reported issue. Leaving the comment here in case somebody in the future has a similar problem (I guess all the current new installations of Home Assistant via virtualenv will experience it)