Example #1
0
    def __init__(self, config):
        #Thread.__init__(self)

        self._host = str(config.get('HOST', 'localhost'))
        self._port = int(config.get('PORT', 1883))
        self._user = str(config.get('USER', None))
        self._passwd = str(config.get('PASSWD', None))
        self._subscribe = str(config.get('SUBSCRIBE', '/MYTOPIC'))
        self._publish = str(config.get('PUBLISH', '/OPENHAB'))
        #print('mqtt client',config)

        self._log = loghandler()

        msg = 'Start ' + __app__ + ' ' + __VERSION__ + ' ' + __DATE__
        self._log.info(msg)

        msg = 'Configuration' + str(config)
        self._log.debug(msg)

        self._mqttc = mqtt.Client(str(os.getpid()), clean_session=True)

        self._mqttc.on_message = self.on_message
        self._mqttc.on_connect = self.on_connect
        self._mqttc.on_disconnect = self.on_disconnect
        self._mqttc.on_publish = self.on_publish
        self._mqttc.on_subscribe = self.on_subscribe

        self._is_connected = False
        self._is_publish = {}
        self._is_publish['COUNTER'] = 0
        self._is_publish['STATE'] = True

        self.connect()
        self.subscribe(self._subscribe)
Example #2
0
 def startLogger(self):
     self._log = loghandler()
     # print(self._cfg_log)
     self._log.handle(self._cfg_log.get('LOGMODE'), self._cfg_log)
     #       self._log.handle()
     self._log.level(self._cfg_log.get('LOGLEVEL', 'DEBUG'))
     return True
Example #3
0
 def startLogger(self):
  #   print('STart Logger')
    # self._log = logging.getLogger(__name__)
     #fh = logging.FileHandler('/home/tgdscm41/fritzbox/Fritzmonitor.log')
     #fh.setLevel(logging.DEBUG)
     #self._log.addHandler(fh)
   #  print(self._cfg_log)
     _mode = self._cfg_log.get('LOGMODE','PRINT')
     self._log = loghandler()
     self._log.handle(method=_mode,config=self._cfg_log)
     return True
Example #4
0
    def __init__(self, config):

        self._log = loghandler()

        #        print('config', config)

        self._interface = str(config.get('INTERFACE', '/dev/ttyUSB0'))
        self._baudrate = int(config.get('BAUDRATE', 9800))
        self._deviceID = int(config.get('DEVICEID', 0))

        self._if = None
Example #5
0
 def startLogger(self):
     print(self._logcfg)
     self._log = loghandler('SERIAL2MQTT')
     self._log.handle(self._logcfg.get('LOGMODE'), self._logcfg)
     return True
Example #6
0
 def startLogger(self):
     self._log = loghandler('MYSTROM2MQTT')
     #  print('START Looger', self._cfg_log)
     self._log.handle(self._cfg_log.get('LOGMODE'), self._cfg_log)
     self._log.level(self._cfg_log.get('LOGLEVEL', 'DEBUG'))
     return True
Example #7
0
 def logger(self):
     print(self._logcfg)
     self._log = loghandler('ULTRASONIC')
     self._log.handle(self._logcfg.get('LOGMODE'), self._logcfg)
     return True
    def startLogger(self):
        _mode = self._cfg_log.get('LOGMODE', 'PRINT')
        self._log = loghandler()
        self._log.handle(method=_mode, config=self._cfg_log)

        return True
Example #9
0
 def startLogger(self):
     self._log = loghandler('ONEWIRE')
     self._log.handle(self._cfg_log.get('LOGMODE'),self._cfg_log)
     return True
Example #10
0
 def logger(self):
     self._log = loghandler('ONEWIRE')
     self._log.handle(self._logcfg.get('LOGMODE'), self._logcfg)
     return True