platypush/plugins/zigbee/mqtt/__init__.py
def devices_get(self, devices: Optional[List[str]] = None, **kwargs) -> Dict[str, dict]:
        """
        Get the properties of the devices connected to the network.

        :param devices: If set, then only the status of these devices (by friendly name) will be retrieved (default:
            retrieve all).
        :param kwargs: Extra arguments to be passed to :meth:`platypush.plugins.mqtt.MqttPlugin.publish``
            (default: query the default configured device).
        :return: Key->value map of the device properties:

            .. code-block:: json

                {
                    "Bulb": {
                        "state": "ON",
                        "brightness": 254
                    },
                    "Sensor": {
                        "temperature": 22.5
                    }
                }
        """
        kwargs = self._mqtt_args(**kwargs)

        if not devices:
            # noinspection PyUnresolvedReferences
            devices = set([
                device['friendly_name'] or device['ieee_address']
                for device in self.devices(**kwargs).output
            ])

        def worker(device: str, q: Queue):
            # noinspection PyUnresolvedReferences
            q.put(self.device_get(device, **kwargs).output)

        queues = {}
        workers = {}
        response = {}

        for device in devices:
            queues[device] = Queue()
            workers[device] = threading.Thread(target=worker, args=(device, queues[device]))
            workers[device].start()

        for device in devices:
            try:
                response[device] = queues[device].get(timeout=kwargs.get('timeout'))
                workers[device].join(timeout=kwargs.get('timeout'))
            except Exception as e:
                self.logger.warning('An error while getting the status of the device {}: {}'.format(
                    device, str(e)))

        return response

        Get the properties of the devices connected to the network.

        :param devices: If set, then only the status of these devices (by friendly name) will be retrieved (default:
            retrieve all).
        :param kwargs: Extra arguments to be passed to :meth:`platypush.plugins.mqtt.MqttPlugin.publish``
            (default: query the default configured device).
        :return: Key->value map of the device properties:

            .. code-block:: json

                {
                    "Bulb": {
                        "state": "ON",
                        "brightness": 254
                    },
                    "Sensor": {
                        "temperature": 22.5
                    }
                }
        
Get the properties of the devices connected to the network.
Get the properties of the devices connected to the network .
def devices_get(self, devices: Optional[List[str]] = None, **kwargs) -> Dict[str, dict]:
        kwargs = self._mqtt_args(**kwargs)
        if not devices:
            devices = set([
                device['friendly_name'] or device['ieee_address']
                for device in self.devices(**kwargs).output
            ])
        def worker(device: str, q: Queue):
            q.put(self.device_get(device, **kwargs).output)
        queues = {}
        workers = {}
        response = {}
        for device in devices:
            queues[device] = Queue()
            workers[device] = threading.Thread(target=worker, args=(device, queues[device]))
            workers[device].start()
        for device in devices:
            try:
                response[device] = queues[device].get(timeout=kwargs.get('timeout'))
                workers[device].join(timeout=kwargs.get('timeout'))
            except Exception as e:
                self.logger.warning('An error while getting the status of the device {}: {}'.format(
                    device, str(e)))
        return response
def devices_get ( self , devices : Optional [ List [ str ] ] = None , ** kwargs ) -> Dict [ str , dict ] : kwargs = self . _mqtt_args ( ** kwargs ) if not devices : devices = set ( [ device [ 'friendly_name' ] or device [ 'ieee_address' ] for device in self . devices ( ** kwargs ) . output ] ) def worker ( device : str , q : Queue ) : q . put ( self . device_get ( device , ** kwargs ) . output ) queues = { } workers = { } response = { } for device in devices : queues [ device ] = Queue ( ) workers [ device ] = threading . Thread ( target = worker , args = ( device , queues [ device ] ) ) workers [ device ] . start ( ) for device in devices : try : response [ device ] = queues [ device ] . get ( timeout = kwargs . get ( 'timeout' ) ) workers [ device ] . join ( timeout = kwargs . get ( 'timeout' ) ) except Exception as e : self . logger . warning ( 'An error while getting the status of the device {}: {}' . format ( device , str ( e ) ) ) return response
Get the properties of the devices connected to the network.
Get the properties of the devices connected to the network .
"""
        Get the properties of the devices connected to the network.

        :param devices: If set, then only the status of these devices (by friendly name) will be retrieved (default:
            retrieve all).
        :param kwargs: Extra arguments to be passed to :meth:`platypush.plugins.mqtt.MqttPlugin.publish``
            (default: query the default configured device).
        :return: Key->value map of the device properties:

            .. code-block:: json

                {
                    "Bulb": {
                        "state": "ON",
                        "brightness": 254
                    },
                    "Sensor": {
                        "temperature": 22.5
                    }
                }
        """ # noinspection PyUnresolvedReferences # noinspection PyUnresolvedReferences
Key->value map of the device properties:
code-block:: json


Key - > value map of the device properties : code - block :: json
self
devices
Optional[List[str]]
If set, then only the status of these devices (by friendly name) will be retrieved (default:
retrieve all).
If set then only the status of these devices ( by friendly name ) will be retrieved ( default : retrieve all ) .
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 ) .