platypush/plugins/zwave/mqtt/__init__.py
def toggle(self, device: str, *args, **kwargs) -> dict:
        """
        Toggle a switch on a device.

        :param device: ``id_on_network`` of the value to be toggled.
        :param kwargs: Extra arguments to be passed to :meth:`platypush.plugins.mqtt.MqttPlugin.publish``
            (default: query the default configured device).
        """
        value = self._get_value(id_on_network=device, use_cache=False, **kwargs)
        value['data'] = not value['data']
        self.set_value(data=value['data'], id_on_network=device, **kwargs)

        return {
            'name': '{} - {}'.format(self._nodes_cache['by_id'][value['node_id']]['name'],
                                     value.get('label', '[No Label]')),
            'on': value['data'],
            'id': value['value_id'],
        }

        Toggle a switch on a device.

        :param device: ``id_on_network`` of the value to be toggled.
        :param kwargs: Extra arguments to be passed to :meth:`platypush.plugins.mqtt.MqttPlugin.publish``
            (default: query the default configured device).
        
Toggle a switch on a device.
Toggle a switch on a device .
def toggle(self, device: str, *args, **kwargs) -> dict:
        value = self._get_value(id_on_network=device, use_cache=False, **kwargs)
        value['data'] = not value['data']
        self.set_value(data=value['data'], id_on_network=device, **kwargs)
        return {
            'name': '{} - {}'.format(self._nodes_cache['by_id'][value['node_id']]['name'],
                                     value.get('label', '[No Label]')),
            'on': value['data'],
            'id': value['value_id'],
        }
def toggle ( self , device : str , * args , ** kwargs ) -> dict : value = self . _get_value ( id_on_network = device , use_cache = False , ** kwargs ) value [ 'data' ] = not value [ 'data' ] self . set_value ( data = value [ 'data' ] , id_on_network = device , ** kwargs ) return { 'name' : '{} - {}' . format ( self . _nodes_cache [ 'by_id' ] [ value [ 'node_id' ] ] [ 'name' ] , value . get ( 'label' , '[No Label]' ) ) , 'on' : value [ 'data' ] , 'id' : value [ 'value_id' ] , }
Toggle a switch on a device.
Toggle a switch on a device .
"""
        Toggle a switch on a device.

        :param device: ``id_on_network`` of the value to be toggled.
        :param kwargs: Extra arguments to be passed to :meth:`platypush.plugins.mqtt.MqttPlugin.publish``
            (default: query the default configured device).
        """
self
device
str
``id_on_network`` of the value to be toggled.
` ` id_on_network ` ` of the value to be toggled .
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 ) .