In testing I was using MQTTfx to send a command to infopanel, unfortunately, it added two "LF", 0x0A, at the end of each message. If you send an invalid message, the code in display.py would flag it as invalid, but when the data was first received from MQTT it populated the invalid data in self.data_source... so, next time through the code it would use the invalid data and somewhat hang the system.
This fix was to re populate the MQTT structure with the current mode...
self.data_source['mode'] = self._mode # if mode is invalid, reset this in the mqtt populated
def apply_mode(self, mode):
"""
Apply a different sequence of scenes with different durations.
If the mode is the name of a scene, set that scene instead.
"""
LOG.info('Applying mode: %s', mode)
if mode not in self.modes:
if mode in self.scenes:
# allow mode names to be any scene name to get just that mode.
scene = self.scenes[mode]
self.scene_sequence = [scene]
self.durations_in_s[scene] = MODE_ALL_DURATION
else:
LOG.error('Invalid mode: %s', mode)
self.data_source['mode'] = self._mode # if mode is invalid, reset this in the mqtt populated collection
return
else:
self.scene_sequence = []
for scene_name, duration in self.modes[mode]:
scene = self.scenes[scene_name]
self.scene_sequence.append(scene)
self.durations_in_s[scene] = duration
self._scene_iterator = itertools.cycle(self.scene_sequence)
self._previous_mode = self._mode # for suspend/resume
self._mode = mode
In testing I was using MQTTfx to send a command to infopanel, unfortunately, it added two "LF", 0x0A, at the end of each message. If you send an invalid message, the code in display.py would flag it as invalid, but when the data was first received from MQTT it populated the invalid data in self.data_source... so, next time through the code it would use the invalid data and somewhat hang the system.
This fix was to re populate the MQTT structure with the current mode...