def saveControlLightData(self, p_json):
     """A changed Light is returned.  Process it and update the light level
     """
     l_json = json_tools.decode_json_unicode(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.BrightnessPct = l_brightness = l_json['BrightnessPct']
     l_light_obj.UUID = l_json['UUID']
     LOG.info('Control Light via Web - Change {} device to Brightness {}'.format(l_light_obj.Name, l_light_obj.BrightnessPct))
     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_brightness)
Example #2
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)
Example #3
0
 def saveControlLightData(self, p_json):
     """A changed Light is returned.  Process it and update the light level
     """
     l_json = json_tools.decode_json_unicode(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.BrightnessPct = l_brightness = l_json['BrightnessPct']
     l_light_obj.UUID = l_json['UUID']
     LOG.info(
         'Control Light via Web - Change {} device to Brightness {}'.format(
             l_light_obj.Name, l_light_obj.BrightnessPct))
     l_topic = 'house/lighting/web/{}/control'.format(l_light_obj.Name)
     self.m_pyhouse_obj._APIs.Core.MqttAPI.MqttPublish(
         l_topic, l_light_obj)  # lighting/web/{}/control
     self.m_pyhouse_obj._APIs.House.LightingAPI.AbstractControlLight(
         l_light_obj, 'web', l_brightness)