示例#1
0
    def test_startCOSM(self):

        cont = COSMControl()
        with patch('housemonitor.outputs.cosm.control.HMQueue',
                   spec=HMQueue) as que:
            with patch('housemonitor.outputs.cosm.control.COSMOutputThread',
                       spec=COSMOutputThread) as thread:
                with patch('housemonitor.outputs.cosm.control.COSMOutputStep',
                           spec=COSMOutputStep) as op:
                    options = None
                    que.return_value = 1
                    cont.startCOSM(options)
                    que.assert_called_with('COSM')
                    thread.assert_called_with(1, None, name='COSM')
                    self.assertTrue(op.called)
示例#2
0
    def startOutputs(self, global_data):

        self.logger.debug('Start output communications to COSM')
        self.cosm = COSMControl()
        self.cosm.startCOSM(self.options)

        self.logger.debug('Start the XML RPC server')
        self.xmlrpc = XMLRPCControl(
            global_data[Constants.GlobalData.CURRENT_VALUES],
            global_data[Constants.GlobalData.INPUT_QUEUE],
            global_data[Constants.GlobalData.OPTIONS])
        self.xmlrpc.startXMLRPC(self.options)

        # Start thread for outputing data
        self.logger.debug('Start output communications with ZigBee')
        self.zigbee = ZigBeeControl()
        self.zigbee.startZigBee(self.options.in_test_mode)