Andre0512 / pyhOn

Control hOn devices with python
MIT License
470 stars 1.76k forks source link

Connection Error #4

Closed jangelgon closed 1 year ago

jangelgon commented 1 year ago

It worked for me in the first versions, but it stopped working from version 2.X, I am currently using the integration "https://github.com/gvigroux/hon", but it works worse than yours.

I have a Candy dryer connected to hOn

I have tried with pyhOn and it always gives me connection errors.

Traceback (most recent call last): File "/home/jangelgon/.local/bin/pyhOn", line 8, in sys.exit(start()) File "/home/jangelgon/.local/lib/python3.10/site-packages/pyhon/main.py", line 108, in start asyncio.run(main()) File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete return future.result() File "/home/jangelgon/.local/lib/python3.10/site-packages/pyhon/main.py", line 90, in main async with HonConnection(user, password) as hon: File "/home/jangelgon/.local/lib/python3.10/site-packages/pyhon/api.py", line 29, in aenter await self.setup() File "/home/jangelgon/.local/lib/python3.10/site-packages/pyhon/api.py", line 60, in setup await asyncio.gather(*[ File "/home/jangelgon/.local/lib/python3.10/site-packages/pyhon/device.py", line 116, in load_commands await self._recover_last_command_states(commands) File "/home/jangelgon/.local/lib/python3.10/site-packages/pyhon/device.py", line 95, in _recover_last_command_states for key, data in command.settings.items(): File "/home/jangelgon/.local/lib/python3.10/site-packages/pyhon/commands.py", line 70, in settings return {s: self._parameters[s] for s in self.setting_keys} File "/home/jangelgon/.local/lib/python3.10/site-packages/pyhon/commands.py", line 70, in return {s: self._parameters[s] for s in self.setting_keys} KeyError: 'remainingTimeMM' Unclosed client session client_session: <aiohttp.client.ClientSession object at 0x7fec927dbee0> Unclosed connector '] connector: <aiohttp.connector.TCPConnector object at 0x7fec927dbfa0>

alexandre-leites commented 1 year ago

I think my PR #5 will also fix your issue as its very similar to mine. Wait for the approval and release to test again.

Andre0512 commented 1 year ago

Merged, thanks @alexandre-leites :+1:

jangelgon commented 1 year ago

Work's fine with my Dryer Thanks