platypush/plugins/zwave/mqtt/__init__.py
def status(self, **kwargs) -> Dict[str, Any]:
        """
        Get the status of the controller.

        :param kwargs: Extra arguments to be passed to :meth:`platypush.plugins.mqtt.MqttPlugin.publish``
            (default: query the default configured device).
        :return: dict with the following fields: ``device`` and ``state``.
        """
        msg_queue = queue.Queue()
        topic = f'{self.topic_prefix}/Controller/status'
        client = self._get_client(**kwargs)

        def on_message(_, __, msg):
            if msg.topic != topic:
                return
            msg_queue.put(json.loads(msg.payload))

        client.on_message = on_message
        client.connect(kwargs.get('host', self.host), kwargs.get('port', self.port),
                       keepalive=kwargs.get('timeout', self.timeout))

        client.subscribe(topic)
        client.loop_start()

        try:
            status = msg_queue.get(block=True, timeout=kwargs.get('timeout', self.timeout))
        except queue.Empty:
            raise TimeoutError('The request timed out')
        finally:
            client.loop_stop()

        return {
            'device': status['nodeId'],
            'state': status['status'],
            'stats': {},
        }

        Get the status of the controller.

        :param kwargs: Extra arguments to be passed to :meth:`platypush.plugins.mqtt.MqttPlugin.publish``
            (default: query the default configured device).
        :return: dict with the following fields: ``device`` and ``state``.
        
Get the status of the controller.
Get the status of the controller .
def status(self, **kwargs) -> Dict[str, Any]:
        msg_queue = queue.Queue()
        topic = f'{self.topic_prefix}/Controller/status'
        client = self._get_client(**kwargs)
        def on_message(_, __, msg):
            if msg.topic != topic:
                return
            msg_queue.put(json.loads(msg.payload))
        client.on_message = on_message
        client.connect(kwargs.get('host', self.host), kwargs.get('port', self.port),
                       keepalive=kwargs.get('timeout', self.timeout))
        client.subscribe(topic)
        client.loop_start()
        try:
            status = msg_queue.get(block=True, timeout=kwargs.get('timeout', self.timeout))
        except queue.Empty:
            raise TimeoutError('The request timed out')
        finally:
            client.loop_stop()
        return {
            'device': status['nodeId'],
            'state': status['status'],
            'stats': {},
        }
def status ( self , ** kwargs ) -> Dict [ str , Any ] : msg_queue = queue . Queue ( ) topic = f'{self.topic_prefix}/Controller/status' client = self . _get_client ( ** kwargs ) def on_message ( _ , __ , msg ) : if msg . topic != topic : return msg_queue . put ( json . loads ( msg . payload ) ) client . on_message = on_message client . connect ( kwargs . get ( 'host' , self . host ) , kwargs . get ( 'port' , self . port ) , keepalive = kwargs . get ( 'timeout' , self . timeout ) ) client . subscribe ( topic ) client . loop_start ( ) try : status = msg_queue . get ( block = True , timeout = kwargs . get ( 'timeout' , self . timeout ) ) except queue . Empty : raise TimeoutError ( 'The request timed out' ) finally : client . loop_stop ( ) return { 'device' : status [ 'nodeId' ] , 'state' : status [ 'status' ] , 'stats' : { } , }
Get the status of the controller.
Get the status of the controller .
"""
        Get the status of the controller.

        :param kwargs: Extra arguments to be passed to :meth:`platypush.plugins.mqtt.MqttPlugin.publish``
            (default: query the default configured device).
        :return: dict with the following fields: ``device`` and ``state``.
        """
dict with the following fields: ``device`` and ``state``.
dict with the following fields : ` ` device ` ` and ` ` state ` ` .
self
kwargs
Extra arguments to be passed to :meth:`platypush.plugins.mqtt.MqttPlugin.publish``
(default: query the default configured device).
Extra arguments to be passed to : meth : ` platypush . plugins . mqtt . MqttPlugin . publish ` ` ( default : query the default configured device ) .