当前位置: 首页>>代码示例>>Python>>正文


Python XplPlugin.__init__方法代码示例

本文整理汇总了Python中domogik.xpl.common.plugin.XplPlugin.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python XplPlugin.__init__方法的具体用法?Python XplPlugin.__init__怎么用?Python XplPlugin.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在domogik.xpl.common.plugin.XplPlugin的用法示例。


在下文中一共展示了XplPlugin.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from domogik.xpl.common.plugin import XplPlugin [as 别名]
# 或者: from domogik.xpl.common.plugin.XplPlugin import __init__ [as 别名]
 def __init__(self):
     XplPlugin.__init__(self, name="scenario")
     self._backend = ScenarioManager(self.log)
     self.add_stop_cb(self.end)
     self.add_stop_cb(self.shutdown)
     self.log.info(u"Scenario Frontend and Manager initialized, let's wait for some work.")
     self.ready()
开发者ID:Basilic,项目名称:domogik,代码行数:9,代码来源:scenario.py

示例2: __init__

# 需要导入模块: from domogik.xpl.common.plugin import XplPlugin [as 别名]
# 或者: from domogik.xpl.common.plugin.XplPlugin import __init__ [as 别名]
    def __init__(self):
        """ Init plugin
        """
        XplPlugin.__init__(self, name='daikcode')

        # check if the plugin is configured. If not, this will stop the plugin and log an error
        if not self.check_configured():
            return

        # get the devices list
        self.devices = self.get_device_list(quit_if_no_device = False)
        # get the config values
        self.remoteManager = RemoteManager(self, self.send_xpl)
        for a_device in self.devices :
            try :
                if a_device['device_type_id'] != 'daikcode.remotearc' :
                #if device_name == None  or irtransmitter == None or options == None :
                    self.log.error(u"No daikcode.remotearc device type")
                    break
                else :
                    self.remoteManager.addRemote(a_device)
                    self.log.debug("Ready to work with device {0}".format(getRemoteId(a_device)))
            except:
                self.log.error(traceback.format_exc())
                # we don't quit plugin if an error occured
                #self.force_leave()
                #return
         # Create the xpl listeners
        Listener(self.handle_xpl_cmd, self.myxpl,{'schema': 'daikin.basic',
                                                                        'xpltype': 'xpl-cmnd'})
        Listener(self.handle_xpl_trig, self.myxpl,{'schema': 'ir.basic',
                                                                        'xpltype': 'xpl-trig'})
        print "Plugin ready :)"
        self.log.info("Plugin ready :)")
        self.ready()
开发者ID:Nico0084,项目名称:domogik-plugin-daikcode,代码行数:37,代码来源:daikcode.py

示例3: __init__

# 需要导入模块: from domogik.xpl.common.plugin import XplPlugin [as 别名]
# 或者: from domogik.xpl.common.plugin.XplPlugin import __init__ [as 别名]
 def __init__(self):
     """
     Create the X10Main class
     This class is used to connect x10 (through heyu) to the xPL Network
     """
     XplPlugin.__init__(self, name = 'x10_heyu')
     self._heyu_cfg_path_res = ""
     self._config = Query(self.myxpl, self.log)
     self._heyu_cfg_path_res = self._config.query('x10_heyu', 'heyu-cfg-path')
     try:
         self.__myx10 = X10API(self._heyu_cfg_path_res, self.log)
     except Exception:
         self.log.error("Something went wrong during heyu init, check logs")
         self.log.error("Exception : %s" % traceback.format_exc())
         exit(1)
     #Create listeners
     Listener(self.x10_cmnd_cb, self.myxpl, {'schema': 'x10.basic', 'xpltype': 'xpl-cmnd'})
     #One listener for system schema, allowing to reload config
     #Listener(self.heyu_reload_config, self.myxpl, {'schema': 'domogik.system', 'xpltype': 'xpl-cmnd',
     #                                                'command': 'reload', 'plugin': 'x10'})
     #One listener for system schema, allowing to dump config
     #Listener(self.heyu_dump_config, self.myxpl, {'schema': 'domogik.system', 'xpltype': 'xpl-cmnd',
     #                                              'command': 'push_config', 'plugin': 'x10'})
     self.log.debug("before start X10monitor")
     self._monitor = X10Monitor(self._heyu_cfg_path_res)
     self._monitor.get_monitor().add_cb(self.x10_monitor_cb)
     self._monitor.get_monitor().start()
     self.enable_hbeat()
     self.log.debug("Heyu correctly started")
开发者ID:capof,项目名称:domogik,代码行数:31,代码来源:x10_heyu.py

示例4: __init__

# 需要导入模块: from domogik.xpl.common.plugin import XplPlugin [as 别名]
# 或者: from domogik.xpl.common.plugin.XplPlugin import __init__ [as 别名]
    def __init__(self):
        '''
        Start teleinfo device handler
        '''
        XplPlugin.__init__(self, name='teleinfo')
        self._config = Query(self.myxpl, self.log)
        device = self._config.query('teleinfo', 'device')
        interval = self._config.query('teleinfo', 'interval')

        # Init Teleinfo
        teleinfo  = Teleinfo(self.log, self.send_xpl)
        
        # Open Teleinfo modem
        try:
            teleinfo.open(device)
        except TeleinfoException as err:
            self.log.error(err.value)
            print(err.value)
            self.force_leave()
            return
            
        self.add_stop_cb(teleinfo.close)
        # Start reading Teleinfo
        teleinfo_process = threading.Thread(None,
                                   teleinfo.listen,
                                   'teleinfo-listen',
                                   (float(interval),),
                                   {})                                  
        teleinfo_process.start()                              
        self.enable_hbeat()
开发者ID:capof,项目名称:domogik,代码行数:32,代码来源:teleinfo.py

示例5: __init__

# 需要导入模块: from domogik.xpl.common.plugin import XplPlugin [as 别名]
# 或者: from domogik.xpl.common.plugin.XplPlugin import __init__ [as 别名]
    def __init__(self):
        """ Init plugin
        """
        XplPlugin.__init__(self, name='irtrans')

        # check if the plugin is configured. If not, this will stop the plugin and log an error
        if not self.check_configured():
            return

        # get the devices list
        self.devices = self.get_device_list(quit_if_no_device = False)
        # get the config values
        self.managerClients = ManagerClients(self,  self.send_xplTrig)
        for a_device in self.devices :
            try :
                if (a_device['device_type_id'] != 'irtrans.irtrans_lan') and (a_device['device_type_id'] != 'irtrans.irwsserver') :
                    self.log.error(u"No a device type reconized : {0}".format(a_device['device_type_id']))
                    break
                else :
                    if self.managerClients.addClient(a_device) :
                        self.log.info("Ready to work with device {0}".format(getIRTransId(a_device)))
                    else : self.log.info("Device parameters not configured, can't create IRTrans Client : {0}".format(getIRTransId(a_device)))
            except:
                self.log.error(traceback.format_exc())
                # we don't quit plugin if an error occured
                #self.force_leave()
                #return
        # Create the xpl listeners
        Listener(self.handle_xpl_cmd, self.myxpl,{'schema': 'irtrans.basic',
                                                                        'xpltype': 'xpl-cmnd'})
        print "Plugin ready :)"
        self.log.info("Plugin ready :)")
        self.ready()
开发者ID:Raghbinho,项目名称:domogik-plugin-irtrans,代码行数:35,代码来源:irtrans.py

示例6: __init__

# 需要导入模块: from domogik.xpl.common.plugin import XplPlugin [as 别名]
# 或者: from domogik.xpl.common.plugin.XplPlugin import __init__ [as 别名]
    def __init__(self):
        """ Create lister and launch bg listening
        """
        try:
            XplPlugin.__init__(self, name = 'karotz')
        except:
            self.log.error("Error to create Karotz Xplplugin=%s" % (traceback.format_exc()))
            return
            
        self._config = Query(self.myxpl, self.log)

        self.instid = self._config.query('karotz', 'installid')
        self.lang = self._config.query('karotz', 'language')
        
        try:
            self.log.info("Starting library")
            self.karotz=Karotz(self.log,self.instid)
            self.log.info("Started")
        except:
            self.log.error("Error to create Karotz object=%s" % (traceback.format_exc()))
            return

                
        self.log.info("Creating listener for Karotz")
        Listener(self.xpl_command, self.myxpl, {'schema': 'karotz.basic', 'xpltype': 'xpl-cmnd'})
        

        #self.add_stop_cb(self.stop)
        self.enable_hbeat()

        self.log.info("Plugin ready :)")
开发者ID:capof,项目名称:domogik,代码行数:33,代码来源:karotz.py

示例7: __init__

# 需要导入模块: from domogik.xpl.common.plugin import XplPlugin [as 别名]
# 或者: from domogik.xpl.common.plugin.XplPlugin import __init__ [as 别名]
    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")
开发者ID:capof,项目名称:domogik,代码行数:27,代码来源:tschacon.py

示例8: __init__

# 需要导入模块: from domogik.xpl.common.plugin import XplPlugin [as 别名]
# 或者: from domogik.xpl.common.plugin.XplPlugin import __init__ [as 别名]
    def __init__(self):
        """ Init plugin
        """
        XplPlugin.__init__(self, name='cidmodem')

        # Configuration
        self._config = Query(self.myxpl, self.log)
        device = self._config.query('cidmodem', 'device')

        cid_command = self._config.query('cidmodem', 'cid-command')

        # Init Modem
        cid  = CallerIdModem(self.log, self.send_xpl)
        
        # Open Modem
        try:
            cid.open(device, cid_command)
        except CallerIdModemException as e:
            self.log.error(e.value)
            print(e.value)
            self.force_leave()
            return
            
        # Start reading Modem
        cid_process = threading.Thread(None,
                                   cid.listen,
                                   "listen_cid",
                                   (),
                                   {})                                  
        cid_process.start()                              
        self.enable_hbeat()
开发者ID:capof,项目名称:domogik,代码行数:33,代码来源:cidmodem.py

示例9: __init__

# 需要导入模块: from domogik.xpl.common.plugin import XplPlugin [as 别名]
# 或者: from domogik.xpl.common.plugin.XplPlugin import __init__ [as 别名]
    def __init__(self):
        """ Init plugin
        """
        XplPlugin.__init__(self, name='mirror')
        # Get config
        #   - device
        self._config = Query(self.myxpl, self.log)
        device = self._config.query('mirror', 'device')

        # Init Mir:ror
        mirror  = Mirror(self.log, self.send_xpl)
        
        # Open Mir:ror
        try:
            mirror.open(device)
        except MirrorException as e:
            self.log.error(e.value)
            print(e.value)
            self.force_leave()
            return
            
        # Start reading Mir:ror
        mirror_process = threading.Thread(None,
                                   mirror.listen,
                                   "mirror-process-reader",
                                   (self.get_stop(),),
                                   {})
        self.register_thread(mirror_process)
        mirror_process.start()
        self.enable_hbeat()
开发者ID:capof,项目名称:domogik,代码行数:32,代码来源:mirror.py

示例10: __init__

# 需要导入模块: from domogik.xpl.common.plugin import XplPlugin [as 别名]
# 或者: from domogik.xpl.common.plugin.XplPlugin import __init__ [as 别名]
    def __init__(self):
        """
        Create the bluez plugin.
        """
        XplPlugin.__init__(self, name = 'bluez')
        self.log.info("__init__ : Start ...")
        self.config = Query(self.myxpl, self.log)

        self.log.debug("__init__ : Try to start the bluez API")
        try:
            self._bluez = BluezAPI(self.log, self.config, self.myxpl, \
                self.get_stop())
        except:
            error = "Something went wrong during bluezAPI init : %s" %  \
                     (traceback.format_exc())
            self.log.error("__init__ : "+error)

        self.log.debug("__init__ : Try to create listeners")
        Listener(self.basic_cmnd_cb, self.myxpl,
                 {'schema': 'bluez.basic', 'xpltype': 'xpl-cmnd'})

        self.add_stop_cb(self._bluez.stop_all)

        #self.enable_helper()
        self.enable_hbeat()
        self._bluez.start_adaptator()
        self.log.info("Plugin bluez correctly started.")
开发者ID:capof,项目名称:domogik,代码行数:29,代码来源:bluez.py

示例11: __init__

# 需要导入模块: from domogik.xpl.common.plugin import XplPlugin [as 别名]
# 或者: from domogik.xpl.common.plugin.XplPlugin import __init__ [as 别名]
    def __init__(self):
        # Connect to the socket

        XplPlugin.__init__(self, name = 'mochad')

        self.mochad_socket = None

        self._config = Query(self.myxpl, self.log)
        self.__host = self._config.query('mochad','mochad-host')
        self.__port = self._config.query('mochad','mochad-port')
        if self._config.query('mochad','cm15') == "True":
            self.__cm15 = True
        else:
            self.__cm15 = False
        if self._config.query('mochad','cm19') == "True":
            self.__cm19 = True
        else:
            self.__cm19 = False

        if self.__cm15:
            self.__itf = "pl"
        elif self.__cm19:
            self.__itf = "rf"

        self.connect()

        child_pid = os.fork()
        if child_pid == 0:
            self.listener()
        else:
            return None
开发者ID:capof,项目名称:domogik,代码行数:33,代码来源:mochad.py

示例12: __init__

# 需要导入模块: from domogik.xpl.common.plugin import XplPlugin [as 别名]
# 或者: from domogik.xpl.common.plugin.XplPlugin import __init__ [as 别名]
    def __init__(self):
        """ Init plugin
        """
        XplPlugin.__init__(self, name='weather')

        # check if the plugin is configured. If not, this will stop the plugin and log an error
        #if not self.check_configured():
        #    return

        # get the devices list
        # for this plugin, if no devices are created we won't be able to use devices.
        self.devices = self.get_device_list(quit_if_no_device = True)


        self.weather_manager = Weather(self.log, 
                                       self.send_xpl_sensor_basic, 
                                       self.send_xpl_weather_forecast, 
                                       self.get_stop(), 
                                       self.get_parameter_for_feature)
        # Start getting weather informations
        weather_process = threading.Thread(None,
                                    self.weather_manager.start_loop,
                                    "weather-process",
                                    (self.devices,),
                                    {})
        self.register_thread(weather_process)
        weather_process.start()

        self.ready()
开发者ID:fritz-smh,项目名称:domogik-plugin-weather,代码行数:31,代码来源:weather.py

示例13: __init__

# 需要导入模块: from domogik.xpl.common.plugin import XplPlugin [as 别名]
# 或者: from domogik.xpl.common.plugin.XplPlugin import __init__ [as 别名]
    def __init__(self):
        """ Init plugin
        """
        XplPlugin.__init__(self, name='rfxbnz')

        # check if the plugin is configured. If not, this will stop the plugin and log an error
        if not self.check_configured():
            return

        # Configuration
        host = self.get_config("host")                         # host where rfxcomrx run
        if host is None:
            self.log.error('### Host is not configured, exiting')
            self.force_leave()
            return

        self.lastTimestampHbeat = time.time()

        # Create listeners
        self.log.info("==>  Creating listener for rfxbnz")
        Listener(self.rfxbnz_stat_cb, self.myxpl, {'xplsource': 'bnz-rfxcomrx.' + host, 'xpltype': 'xpl-stat', 'schema': 'hbeat.app'})

        self.log.info("==> Launch thread to rfxbnz_chk_hbeat")
        threads = {}
        thr_name = "rfxbnz_chk"
        threads[thr_name] = threading.Thread(None,
                                            self.rfxbnz_chk_hbeat,
                                            thr_name,
                                            (self.log,
                                                self.get_stop()),
                                            {})
        threads[thr_name].start()
        self.register_thread(threads[thr_name])

        self.ready()
开发者ID:vdomos,项目名称:domogik-plugin-rfxbnz,代码行数:37,代码来源:rfxbnz.py

示例14: __init__

# 需要导入模块: from domogik.xpl.common.plugin import XplPlugin [as 别名]
# 或者: from domogik.xpl.common.plugin.XplPlugin import __init__ [as 别名]
    def __init__(self, proxy_ip, proxy_port):
        """
        Initiate properties
        Then, start HTTP server and give it initialized data
        @param proxy_ip :  ip of the proxy server
        @param proxy_port :  port of proxy server
        """

        XplPlugin.__init__(self, name = 'proxy',
            reload_cb = self.reload_config)
        # logging initialization
        self.log.info("Proxy initialisation ...")
        self.log.debug("locale : %s %s" % locale.getdefaultlocale())
        self._config = Query(self.myxpl, self.log)
        self.server = None
        self.server_process = None
        self.proxy_ip = None
        self.proxy_port = None
        self.use_ssl = False
        self.ssl_certificate = None
        self.server_ip = None
        self.server_port = None
        self.auth_method = None
        self.username = None
        self.password = None
        self.add_stop_cb(self.stop_http)
        self.enable_hbeat()
        self.reload_config()
开发者ID:capof,项目名称:domogik,代码行数:30,代码来源:proxy.py

示例15: __init__

# 需要导入模块: from domogik.xpl.common.plugin import XplPlugin [as 别名]
# 或者: from domogik.xpl.common.plugin.XplPlugin import __init__ [as 别名]
    def __init__(self):
        """
        Create the X10Main class
        This class is used to connect x10 (through cm15a) to the xPL Network
        """
        XplPlugin.__init__(self, name = 'x10cm15a')
        self.log.error("Cm15a correctly started")
        self._device = "/dev/cm15a0"
#        self._config = Query(self.myxpl, self.log)
#        self._device = self._config.query('cm15a', 'cm15a-path')
        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.__myx10 = X10API(self._device, self.log)
        except Exception:
            self.log.error("Something went wrong during cm15a init, check logs")
            self.log.error("Exception : %s" % traceback.format_exc())
            exit(1)
        #Create listeners
        Listener(self.x10_cmnd_cb, self.myxpl, 
                 {'schema': 'x10.basic', 'xpltype': 'xpl-cmnd'})
        self.log.debug("Sending hbeat")
        self.enable_hbeat()
        self.log.debug("Cm15a correctly started")
开发者ID:capof,项目名称:domogik,代码行数:29,代码来源:x10cm15a.py


注:本文中的domogik.xpl.common.plugin.XplPlugin.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。