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

Parse, report and delay on receiving a PLM Busy Signal #261

Merged
merged 3 commits into from
Dec 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@

- Don't treat broadcast messages from different groups as duplicate. Fixes
a bug where sequential presses of a button on a keypadlinc may not emit
mqtt messages as they should. ([PR 256][P256])
mqtt messages as they should. (thanks @tstabrawa)([PR 256][P256])

- Catch and delay on PLM reporting busy. ([PR 261][P261])

## [0.7.4]

Expand Down Expand Up @@ -478,3 +480,4 @@ will add new features.
[P236]: https://github.com/TD22057/insteon-mqtt/pull/236
[P255]: https://github.com/TD22057/insteon-mqtt/pull/255
[P256]: https://github.com/TD22057/insteon-mqtt/pull/256
[P261]: https://github.com/TD22057/insteon-mqtt/pull/261
11 changes: 11 additions & 0 deletions insteon_mqtt/Protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,17 @@ def _data_read(self, link, data):
#LOG.debug("Searching message (len %d): %s... ",
# len(self._buf), util.to_hex(self._buf,20))

# Look for PLM slow down messages
start = self._buf.find(0x15)
if start == 0:
LOG.info("PLM is busy, pausing briefly")
# Pause for 1/3 of a second if we are not already waiting
# longer
if self._next_write_time + .3 < time.time():
self._next_write_time = time.time() + .3
self._buf = self._buf[1:]
continue

# Find a message start token. Note that this token could also
# appear in the middle of a message so we can't be totally sure
# it's a message until we try to parse it. If there is no
Expand Down