Skip to content

Commit

Permalink
Merge pull request #261 from krkeegan/PLM_Busy
Browse files Browse the repository at this point in the history
Parse, report and delay on receiving a PLM Busy Signal
  • Loading branch information
krkeegan authored Dec 18, 2020
2 parents 68093e1 + b0c0bdf commit 7b04d61
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
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

0 comments on commit 7b04d61

Please sign in to comment.