def test_01_Computer(self): l_topic = 'computer/xml' l_payload = {"DateTime": DATE_TIME, "Sender": SENDER} self.m_pyhouse_obj.APIs.ComputerAPI = computerAPI(self.m_pyhouse_obj) # print("\n\tTopic: {}\n\tPayload: {}".format(l_topic, l_payload)) l_log = mqtt_actions(self.m_pyhouse_obj).mqtt_dispatch(l_topic, l_payload) # print("\t--Log: {}\n".format(l_log)) # self.assertEqual(l_topic[:13], '<MqttSection>') self.assertEqual(l_log[:13], '<MqttSection>')
def __init__(self, p_pyhouse_obj): """ This will initialize much (all?) of the API infrastructure. Note that the Configuration file is NOT read until the following Start() method begins. Also note that the reactor is *NOT* running. """ self.m_pyhouse_obj = p_pyhouse_obj Utility._init_components(p_pyhouse_obj) Utility.init_uuids(p_pyhouse_obj) p_pyhouse_obj.APIs.Computer.ComputerAPI = computerAPI(p_pyhouse_obj) p_pyhouse_obj.APIs.House.HouseAPI = houseAPI(p_pyhouse_obj) PyHouseObj.SetObj(p_pyhouse_obj) LOG.info('Initialized\n==================================================================\n')
def __init__(self, p_pyhouse_obj): """ **NOR** This will initialize much (all?) of the API infrastructure. Note that the Configuration file is NOT read until the following Start() method begins. Also note that the reactor is *NOT* yet running. """ LOG.info('Initializing - Version:{}'.format(__version__)) Utility.init_uuids(p_pyhouse_obj) p_pyhouse_obj.APIs.Computer.ComputerAPI = computerAPI(p_pyhouse_obj) p_pyhouse_obj.APIs.House.HouseAPI = houseAPI(p_pyhouse_obj) PyHouseObj.SetObj(p_pyhouse_obj) Utility._sync_startup_logging(p_pyhouse_obj) self.m_pyhouse_obj = p_pyhouse_obj LOG.info('Initialized.\n==================================================================\n')
def __init__(self, p_pyhouse_obj): """ This will initialize much (all?) of the API infrastructure. Note that the Configuration file is NOT read until the following Start() method begins. Also note that the reactor is *NOT* running. """ self.m_pyhouse_obj = p_pyhouse_obj LOG.info('Initializing') Utility.init_uuids(p_pyhouse_obj) p_pyhouse_obj.APIs.Computer.ComputerAPI = computerAPI(p_pyhouse_obj) p_pyhouse_obj.APIs.House.HouseAPI = houseAPI(p_pyhouse_obj) PyHouseObj.SetObj(p_pyhouse_obj) Utility._sync_startup_logging(self.m_pyhouse_obj) LOG.info('Initialized\n==================================================================\n')
def __init__(self): """ **NOR** This will initialize much (all?) of the API infrastructure. Note that the Configuration file is NOT read until the following Start() method begins. Also note that the reactor is *NOT* yet running. """ LOG.info( "\n======================== Initializing ======================== Version: {}\n" .format(__version__)) setup_logging.API() # Start up logging LOG.info('Setting up Main Data areas') self.m_pyhouse_obj = PyHouseInformation() self.m_pyhouse_obj.Core = self._setup_Core() # First self.m_pyhouse_obj._APIs = self._setup_APIs() self.m_pyhouse_obj._Config = self._setup_Config() self.m_pyhouse_obj._Parameters = self._setup_Parameters() self.m_pyhouse_obj._Twisted = self._setup_Twisted() self.m_pyhouse_obj._Uuids = self._setup_Uuids() self.m_pyhouse_obj.Computer = self._setup_Computer() # self.m_pyhouse_obj.House = self._setup_House() # self.load_yaml_config(self.m_pyhouse_obj) self._sync_startup_logging(self.m_pyhouse_obj) self.m_pyhouse_obj._APIs.Core.MqttAPI = mqttAPI( self.m_pyhouse_obj, self) self.m_pyhouse_obj._APIs.Core.MqttAPI.LoadConfig() self.m_pyhouse_obj._APIs.Core.MqttAPI.Start() self.m_pyhouse_obj._APIs.Computer.ComputerAPI = computerAPI( self.m_pyhouse_obj) self.m_pyhouse_obj._APIs.House.HouseAPI = houseAPI(self.m_pyhouse_obj) LOG.info('All data has been set up.') # self.m_pyhouse_obj._Twisted.Reactor.callWhenRunning(self.LoadConfig) LOG.info( "\n======================== Initialized ======================== Version: {}\n" .format(__version__)) LOG.info('Starting Reactor...') self.m_pyhouse_obj._Twisted.Reactor.run( ) # reactor never returns so must be last - Event loop will now run # LOG.info("PyHouse says Bye Now.\n") print('PyHouse is exiting.') raise SystemExit("PyHouse says Bye Now.")
def setUp(self, p_root): self.m_pyhouse_obj = SetupPyHouseObj().BuildPyHouseObj(p_root) self.m_xml = SetupPyHouseObj().BuildXml(p_root) self.m_api = computerAPI(self.m_pyhouse_obj)