コード例 #1
0
 def __init__(self):
     """
     Create the tsChacon class
     This class is used to connect chacon devices (through TellSitck) to the xPL Network
     """
     XplPlugin.__init__(self, name='tschacon')
     self.log.debug("tschacon correctly started")
     self._device = "/dev/tellstick"
     #Check if the device exists
     if not os.path.exists(self._device):
         self.log.error(self._device + " is not present")
     else:
         self.log.debug("device present as " + self._device)
     self._config = Query(self.myxpl, self.log)
     try:
         self.__mytellstick = TellStick()
     except Exception:
         self.log.error(
             "Something went wrong during TellStick init, check logs")
         self.log.error("Exception : %s" % traceback.format_exc())
         exit(1)
     #Create listeners
     Listener(self.tsChacon_cmnd_cb, self.myxpl, {
         'schema': 'ts.arctech',
         'xpltype': 'xpl-cmnd'
     })
     self.enable_hbeat()
     self.log.debug("tschacon plugin correctly started")