Skip to content

Various fixes from HclX and nabahr#78

Merged
raetha merged 11 commits intomasterfrom
devel
Mar 6, 2025
Merged

Various fixes from HclX and nabahr#78
raetha merged 11 commits intomasterfrom
devel

Conversation

@raetha
Copy link
Copy Markdown
Owner

@raetha raetha commented Mar 6, 2025

Contents (#78)

Uncategorised!

  • Fixing exception in _OnSensorAlarm due to unknown events from climate sensor
  • Adding dongle thread crash detection
  • Fixing another crash in dongle thread
  • adding mqtt logs
  • Updated build workflow to build devel images
  • Small readme update to clarify where to submit PRs
  • Fix for missing user config file
  • Merge pull request Fix for missing user config file #77 from nabahr/user-config
  • Add automatic PR description generation
  • Fix to PR workflow
  • Add example of PR description to workflow

Admin@sg2 and others added 9 commits March 4, 2025 09:38
… 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
@raetha raetha self-assigned this Mar 6, 2025
@raetha raetha merged commit 7e17925 into master Mar 6, 2025
7 checks passed
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.

2 participants