Call callback when remote settings are inited (#1452)

When a fresh image first updates the settings after pairing it is handled somewhat differently and this was missed in the original implementation of the callback handling.

This minor change includes this case as well.
pull/1461/head
Åke 2018-03-01 08:07:55 +01:00 committed by Steve Penrod
parent 881687012e
commit 5a68908e80
1 changed files with 6 additions and 4 deletions

View File

@ -386,6 +386,7 @@ class SkillSettings(dict):
Args: Args:
hashed_meta (int): the hashed identifier hashed_meta (int): the hashed identifier
""" """
original = hash(str(self))
try: try:
if not is_paired(): if not is_paired():
pass pass
@ -394,14 +395,15 @@ class SkillSettings(dict):
if not self._complete_intialization: if not self._complete_intialization:
return # unable to do remote sync return # unable to do remote sync
else: else:
original = hash(str(self))
self.update_remote() self.update_remote()
# Call callback for updated settings
if self.changed_callback and hash(str(self)) != original:
self.changed_callback()
except Exception as e: except Exception as e:
LOG.error(e) LOG.error(e)
LOG.exception("") LOG.exception("")
finally:
# Call callback for updated settings
if self.changed_callback and hash(str(self)) != original:
self.changed_callback()
# this is used in core so do not delete! # this is used in core so do not delete!
if self.is_alive: if self.is_alive: