Conversation
… sensor
I have a dongle with HMS firmware and paired with a climate sensor.
The service will stop recieving any events after a while and it
turned out the event from climate sensor triggers the "unknown type"
path and causing exceptions:
```
Trying to parse: b'55aa531d1900000193e7c6c812a1373743363831443007115a00010059ae4608c8'
Received: b'55aa531d1900000193e7c6c812a1373743363831443007115a00010059ae4608c8'
<=== Received: Packet: Cmd=5319, Payload=b'00000193e7c6c812a1373743363831443007115a00010059ae46'
Sending ACK packet for cmd 5319
===> Sending: Packet: Cmd=53FF, Payload=ACK(5319)
Sending: b'aa555319ff026a'
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/wyzesense2mqtt/wyzesense.py", line 413, in _Worker
self._HandlePacket(pkt)
File "/wyzesense2mqtt/wyzesense.py", line 375, in _HandlePacket
handler(pkt)
File "/wyzesense2mqtt/wyzesense.py", line 285, in _OnSensorAlarm
sensor_type = "unknown (" + type + ")"
TypeError: can only concatenate str (not "int") to str
Sending PUBLISH (d0, q2, r1, m220), 'b'wyzesense2mqtt/status'', ... (6 bytes)
Received PUBREC (Mid: 220)
Sending PUBREL (Mid: 220)
```
The exception messages are not in any log files and can only be seen
from console output. To make it worse, when exception happens, the program
doesn't detect it so it continues running without realizing it.
This is just a temporary fix by avoiding the exception. A proper fix should
force the program to exit/crash to make similiar issues more visible.
This adds logic so that when dongle thread crashes, the service loop can detect the crash and exit gracefully with enough debugging information in the log.
Signed-off-by: Nathan Bahr <nathan.bahr@gmail.com>
Prevent error if user_config value is empty
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contents (#78)
Uncategorised!