示例#1
0
 def saveControlLightData(self, p_json):
     """A changed Light is returned.  Process it and update the light level
     """
     l_json = JsonUnicode().decode_json(p_json)
     l_light_ix = int(l_json['Key'])
     l_light_obj = LightData()
     l_light_obj.Name = l_json['Name']
     l_light_obj.Key = l_light_ix
     l_light_obj.CurLevel = l_level = l_json['Level']
     l_light_obj.LightingType = 'Light'
     l_light_obj.UUID = l_json['UUID']
     LOG.info('Control Light via Web - Change {} device to level {}'.format(l_light_obj.Name, l_light_obj.CurLevel))
     l_topic = 'lighting/web/{}/control'.format(l_light_obj.Name)
     self.m_pyhouse_obj.APIs.Computer.MqttAPI.MqttPublish(l_topic, l_light_obj)  # lighting/web/{}/control
     self.m_pyhouse_obj.APIs.House.LightingAPI.ChangeLight(l_light_obj, 'web', l_level)