コード例 #1
0
ファイル: testplugin.py プロジェクト: Basilic/domogik
 def __init__(self, name, host):
     """ Constructor
         @param name: plugin name
         @param host: plugin host
     """
     self.name = name
     self.host = host
     self.type = "plugin"
     self.plugin_status = None
     MQAsyncSub.__init__(self, zmq.Context(), 'test', ['plugin.status'])
コード例 #2
0
 def __init__(self, name, host):
     """ Constructor
         @param name: plugin name
         @param host: plugin host
     """
     self.name = name
     self.host = host
     self.type = "plugin"
     self.plugin_status = None
     MQAsyncSub.__init__(self, zmq.Context(), 'test', ['plugin.status'])
コード例 #3
0
ファイル: xplgw.py プロジェクト: Dsls/domogik
    def __init__(self):
        """ Initiate DbHelper, Logs and config
        """
        XplPlugin.__init__(self, 'xplgw')
        MQAsyncSub.__init__(self, self.zmq, 'xplgw', ['client.conversion', 'client.list'])

        self.log.info(u"XPL manager initialisation...")
        self._db = DbHelper()
        self.pub = MQPub(zmq.Context(), 'xplgw')
        self.stats = None
        self.client_xpl_map = {}
	self.client_conversion_map = {}
        self._load_client_to_xpl_target()
	self._load_conversions()
        self.load()
        self.ready()
コード例 #4
0
ファイル: xplgw.py プロジェクト: thefrip/domogik
    def __init__(self):
        """ Initiate DbHelper, Logs and config
        """
        XplPlugin.__init__(self, 'xplgw')
        MQAsyncSub.__init__(self, self.zmq, 'xplgw',
                            ['client.conversion', 'client.list'])

        self.log.info(u"XPL manager initialisation...")
        self._db = DbHelper()
        self.pub = MQPub(zmq.Context(), 'xplgw')
        self.stats = None
        self.client_xpl_map = {}
        self.client_conversion_map = {}
        self._load_client_to_xpl_target()
        self._load_conversions()
        self.load()
        self.ready()
コード例 #5
0
ファイル: dump.py プロジェクト: Basilic/domogik
 def __init__(self):
    # parser = OptionParser()
    # parser.add_option("-c", action="store_true", dest="compress", \
    #         default=False, help="Diaply data in a compress way")
    # parser.add_option("-t", action="store", dest="xpltype", \
    #         default=None, type="string", \
    #         help="Filter messages on XPL message type")
    # parser.add_option("-s", action="store", dest="xplsource", \
    #         default=None, type="string", \
    #         help="Filter messages on XPL source field")
    # parser.add_option("-S", action="store", dest="xplschema", \
    #         default=None, type="string", \
    #         help="Filter messages on XPL schema field")
    # parser.add_option("-i", action="store", dest="xplinstance", \
    #         default=None, type="string", \
    #         help="Filter messages on XPL instance")
     MQAsyncSub.__init__(self, zmq.Context(), 'mqdump', '')
     IOLoop.instance().start()
コード例 #6
0
ファイル: dump.py プロジェクト: thefrip/domogik
 def __init__(self):
     # parser = OptionParser()
     # parser.add_option("-c", action="store_true", dest="compress", \
     #         default=False, help="Diaply data in a compress way")
     # parser.add_option("-t", action="store", dest="xpltype", \
     #         default=None, type="string", \
     #         help="Filter messages on XPL message type")
     # parser.add_option("-s", action="store", dest="xplsource", \
     #         default=None, type="string", \
     #         help="Filter messages on XPL source field")
     # parser.add_option("-S", action="store", dest="xplschema", \
     #         default=None, type="string", \
     #         help="Filter messages on XPL schema field")
     # parser.add_option("-i", action="store", dest="xplinstance", \
     #         default=None, type="string", \
     #         help="Filter messages on XPL instance")
     MQAsyncSub.__init__(self, zmq.Context(), 'mqdump', '')
     IOLoop.instance().start()
コード例 #7
0
ファイル: manager.py プロジェクト: mehrdad-s/domogik
    def __init__(self, name, host, clients, zmq_context):
        """ Init a component
            @param name : component name (dbmgr, rest)
            @param host : hostname
            @param clients : clients list 
            @param zmq_context : 0MQ context
        """
        GenericComponent.__init__(self, name = name, host = host, clients = clients)
        self.log.info(u"New core component : {0}".format(self.name))

        ### set the component type
        self.type = "core"

        ### component data (empty)
        self.data = {}

        ### register the component as a client
        self.register_component()

        ### zmq context
        self.zmq = zmq_context

        ### subscribe the the MQ for category = plugin and name = self.name
        MQAsyncSub.__init__(self, self.zmq, 'manager', ['plugin.status'])
コード例 #8
0
ファイル: handlers.py プロジェクト: pnb990/domoweb
 def __init__(self):
     MQAsyncSub.__init__(self, zmq.Context(), 'test', ['device-stats'])
コード例 #9
0
 def __init__(self):
     MQAsyncSub.__init__(self, zmq.Context(), 'test', ['client.list'])
     IOLoop.instance().start()
コード例 #10
0
ファイル: manager.py プロジェクト: mehrdad-s/domogik
    def __init__(self, name, host, clients, libraries_directory, packages_directory, zmq_context, stop, local_host):
        """ Init a plugin 
            @param name : plugin name (ipx800, onewire, ...)
            @param host : hostname
            @param clients : clients list 
            @param libraries_directory : path for the base python module for packages : /var/lib/domogik/
            @param packages_directory : path in which are stored the packages : /var/lib/domogik/packages/
            @param zmq_context : zmq context
            @param stop : get_stop()
            @param local_host : get_sanitized_hostname()
        """
        GenericComponent.__init__(self, name = name, host = host, clients = clients)
        self.log.info(u"New plugin : {0}".format(self.name))

        ### check if the plugin is on he local host
        if self.host == local_host:
            self.local_plugin = True
        else:
            self.local_plugin = False

        ### TODO : this will be to handle later : multi host (multihost)
        # * how to find available plugins on other hosts ?
        # * how to start/stop plugins on other hosts ?
        # * ...
        if self.local_plugin == False:
            self.log.error(u"Currently, the multi host feature for plugins is not yet developped. This plugin will not be registered")
            return

        ### set the component type
        self.type = "plugin"

        ### set package path
        self._packages_directory = packages_directory
        self._libraries_directory = libraries_directory

        ### zmq context
        self.zmq = zmq_context

        ### XplPlugin
        self._stop = stop

        ### config
        # used only in the function add_configuration_values_to_data()
        # elsewhere, this function is used : self.get_config("xxxx")
        self._config = Query(self.zmq, self.log)

        ### get the plugin data (from the json file)
        status = None
        self.data = {}
        self.fill_data()

        ### check if the plugin is configured (get key 'configured' in database over queryconfig)
        configured = self._config.query(self.name, 'configured')
        if configured == '1':
            configured = True
        if configured == True:
            #self.set_configured(True)
            self.configured = True
        else:
            #self.set_configured(False)
            self.configured = False

        ### register the plugin as a client
        self.register_component()

        ### subscribe the the MQ for category = plugin and name = self.name
        MQAsyncSub.__init__(self, self.zmq, 'manager', ['plugin.status', 'plugin.configuration'])

        ### check if the plugin must be started on manager startup
        startup = self._config.query(self.name, 'auto_startup')
        if startup == '1':
            startup = True
        if startup == True:
            self.log.info(u"Plugin {0} configured to be started on manager startup. Starting...".format(name))
            pid = self.start()
            if pid:
                self.log.info(u"Plugin {0} started".format(name))
            else:
                self.log.error(u"Plugin {0} failed to start".format(name))
        else:
            self.log.info(u"Plugin {0} not configured to be started on manager startup.".format(name))
コード例 #11
0
 def __init__(self):
     MQAsyncSub.__init__(self, zmq.Context(), 'test', ['device.new'])
     IOLoop.instance().start()
コード例 #12
0
 def open(self):
     MQAsyncSub.__init__(self, zmq.Context(), 'admin', [])
     AdminWebSocket.clients.add(self)
コード例 #13
0
ファイル: sub_helper_publish.py プロジェクト: thefrip/domogik
 def __init__(self):
     MQAsyncSub.__init__(self, zmq.Context(), 'test', ['helper.publish'])
     IOLoop.instance().start()
コード例 #14
0
ファイル: sub_plugin_status.py プロジェクト: thefrip/domogik
 def __init__(self):
     MQAsyncSub.__init__(self, zmq.Context(), 'test', ['plugin.status'])
     IOLoop.instance().start()
コード例 #15
0
ファイル: sub_device_new.py プロジェクト: Dsls/domogik
 def __init__(self):
     MQAsyncSub.__init__(self, zmq.Context(), 'test', ['device.new'])
     IOLoop.instance().start()
コード例 #16
0
ファイル: sub_plugin_status.py プロジェクト: Basilic/domogik
 def __init__(self):
     MQAsyncSub.__init__(self, zmq.Context(), 'test', ['plugin.status'])
     IOLoop.instance().start()
コード例 #17
0
ファイル: sub_package_detail.py プロジェクト: thefrip/domogik
 def __init__(self):
     MQAsyncSub.__init__(self, zmq.Context(), 'test', ['package.detail'])
     IOLoop.instance().start()