Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing the pyit600 errors on connection and improving the gateway json response #42

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

samuellazea
Copy link

Before the fixes

`root@32f54c65cdfe:/app/pyit600# python main.py --host 192.168.150.255 --euid xxxxxx --debug
DEBUG:pyit600:Trying to connect to gateway at 192.168.150.255
DEBUG:pyit600:Gateway request: POST http://192.168.150.255:80/deviceid/read
{"requestAttr": "readall"}

--- Logging error ---
Traceback (most recent call last):
File "/app/pyit600/pyit600/gateway.py", line 922, in _make_encrypted_request
with async_timeout.timeout(self._request_timeout):
AttributeError: enter

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.10/logging/init.py", line 1100, in emit
msg = self.format(record)
File "/usr/local/lib/python3.10/logging/init.py", line 943, in format
return fmt.format(record)
File "/usr/local/lib/python3.10/logging/init.py", line 678, in format
record.message = record.getMessage()
File "/usr/local/lib/python3.10/logging/init.py", line 368, in getMessage
msg = msg % self.args
TypeError: not all arguments converted during string formatting
Call stack:
File "/app/pyit600/main.py", line 172, in
asyncio.run(main())
File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 636, in run_until_complete
self.run_forever()
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 603, in run_forever
self._run_once()
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1909, in _run_once
handle._run()
File "/usr/local/lib/python3.10/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/app/pyit600/main.py", line 72, in main
await gateway.connect()
File "/app/pyit600/pyit600/gateway.py", line 101, in connect
all_devices = await self._make_encrypted_request(
File "/app/pyit600/pyit600/gateway.py", line 956, in _make_encrypted_request
_LOGGER.error("Exception. %s / %s", type(e), repr(e.args), e)
Message: 'Exception. %s / %s'
Arguments: (<class 'AttributeError'>, "('enter',)", AttributeError('enter'))
Traceback (most recent call last):
File "/app/pyit600/pyit600/gateway.py", line 922, in _make_encrypted_request
with async_timeout.timeout(self._request_timeout):
AttributeError: enter

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/app/pyit600/main.py", line 172, in
asyncio.run(main())
File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/app/pyit600/main.py", line 72, in main
await gateway.connect()
File "/app/pyit600/pyit600/gateway.py", line 101, in connect
all_devices = await self._make_encrypted_request(
File "/app/pyit600/pyit600/gateway.py", line 957, in _make_encrypted_request
raise IT600CommandError(
pyit600.exceptions.IT600CommandError: Unknown error occurred while communicating with iT600 gateway
`

After the fixes

`root@32f54c65cdfe:/app/pyit600# python main.py --host 192.168.150.185 --euid xxxxxxx--debug
DEBUG:pyit600:Trying to connect to gateway at 192.168.150.255
DEBUG:pyit600:Gateway request: POST http://192.168.150.255:80/deviceid/read
{"requestAttr": "readall"}

DEBUG:pyit600:Gateway response:
{"id":[{"data":{"DeviceType":100,"Endpoint":1,"UniID":"xxx"},"sGenSche":{"UpdateGenScheStatus":0},"DeviceL":{"DeviceType":100,"getModelIdentifierFlag_i":1,"DeviceSubType":1026,"UnquieID":"xxxx","ClusterIDList_i":"xxxx#","AttributeList":"xxxx"
..............`

Please let me know if you see something that should be also changed/improved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant