Skip to content

Commit

Permalink
Merge branch 'dev' into Pre_NAK
Browse files Browse the repository at this point in the history
  • Loading branch information
krkeegan committed Dec 12, 2020
2 parents 57dec45 + 97b819b commit 373c1ae
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
7 changes: 6 additions & 1 deletion HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
- [MQTT Doc](https://github.com/TD22057/insteon-mqtt/blob/master/docs/mqtt.md) -
note the new set_flags options for IOLinc and the IOLinc section

- A new queueing system for battery devices ([PR240][P240]):
- A new queueing system for battery devices ([PR240][P240]):
- Messages sent to the device will be queued until the device is awake
- When the device sends a message, the modem will attempt to immediately
send the oldest outgoing message. This only works for some devices.
Expand All @@ -26,6 +26,10 @@

### Fixes

- Database delta is updated on database writes. This eliminates a number of
unnecessary refresh requirements, particularly around pairing.
([PR 248][P248])

## [0.7.3]

Fixing a number of small bugs in preparation for upcoming releases which
Expand Down Expand Up @@ -429,3 +433,4 @@ will add new features.
[P237]: https://github.com/TD22057/insteon-mqtt/pull/227
[P197]: https://github.com/TD22057/insteon-mqtt/pull/197
[P240]: https://github.com/TD22057/insteon-mqtt/pull/240
[P248]: https://github.com/TD22057/insteon-mqtt/pull/248
1 change: 1 addition & 0 deletions insteon_mqtt/db/Device.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ def set_delta(self, delta):
"""
self.delta = delta
if delta is not None:
self.delta = self.delta % 256 # Roll over db if it goes past 256
self.save()

#-----------------------------------------------------------------------
Expand Down
18 changes: 17 additions & 1 deletion insteon_mqtt/db/DeviceModifyManagerI1.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,22 @@ def handle_lsb_response(self, msg, on_done):
else:
self.advance_lsb(on_done)

#-------------------------------------------------------------------
def handle_lsb_write_response(self, msg, on_done):
"""Handle Write of LSB
This is only used to increment the delta for this device.
Args:
msg: (message.InpStandard) The lsb message reply. The lsb data
is in the msg.cmd2 field.
on_done: (callback) a callback that is passed around and run on the
completion of the modification
"""
# Increment the delta 1
self.db.set_delta(self.db.delta + 1)
self.handle_lsb_response(self, msg, on_done)

#-------------------------------------------------------------------
def write_lsb_byte(self, on_done):
"""Writes the next byte in the record to the device.
Expand All @@ -165,7 +181,7 @@ def write_lsb_byte(self, on_done):
db_msg = Msg.OutStandard.direct(self.db.addr, 0x29,
self.record[self.record_index])
msg_handler = handler.StandardCmd(db_msg,
self.handle_lsb_response,
self.handle_lsb_write_response,
on_done=on_done,
num_retry=self._num_retry)
self.device.send(db_msg, msg_handler)
Expand Down
2 changes: 2 additions & 0 deletions insteon_mqtt/handler/DeviceDbModify.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ def msg_received(self, protocol, msg):
# entry, or an marked unused (deletion).
LOG.info("Updating entry: %s", self.entry)
self.db.add_entry(self.entry)
# Increment the delta 1
self.db.set_delta(self.db.delta + 1)
self.on_done(True, "Device database update complete",
self.entry)

Expand Down

0 comments on commit 373c1ae

Please sign in to comment.