Fix reconnect replay of persisted settings
This commit is contained in:
parent
e5bd8db19e
commit
d67fe6fc90
|
|
@ -199,6 +199,11 @@ class Setting:
|
|||
if logger.isEnabledFor(logging.DEBUG):
|
||||
logger.debug("%s: apply (%s)", self.name, self._device)
|
||||
try:
|
||||
if self.persist and getattr(self._device, "persister", None) and self.name in self._device.persister:
|
||||
# Device-origin notifications can update _value without changing
|
||||
# the saved preference. Reconnect replay must use the saved
|
||||
# preference as the source of truth.
|
||||
self._value = None
|
||||
value = self.read(self.persist) # Don't use persisted value if setting doesn't persist
|
||||
if self.persist and value is not None: # If setting doesn't persist no need to write value just read
|
||||
self.write(value, save=False)
|
||||
|
|
|
|||
|
|
@ -1159,10 +1159,10 @@ def _record_setting(device, setting_class, values):
|
|||
if setting:
|
||||
assert device == setting._device
|
||||
if len(values) > 1:
|
||||
setting.update_key_value(values[0], values[-1])
|
||||
setting.update_key_value(values[0], values[-1], save=False)
|
||||
value = {values[0]: values[-1]}
|
||||
else:
|
||||
setting.update(values[-1])
|
||||
setting.update(values[-1], save=False)
|
||||
value = values[-1]
|
||||
device_path = device.receiver.path if device.receiver else device.path
|
||||
if (device_path, device.number, setting.name) in _items:
|
||||
|
|
|
|||
Loading…
Reference in New Issue