def saveControllerData(self, p_json):
     """A new/changed controller is returned.  Process it and update the internal data via controller.py
     """
     l_json = json_tools.decode_json_unicode(p_json)
     l_ix = int(l_json['Key'])
     l_delete = l_json['Delete']
     if l_delete:
         try:
             del self.m_pyhouse_obj.House.Lighting.Controllers[l_ix]
         except AttributeError:
             LOG.error("web_controllers - Failed to delete - JSON: {}".FORMAT(l_json))
         return
     l_obj = ControllerData()
     try:
         l_obj = self.m_pyhouse_obj.House.Lighting.Controllers[l_ix]
     except KeyError:
         LOG.warning('Creating a new controller {}'.format(l_ix))
     web_utils.get_base_info(l_obj, l_json)
     l_obj.Comment = l_json['Comment']
     l_obj.DeviceFamily = l_json['DeviceFamily']
     l_obj.DeviceType = 1
     l_obj.DeviceSubType = 2
     l_obj.InterfaceType = l_json['InterfaceType']
     l_obj.Port = l_json['Port']
     if l_obj.InterfaceType == 'Serial':
         l_obj.BaudRate = l_json['BaudRate']
     web_family.get_family_json_data(l_obj, l_json)
     web_utils.get_room_info(l_obj, l_json)
     self.m_pyhouse_obj.House.Lighting.Controllers[l_ix] = l_obj
     LOG.info('Controller Added - {}'.format(l_obj.Name))
Exemple #2
0
 def saveControllerData(self, p_json):
     """A new/changed controller is returned.  Process it and update the internal data via controller.py
     """
     l_json = json_tools.decode_json_unicode(p_json)
     l_controller_ix = int(l_json['Key'])
     l_delete = l_json['Delete']
     if l_delete:
         try:
             del self.m_pyhouse_obj.House.Lighting.Controllers[l_controller_ix]
         except AttributeError:
             print("web_controllers - Failed to delete - JSON: {0:}".FORMAT(l_json))
         return
     try:
         l_obj = self.m_pyhouse_obj.House.Lighting.Controllers[l_controller_ix]
     except KeyError:
         l_obj = ControllerData()
     l_obj.Name = l_json['Name']
     l_obj.Active = l_json['Active']
     l_obj.Key = l_controller_ix
     l_obj.Comment = l_json['Comment']
     l_obj.RoomCoords = l_json['RoomCoords']
     l_obj.IsDimmable = l_json['IsDimmable']
     l_obj.DeviceFamily = l_json['DeviceFamily']
     l_obj.RoomName = l_json['RoomName']
     l_obj.LightingType = l_json['LightingType']
     l_obj.UUID = l_json['UUID']
     l_obj.InterfaceType = l_json['InterfaceType']
     l_obj.Port = l_json['Port']
     if l_obj.DeviceFamily == 'Insteon':
         Insteon_utils.Util().get_json_data(l_obj, l_json)
     elif l_obj.DeviceFamily == 'UPB':
         l_obj.UPBAddress = l_json['UPBAddress']
         l_obj.UPBPassword = l_json['UPBPassword']
         l_obj.UPBNetworkID = l_json['UPBNetworkID']
     if l_obj.InterfaceType == 'Serial':
         l_obj.BaudRate = l_json['BaudRate']
     self.m_pyhouse_obj.House.Lighting.Controllers[l_controller_ix] = l_obj
     LOG.info('Controller Added - {}'.format(l_obj))
Exemple #3
0
 def saveControllerData(self, p_json):
     """A new/changed controller is returned.  Process it and update the internal data via controller.py
     """
     l_json = json_tools.decode_json_unicode(p_json)
     l_controller_ix = int(l_json['Key'])
     l_delete = l_json['Delete']
     if l_delete:
         try:
             del self.m_pyhouse_obj.House.Lighting.Controllers[l_controller_ix]
         except AttributeError:
             LOG.error("web_controllers - Failed to delete - JSON: {}".FORMAT(l_json))
         return
     try:
         l_obj = self.m_pyhouse_obj.House.Lighting.Controllers[l_controller_ix]
     except KeyError:
         l_obj = ControllerData()
     l_obj.Name = l_json['Name']
     l_obj.Active = l_json['Active']
     l_obj.Key = l_controller_ix
     l_obj.Comment = l_json['Comment']
     l_obj.RoomCoords = l_json['RoomCoords']
     l_obj.IsDimmable = l_json['IsDimmable']
     l_obj.DeviceFamily = l_json['DeviceFamily']
     l_obj.RoomName = l_json['RoomName']
     l_obj.LightingType = l_json['LightingType']
     l_obj.UUID = l_json['UUID']
     l_obj.InterfaceType = l_json['InterfaceType']
     l_obj.Port = l_json['Port']
     if l_obj.DeviceFamily == 'Insteon':
         Insteon_utils.Util().get_json_data(l_obj, l_json)
     elif l_obj.DeviceFamily == 'UPB':
         l_obj.UPBAddress = l_json['UPBAddress']
         l_obj.UPBPassword = l_json['UPBPassword']
         l_obj.UPBNetworkID = l_json['UPBNetworkID']
     if l_obj.InterfaceType == 'Serial':
         l_obj.BaudRate = l_json['BaudRate']
     self.m_pyhouse_obj.House.Lighting.Controllers[l_controller_ix] = l_obj
     LOG.info('Controller Added - {}'.format(l_obj))
Exemple #4
0
 def _fake_params(self):
     l_obj = ControllerData()
     l_obj.BaudRate = 19200
     return l_obj
Exemple #5
0
 def _fake_params(self):
     l_obj = ControllerData()
     l_obj.BaudRate = 19200
     return l_obj