Exemplo n.º 1
0
 def test_04_GetInsteon(self):
     """ Did we get a family?
     """
     l_family = FamUtil.get_family(self.m_device_obj)
     self.assertEqual(l_family, TESTING_DEVICE_FAMILY_INSTEON)
     self.m_device_obj.DeviceFamily = "UPB"
     l_family = FamUtil.get_family(self.m_device_obj)
     self.assertEqual(l_family, "UPB")
Exemplo n.º 2
0
 def test_04_GetInsteon(self):
     """ Did we get a family?
     """
     l_family = FamUtil.get_family(self.m_device_obj)
     print(PrettyFormatAny.form(l_family, 'Family'))
     self.assertEqual(l_family, TESTING_DEVICE_FAMILY_INSTEON)
     self.m_device_obj.DeviceFamily = 'UPB'
     l_family = FamUtil.get_family(self.m_device_obj)
     self.assertEqual(l_family, 'UPB')
Exemplo n.º 3
0
 def test_03_All(self):
     """ Did we get everything set up for the rest of the tests of this class.
     """
     l_in_xml = self.m_xml.light
     l_device = self.m_device_obj
     l_light = LightingCoreAPI.read_core_lighting_xml(l_device, l_in_xml, self.m_version)
     FamUtil.read_family_data(self.m_pyhouse_obj, l_light, l_in_xml)
     l_out_xml = LightingCoreAPI.write_core_lighting_xml("Light", l_light)
     FamUtil.write_family_data(self.m_pyhouse_obj, l_out_xml, l_light)
     self.assertEqual(l_light.Name, TESTING_LIGHTING_LIGHTS_NAME_1)
     self.assertEqual(l_light.DeviceFamily, TESTING_DEVICE_FAMILY_INSTEON)
     self.assertEqual(l_light.InsteonAddress, conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
Exemplo n.º 4
0
 def test_01_All(self):
     """ Did we get everything set up for the rest of the tests of this class.
     """
     l_in_xml = self.m_xml.light
     l_device = self.m_device_obj
     l_light = deviceXML.read_base_device_object_xml(self.m_pyhouse_obj, l_device, l_in_xml)
     FamUtil.read_family_data(self.m_pyhouse_obj, l_light, l_in_xml)
     l_out_xml = deviceXML.write_base_device_object_xml('Light', l_light)
     FamUtil.write_family_data(self.m_pyhouse_obj, l_out_xml, l_light)
     self.assertEqual(l_light.Name, TESTING_LIGHT_NAME_0)
     self.assertEqual(l_light.DeviceFamily, TESTING_DEVICE_FAMILY_INSTEON)
     self.assertEqual(l_light.InsteonAddress, conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
Exemplo n.º 5
0
 def test_06_All(self):
     """ Did we get everything set up for the rest of the tests of this class.
     """
     l_xml = self.m_xml.light
     l_device = self.m_device_obj
     #
     l_light = LightingCoreAPI.read_core_lighting_xml(l_device, l_xml, self.m_version)
     FamUtil.read_family_data(self.m_pyhouse_obj, l_light, l_xml)
     self.assertEqual(l_light.Name, TESTING_LIGHTING_LIGHTS_NAME_1)
     self.assertEqual(l_light.DeviceFamily, TESTING_DEVICE_FAMILY_INSTEON)
     self.assertEqual(l_light.InsteonAddress, conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
     self.assertEqual(l_light.DevCat, conversions.dotted_hex2int(TESTING_INSTEON_DEVCAT_0))
     self.assertEqual(conversions.int2dotted_hex(l_light.ProductKey, 3), TESTING_INSTEON_PRODUCT_KEY_0)
Exemplo n.º 6
0
 def test_02_All(self):
     """ Did we get everything set up for the rest of the tests of this class.
     """
     l_in_xml = self.m_xml.light
     l_device = self.m_device_obj
     l_light = LightingCoreAPI.read_core_lighting_xml(
         self.m_pyhouse_obj, l_device, l_in_xml)
     FamUtil.read_family_data(self.m_pyhouse_obj, l_light, l_in_xml)
     l_out_xml = LightingCoreAPI.write_core_lighting_xml('Light', l_light)
     FamUtil.write_family_data(self.m_pyhouse_obj, l_out_xml, l_light)
     self.assertEqual(l_light.Name, TESTING_LIGHT_NAME_0)
     self.assertEqual(l_light.DeviceFamily, TESTING_DEVICE_FAMILY_INSTEON)
     self.assertEqual(l_light.InsteonAddress,
                      conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
Exemplo n.º 7
0
 def test_05_All(self):
     """ Did we get everything set up for the rest of the tests of this class.
     """
     l_xml = self.m_xml.light
     l_device = self.m_device_obj
     #
     l_light = deviceXML.read_base_device_object_xml(self.m_pyhouse_obj, l_device, l_xml)
     FamUtil.read_family_data(self.m_pyhouse_obj, l_light, l_xml)
     # print(PrettyFormatAny.form(l_light, 'C4-05-A - Light'))
     self.assertEqual(l_light.Name, TESTING_LIGHT_NAME_0)
     self.assertEqual(l_light.DeviceFamily, TESTING_DEVICE_FAMILY_INSTEON)
     self.assertEqual(l_light.InsteonAddress, conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
     self.assertEqual(l_light.DevCat, conversions.dotted_hex2int(TESTING_INSTEON_DEVCAT_0))
     self.assertEqual(conversions.int2dotted_hex(l_light.ProductKey, 3), TESTING_INSTEON_PRODUCT_KEY_0)
Exemplo n.º 8
0
 def test_02_GetFamily(self):
     """ Did we get a family name string
     """
     self.m_device_obj.DeviceFamily = TESTING_FAMILY_NAME_2
     l_family = FamUtil.get_family(self.m_device_obj)
     # print(PrettyFormatAny.form(l_family, 'B3-02-A - Family'))
     self.assertEqual(l_family, TESTING_FAMILY_NAME_2)
Exemplo n.º 9
0
 def test_02_GetFamily(self):
     """ Did we get a family name string
     """
     self.m_device_obj.DeviceFamily = TESTING_FAMILY_NAME_2
     l_family = FamUtil.get_family(self.m_device_obj)
     # print(PrettyFormatAny.form(l_family, 'B3-02-A - Family'))
     self.assertEqual(l_family, TESTING_FAMILY_NAME_2)
Exemplo n.º 10
0
 def _read_family_data(p_pyhouse_obj, p_obj, p_xml):
     """Read the family specific data for this controller.
     """
     # l_debug = debug_tools._format_object('Obj', p_obj, 100)
     # print('Read controller {}'.format(l_debug))
     l_api = FamUtil.read_family_data(p_pyhouse_obj, p_obj, p_xml)
     return l_api  # for testing
Exemplo n.º 11
0
 def ChangeLight(p_pyhouse_obj,
                 p_light_obj,
                 p_source,
                 p_new_level,
                 _p_rate=None):
     """ Set a light to a value - On, Off, or Dimmed.
     Called by:
         web_controlLights
         schedule
         @param p_pyhouse_obj: The entire data set.
         @param p_light_obj: is the partial obj of the particular light we are changing
         @param p_source: is a string denoting the source of the change.
         @param p_new_level: is the percent of light we are changing to
         @param p_rate: is the rate the change will ramp to.
     """
     l_light_obj = Utility.get_light_object(
         p_pyhouse_obj, name=p_light_obj.Name
     )  #  web has some info missing - get all the object
     try:
         LOG.info(
             'Turn Light: "{}" to level: "{}", DeviceFamily: "{}"'.format(
                 l_light_obj.Name, p_new_level, l_light_obj.DeviceFamily))
         l_family_api = FamUtil._get_family_device_api(
             p_pyhouse_obj, l_light_obj)
         l_family_api.ChangeLight(l_light_obj, p_source, p_new_level)
     except Exception as e_err:
         LOG.error('ERROR - {}'.format(e_err))
Exemplo n.º 12
0
 def _read_family_data(p_pyhouse_obj, p_obj, p_xml, _p_version):
     """Read the family specific data for this controller.
     """
     # l_debug = debug_tools._format_object('Obj', p_obj, 100)
     # print('Read controller {}'.format(l_debug))
     l_api = FamUtil.read_family_data(p_pyhouse_obj, p_obj, p_xml)
     return l_api  # for testing
Exemplo n.º 13
0
 def setUp(self):
     SetupMixin.setUp(self, ET.fromstring(XML_LONG))
     self.m_device_obj.DeviceFamily = TESTING_DEVICE_FAMILY_INSTEON
     self.m_api = FamUtil._get_family_device_api(self.m_pyhouse_obj,
                                                 self.m_device_obj)
     self.m_light = LightingCoreAPI.read_core_lighting_xml(
         self.m_pyhouse_obj, self.m_device_obj, self.m_xml.controller)
Exemplo n.º 14
0
 def test_05_All(self):
     """ Did we get everything set up for the rest of the tests of this class.
     """
     l_xml = self.m_xml.light
     l_device = self.m_device_obj
     #
     l_light = deviceXML.read_base_device_object_xml(l_device, l_xml)
     FamUtil.read_family_data(self.m_pyhouse_obj, l_light, l_xml)
     # print(PrettyFormatAny.form(l_light, 'C4-05-A - Light'))
     self.assertEqual(l_light.Name, TESTING_LIGHT_NAME_0)
     self.assertEqual(l_light.DeviceFamily, TESTING_DEVICE_FAMILY_INSTEON)
     self.assertEqual(l_light.InsteonAddress,
                      convert.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
     self.assertEqual(l_light.DevCat,
                      convert.dotted_hex2int(TESTING_INSTEON_DEVCAT_0))
     self.assertEqual(convert.int2dotted_hex(l_light.ProductKey, 3),
                      TESTING_INSTEON_PRODUCT_KEY_0)
Exemplo n.º 15
0
 def test_03_Family(self):
     """ Did we get everything set up for the rest of the tests of this class.
     """
     l_xml = self.m_xml.light
     l_device = self.m_device_obj
     l_light = FamUtil.read_family_data(self.m_pyhouse_obj, l_device, l_xml)
     # print(PrettyFormatAny.form(l_light, 'C4-03-A - Light'))
     self.assertEqual(str(l_light.UPBAddress), TESTING_UPB_ADDRESS)
Exemplo n.º 16
0
 def test_03_Family(self):
     """ Did we get everything set up for the rest of the tests of this class.
     """
     l_xml = self.m_xml.light
     l_device = self.m_device_obj
     l_light = FamUtil.read_family_data(self.m_pyhouse_obj, l_device, l_xml)
     # print(PrettyFormatAny.form(l_light, 'C4-03-A - Light'))
     self.assertEqual(str(l_light.UPBAddress), TESTING_UPB_ADDRESS)
Exemplo n.º 17
0
 def test_03_Family(self):
     """ Did we get everything set up for the rest of the tests of this class.
     """
     l_xml = self.m_xml.light
     l_device = self.m_device_obj
     l_light = FamUtil.read_family_data(self.m_pyhouse_obj, l_device, l_xml)
     # print(PrettyFormatAny.form(l_light, 'Light'))
     self.assertEqual(l_light.InsteonAddress, conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
Exemplo n.º 18
0
 def test_04_GetDeviceName3(self):
     """ Do we get back what we put in?
     """
     self.m_device_obj.Name = TESTING_FAMILY_NAME_3
     # print(PrettyFormatAny.form(self.m_device_obj, 'B1-04-A - Device'))
     l_name = FamUtil._get_device_name(self.m_device_obj)
     # print(PrettyFormatAny.form(l_name, 'B1-04-B - Family'))
     self.assertEqual(l_name, TESTING_FAMILY_NAME_3)
Exemplo n.º 19
0
 def test_03_Family(self):
     """ Did we get everything set up for the rest of the tests of this class.
     """
     l_xml = self.m_xml.light
     l_device = self.m_device_obj
     l_light = FamUtil.read_family_data(self.m_pyhouse_obj, l_device, l_xml)
     print(PrettyFormatAny.form(l_light, 'Light'))
     self.assertEqual(l_light.InsteonAddress,
                      conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
Exemplo n.º 20
0
 def test_02_GetFamilyObj(self):
     l_obj = FamUtil._get_family_obj(self.m_pyhouse_obj, self.m_device_obj)
     print(PrettyFormatAny.form(l_obj, 'Family'))
     self.assertEqual(l_obj.Name, TESTING_LIGHT_NAME_0)
     self.assertEqual(l_obj.Active, True)
     self.assertEqual(l_obj.Key, 1)
     self.assertEqual(l_obj.FamilyDeviceModuleName, 'Insteon_device')
     self.assertEqual(l_obj.FamilyPackageName, 'Modules.Families.Insteon')
     self.assertEqual(l_obj.FamilyXmlModuleName, 'Insteon_xml')
Exemplo n.º 21
0
 def test_03_GetFamilyObj(self):
     l_obj = FamUtil._get_family_obj(self.m_pyhouse_obj, self.m_device_obj)
     # print(PrettyFormatAny.form(l_obj, 'Family'))
     self.assertEqual(l_obj.Name, "Insteon")
     self.assertEqual(l_obj.Active, True)
     self.assertEqual(l_obj.Key, 1)
     self.assertEqual(l_obj.FamilyDeviceModuleName, "Insteon_device")
     self.assertEqual(l_obj.FamilyPackageName, "Modules.Families.Insteon")
     self.assertEqual(l_obj.FamilyXmlModuleName, "Insteon_xml")
Exemplo n.º 22
0
 def start_controller_driver(self, p_pyhouse_obj, p_controller_obj):
     self.m_pyhouse_obj = p_pyhouse_obj
     l_msg = "Controller:{}, ".format(p_controller_obj.Name)
     l_msg += "DeviceFamily:{}, ".format(p_controller_obj.DeviceFamily)
     l_msg += "InterfaceType:{}".format(p_controller_obj.InterfaceType)
     LOG.info('Start Controller - {}'.format(l_msg))
     l_driver = FamUtil.get_device_driver_API(p_pyhouse_obj, p_controller_obj)
     p_controller_obj._DriverAPI = l_driver
     l_ret = l_driver.Start(p_pyhouse_obj, p_controller_obj)
     return l_ret
Exemplo n.º 23
0
 def test_01_Family(self):
     """ Did we get everything set up for the rest of the tests of this class.
     """
     l_xml = self.m_xml.light_sect[0]
     print(PrettyFormatAny.form(l_xml, 'C3-01-A - XML'))
     l_device = self.m_device_obj
     l_light = FamUtil.read_family_data(self.m_pyhouse_obj, l_device, l_xml)
     print(PrettyFormatAny.form(l_light, 'C3-01-B - Light'))
     self.assertEqual(l_device.Name, TESTING_LIGHT_NAME_0)
     self.assertEqual(l_light.InsteonAddress, conversions.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
Exemplo n.º 24
0
 def test_01_Family(self):
     """ Did we get everything set up for the rest of the tests of this class.
     """
     l_xml = self.m_xml.light_sect[0]
     print(PrettyFormatAny.form(l_xml, 'C3-01-A - XML'))
     l_device = self.m_device_obj
     l_light = FamUtil.read_family_data(self.m_pyhouse_obj, l_device, l_xml)
     print(PrettyFormatAny.form(l_light, 'C3-01-B - Light'))
     self.assertEqual(l_device.Name, TESTING_LIGHT_NAME_0)
     self.assertEqual(l_light.InsteonAddress,
                      convert.dotted_hex2int(TESTING_INSTEON_ADDRESS_0))
Exemplo n.º 25
0
 def start_controller_driver(self, p_pyhouse_obj, p_controller_obj):
     self.m_pyhouse_obj = p_pyhouse_obj
     l_msg = "Controller:{}, ".format(p_controller_obj.Name)
     l_msg += "DeviceFamily:{}, ".format(p_controller_obj.DeviceFamily)
     l_msg += "InterfaceType:{}".format(p_controller_obj.InterfaceType)
     LOG.info('Start Controller - {}'.format(l_msg))
     l_driver = FamUtil.get_device_driver_API(p_pyhouse_obj,
                                              p_controller_obj)
     p_controller_obj._DriverAPI = l_driver
     l_ret = l_driver.Start(p_pyhouse_obj, p_controller_obj)
     return l_ret
Exemplo n.º 26
0
 def test_05_GetFamilyObj4(self):
     """ Do we get the correct family object (X10)
     """
     self.m_device_obj.DeviceFamily = TESTING_FAMILY_NAME_4
     l_obj = FamUtil._get_family_obj(self.m_pyhouse_obj, self.m_device_obj)
     # print(PrettyFormatAny.form(l_obj, 'B2-05-A - Family'))
     self.assertEqual(l_obj.Name, TESTING_FAMILY_NAME_4)
     self.assertEqual(l_obj.Active, True)
     self.assertEqual(l_obj.Key, 4)
     self.assertEqual(l_obj.FamilyDeviceModuleName, 'Hue_device')
     self.assertEqual(l_obj.FamilyPackageName, 'Modules.Families.Hue')
     self.assertEqual(l_obj.FamilyXmlModuleName, 'Hue_xml')
Exemplo n.º 27
0
 def test_01_GetFamilyObj0(self):
     """ Do we get the correct family object (Null)
     """
     self.m_device_obj.DeviceFamily = TESTING_FAMILY_NAME_0
     l_obj = FamUtil._get_family_obj(self.m_pyhouse_obj, self.m_device_obj)
     # print(PrettyFormatAny.form(l_obj, 'B2-01-A - Family object'))
     self.assertEqual(l_obj.Name, TESTING_FAMILY_NAME_0)
     self.assertEqual(l_obj.Active, True)
     self.assertEqual(l_obj.Key, 0)
     self.assertEqual(l_obj.FamilyDevice_ModuleName, 'Null_device')
     self.assertEqual(l_obj.FamilyPackageName, 'Modules.Families.Null')
     self.assertEqual(l_obj.FamilyXml_ModuleName, 'Null_xml')
Exemplo n.º 28
0
 def test_05_GetFamilyObj4(self):
     """ Do we get the correct family object (X10)
     """
     self.m_device_obj.DeviceFamily = TESTING_FAMILY_NAME_4
     l_obj = FamUtil._get_family_obj(self.m_pyhouse_obj, self.m_device_obj)
     # print(PrettyFormatAny.form(l_obj, 'B2-05-A - Family'))
     self.assertEqual(l_obj.Name, TESTING_FAMILY_NAME_4)
     self.assertEqual(l_obj.Active, True)
     self.assertEqual(l_obj.Key, 4)
     self.assertEqual(l_obj.FamilyDevice_ModuleName, 'Hue_device')
     self.assertEqual(l_obj.FamilyPackageName, 'Modules.Families.Hue')
     self.assertEqual(l_obj.FamilyXml_ModuleName, 'Hue_xml')
Exemplo n.º 29
0
 def test_02_GetFamilyObj1(self):
     """ Do we get the correct family object (Insteon)
     """
     self.m_device_obj.DeviceFamily = TESTING_FAMILY_NAME_1
     l_obj = FamUtil._get_family_obj(self.m_pyhouse_obj, self.m_device_obj)
     # print(PrettyFormatAny.form(l_obj, 'B2-02-A - Family'))
     self.assertEqual(l_obj.Name, TESTING_FAMILY_NAME_1)
     self.assertEqual(l_obj.Active, True)
     self.assertEqual(l_obj.Key, 1)
     self.assertEqual(l_obj.FamilyDevice_ModuleName, 'Insteon_device')
     self.assertEqual(l_obj.FamilyPackageName, 'Modules.Families.Insteon')
     self.assertEqual(l_obj.FamilyXml_ModuleName, 'Insteon_xml')
Exemplo n.º 30
0
 def test_02_GetFamilyObj1(self):
     """ Do we get the correct family object (Insteon)
     """
     self.m_device_obj.DeviceFamily = TESTING_FAMILY_NAME_1
     l_obj = FamUtil._get_family_obj(self.m_pyhouse_obj, self.m_device_obj)
     # print(PrettyFormatAny.form(l_obj, 'B2-02-A - Family'))
     self.assertEqual(l_obj.Name, TESTING_FAMILY_NAME_1)
     self.assertEqual(l_obj.Active, True)
     self.assertEqual(l_obj.Key, 1)
     self.assertEqual(l_obj.FamilyDeviceModuleName, 'Insteon_device')
     self.assertEqual(l_obj.FamilyPackageName, 'Modules.Families.Insteon')
     self.assertEqual(l_obj.FamilyXmlModuleName, 'Insteon_xml')
Exemplo n.º 31
0
 def test_01_GetFamilyObj0(self):
     """ Do we get the correct family object (Null)
     """
     self.m_device_obj.DeviceFamily = TESTING_FAMILY_NAME_0
     l_obj = FamUtil._get_family_obj(self.m_pyhouse_obj, self.m_device_obj)
     # print(PrettyFormatAny.form(l_obj, 'B2-01-A - Family object'))
     self.assertEqual(l_obj.Name, TESTING_FAMILY_NAME_0)
     self.assertEqual(l_obj.Active, True)
     self.assertEqual(l_obj.Key, 0)
     self.assertEqual(l_obj.FamilyDeviceModuleName, 'Null_device')
     self.assertEqual(l_obj.FamilyPackageName, 'Modules.Families.Null')
     self.assertEqual(l_obj.FamilyXmlModuleName, 'Null_xml')
Exemplo n.º 32
0
 def test_02_Device1(self):
     """ Did we get the Device correctly (UPB)
     """
     self.m_device_obj.DeviceFamily = TESTING_FAMILY_NAME_2
     self.m_api = FamUtil._get_family_device_api(self.m_pyhouse_obj, self.m_device_obj)
     print(PrettyFormatAny.form(self.m_device_obj, 'C2-02-A - Device'))
     self.assertEqual(self.m_device_obj.Name, TESTING_LIGHT_NAME_1)
     self.assertEqual(self.m_device_obj.Key, TESTING_LIGHT_KEY_1)
     self.assertEqual(self.m_device_obj.Active, TESTING_LIGHT_ACTIVE_1)
     self.assertEqual(self.m_device_obj.DeviceFamily, TESTING_DEVICE_FAMILY_UPB)
     self.assertEqual(str(self.m_device_obj.DeviceType), TESTING_LIGHT_DEVICE_TYPE_0)
     self.assertEqual(str(self.m_device_obj.DeviceSubType), TESTING_LIGHT_DEVICE_SUBTYPE_0)
     self.assertEqual(self.m_device_obj.RoomName, TESTING_LIGHT_ROOM_NAME_0)
Exemplo n.º 33
0
 def start_controller(self, p_pyhouse_obj, p_controller_obj):
     """We must now find a driver for the type of PIM we have and initialize that driver
     """
     p_controller_obj._Queue = Queue.Queue(300)
     LOG.info("start:{} - InterfaceType:{}".format(p_controller_obj.Name, p_controller_obj.InterfaceType))
     self.m_pim = UpbPimAPI._initilaize_pim(p_controller_obj)
     l_driver = FamUtil.get_device_driver_API(p_pyhouse_obj, p_controller_obj)
     p_controller_obj._DriverAPI = l_driver
     self.m_pim._DriverAPI = l_driver
     try:
         l_driver.Start(p_pyhouse_obj, p_controller_obj)
         self.set_register_value(p_controller_obj, 0x70, [0x03])
     except Exception as e_err:
         LOG.error('Driver failed to load properly - {}'.format(e_err))
         return False
     return True
Exemplo n.º 34
0
 def test_02_Device1(self):
     """ Did we get the Device correctly (UPB)
     """
     self.m_device_obj.DeviceFamily = TESTING_FAMILY_NAME_2
     self.m_api = FamUtil._get_family_device_api(self.m_pyhouse_obj,
                                                 self.m_device_obj)
     print(PrettyFormatAny.form(self.m_device_obj, 'C2-02-A - Device'))
     self.assertEqual(self.m_device_obj.Name, TESTING_LIGHT_NAME_1)
     self.assertEqual(self.m_device_obj.Key, TESTING_LIGHT_KEY_1)
     self.assertEqual(self.m_device_obj.Active, TESTING_LIGHT_ACTIVE_1)
     self.assertEqual(self.m_device_obj.DeviceFamily,
                      TESTING_DEVICE_FAMILY_UPB)
     self.assertEqual(str(self.m_device_obj.DeviceType),
                      TESTING_LIGHT_DEVICE_TYPE_0)
     self.assertEqual(str(self.m_device_obj.DeviceSubType),
                      TESTING_LIGHT_DEVICE_SUBTYPE_0)
     self.assertEqual(self.m_device_obj.RoomName, TESTING_LIGHT_ROOM_NAME_0)
Exemplo n.º 35
0
 def ChangeLight(p_pyhouse_obj, p_light_obj, p_source, p_new_level, _p_rate = None):
     """ Set a light to a value - On, Off, or Dimmed.
     Called by:
         web_controlLights
         schedule
         @param p_pyhouse_obj: The entire data set.
         @param p_light_obj: is the partial obj of the particular light we are changing
         @param p_source: is a string denoting the source of the change.
         @param p_new_level: is the percent of light we are changing to
         @param p_rate: is the rate the change will ramp to.
     """
     l_light_obj = Utility.get_light_object(p_pyhouse_obj, name = p_light_obj.Name)  #  web has some info missing - get all the object
     try:
         LOG.info('Turn Light: "{}" to level: "{}", DeviceFamily: "{}"'.format(l_light_obj.Name, p_new_level, l_light_obj.DeviceFamily))
         l_family_api = FamUtil._get_family_device_api(p_pyhouse_obj, l_light_obj)
         l_family_api.ChangeLight(l_light_obj, p_source, p_new_level)
     except Exception as e_err:
         LOG.error('ERROR - {}'.format(e_err))
Exemplo n.º 36
0
 def start_controller(self, p_pyhouse_obj, p_controller_obj):
     """We must now find a driver for the type of PIM we have and initialize that driver
     """
     p_controller_obj._Queue = Queue.Queue(300)
     LOG.info("start:{} - InterfaceType:{}".format(
         p_controller_obj.Name, p_controller_obj.InterfaceType))
     self.m_pim = UpbPimAPI._initilaize_pim(p_controller_obj)
     l_driver = FamUtil.get_device_driver_API(p_pyhouse_obj,
                                              p_controller_obj)
     p_controller_obj._DriverAPI = l_driver
     self.m_pim._DriverAPI = l_driver
     try:
         l_driver.Start(p_pyhouse_obj, p_controller_obj)
         self.set_register_value(p_controller_obj, 0x70, [0x03])
     except Exception as e_err:
         LOG.error('Driver failed to load properly - {}'.format(e_err))
         return False
     return True
Exemplo n.º 37
0
    def ChangeLight(self, p_light_obj, p_source, p_new_level, _p_rate=None):
        """
        Set an Insteon controlled light to a value - On, Off, or Dimmed.

        Called by:
            web_controlLights
            schedule
        """
        l_light_obj = actionUtility._find_full_obj(self.m_pyhouse_obj,
                                                   p_light_obj)
        try:
            LOG.info("Turn Light {} to level {}, DeviceFamily:{}".format(
                l_light_obj.Name, p_new_level, l_light_obj.DeviceFamily))

            l_api = FamUtil._get_family_device_api(self.m_pyhouse_obj,
                                                   l_light_obj)
            l_api.ChangeLight(l_light_obj, p_source, p_new_level)
        except Exception as e_err:
            LOG.error('ERROR - {}'.format(e_err))
Exemplo n.º 38
0
    def ChangeLight(self, p_light_obj, p_source, p_new_level, _p_rate=None):
        """
        Set an Insteon controlled light to a value - On, Off, or Dimmed.

        Called by:
            web_controlLights
            schedule
        """
        l_light_obj = actionUtility._find_full_obj(self.m_pyhouse_obj, p_light_obj)
        try:
            LOG.info(
                "Turn Light {} to level {}, DeviceFamily:{}".format(
                    l_light_obj.Name, p_new_level, l_light_obj.DeviceFamily
                )
            )

            l_api = FamUtil._get_family_device_api(self.m_pyhouse_obj, l_light_obj)
            l_api.ChangeLight(l_light_obj, p_source, p_new_level)
        except Exception as e_err:
            LOG.error("ERROR - {}".format(e_err))
Exemplo n.º 39
0
    def ChangeLight(self, p_light_obj, p_source, p_new_level, p_rate=None):
        """
        Set an Insteon controlled light to a value - On, Off, or Dimmed.

        Called by:
            web_controlLights
            schedule

        @param p_light_obj:
        @param p_source: is a string denoting the source of the change.
        @param p_new_level: is the new light level (0 - 100%)
        @param p_rate: is the ramp up rate (not uese)
        """
        l_light_obj = actionUtility._find_full_obj(self.m_pyhouse_obj, p_light_obj)
        try:
            LOG.info("Turn Light {} to level {}, DeviceFamily:{}".format(l_light_obj.Name, p_new_level, l_light_obj.DeviceFamily))

            l_api = FamUtil._get_family_device_api(self.m_pyhouse_obj, l_light_obj)
            l_api.ChangeLight(l_light_obj, p_source, p_new_level)
        except Exception as e_err:
            LOG.error('ERROR - {}'.format(e_err))
Exemplo n.º 40
0
 def test_05_GetApi(self):
     l_api = FamUtil._get_family_device_api(self.m_pyhouse_obj,
                                            self.m_device_obj)
     print(PrettyFormatAny.form(l_api, 'API'))
     self.assertNotEqual(l_api, None)
Exemplo n.º 41
0
 def test_01_GetDeviceName(self):
     """ Do we get back what we put in?
     """
     l_name = FamUtil._get_device_name(self.m_device_obj)
     # print(PrettyFormatAny.form(l_name, 'Family'))
     self.assertEqual(l_name, TESTING_LIGHT_NAME_0)
Exemplo n.º 42
0
 def _read_family_data(p_pyhouse_obj, p_obj, p_xml):
     l_api = FamUtil.read_family_data(p_pyhouse_obj, p_obj, p_xml)
     return l_api  # for testing
Exemplo n.º 43
0
 def setUp(self):
     SetupMixin.setUp(self, ET.fromstring(XML_LONG))
     self.m_device_obj.DeviceFamily = TESTING_DEVICE_FAMILY_INSTEON
     self.m_api = FamUtil._get_family_device_api(self.m_pyhouse_obj, self.m_device_obj)
     self.m_light = deviceXML.read_base_device_object_xml(self.m_pyhouse_obj, self.m_device_obj, self.m_xml.controller)
Exemplo n.º 44
0
 def test_05_GetApi(self):
     self.m_device_obj.DeviceFamily = TESTING_FAMILY_NAME_4
     l_api = FamUtil._get_family_device_api(self.m_pyhouse_obj,
                                            self.m_device_obj)
     # print(PrettyFormatAny.form(l_api, 'B4-05-A - API'))
     self.assertNotEqual(l_api, None)
Exemplo n.º 45
0
 def setUp(self):
     SetupMixin.setUp(self, ET.fromstring(XML_LONG))
     self.m_device_obj = self.createLightData()
     self.m_device_obj.DeviceFamily = TESTING_DEVICE_FAMILY_UPB
     self.m_api = FamUtil._get_family_device_api(self.m_pyhouse_obj,
                                                 self.m_device_obj)
Exemplo n.º 46
0
 def setUp(self):
     SetupMixin.setUp(self, ET.fromstring(XML_LONG))
     self.m_device_obj.DeviceFamily = TESTING_DEVICE_FAMILY_UPB
     self.m_api = FamUtil._get_family_device_api(self.m_pyhouse_obj, self.m_device_obj)
Exemplo n.º 47
0
 def setUp(self):
     SetupMixin.setUp(self, ET.fromstring(XML_LONG))
     self.m_device_obj.DeviceFamily = TESTING_DEVICE_FAMILY_INSTEON
     self.m_api = FamUtil._get_family_device_api(self.m_pyhouse_obj, self.m_device_obj)
     self.m_light = LightingCoreAPI.read_core_lighting_xml(self.m_device_obj, self.m_xml.controller, self.m_version)
Exemplo n.º 48
0
 def test_01_GetDeviceName(self):
     l_device = FamUtil._get_device_name(self.m_device_obj)
     self.assertEqual(l_device, TESTING_LIGHTING_LIGHTS_NAME_1)
Exemplo n.º 49
0
 def test_05_GetApi(self):
     self.m_device_obj.DeviceFamily = TESTING_FAMILY_NAME_4
     l_api = FamUtil._get_family_device_api(self.m_pyhouse_obj, self.m_device_obj)
     # print(PrettyFormatAny.form(l_api, 'B4-05-A - API'))
     self.assertNotEqual(l_api, None)
Exemplo n.º 50
0
 def _read_family_data(p_pyhouse_obj, p_obj, p_xml):
     l_api = FamUtil.read_family_data(p_pyhouse_obj, p_obj, p_xml)
     return l_api  # for testing
Exemplo n.º 51
0
 def _read_family_data(p_pyhouse_obj, p_obj, p_xml):
     l_ret = FamUtil.read_family_data(p_pyhouse_obj, p_obj, p_xml)
     return l_ret
Exemplo n.º 52
0
 def _read_family_data(p_pyhouse_obj, p_obj, p_xml):
     l_ret = FamUtil.read_family_data(p_pyhouse_obj, p_obj, p_xml)
     return l_ret
Exemplo n.º 53
0
 def test_05_GetApi(self):
     l_api = FamUtil._get_family_device_api(self.m_pyhouse_obj, self.m_device_obj)
     self.assertNotEqual(l_api, None)
Exemplo n.º 54
0
 def setUp(self):
     SetupMixin.setUp(self, ET.fromstring(XML_LONG))
     self.m_device_obj.DeviceFamily = TESTING_DEVICE_FAMILY_INSTEON
     self.m_api = FamUtil._get_family_device_api(self.m_pyhouse_obj,
                                                 self.m_device_obj)