platypush/plugins/zigbee/mqtt/__init__.py
def device_rename(self, name: str, device: Optional[str] = None, **kwargs):
        """
        Rename a device on the network.

        :param name: New name.
        :param device: Current name of the device to rename. If no name is specified then the rename will
            affect the last device that joined the network.
        :param kwargs: Extra arguments to be passed to :meth:`platypush.plugins.mqtt.MqttPlugin.publish``
            (default: query the default configured device).
        """
        if name == device:
            self.logger.info('Old and new name are the same: nothing to do')
            return

        # noinspection PyUnresolvedReferences
        devices = self.devices().output
        assert not [dev for dev in devices if dev.get('friendly_name') == name], \
            'A device named {} already exists on the network'.format(name)

        if device:
            req = {
                'from': device,
                'to': name,
            }
        else:
            req = {
                'last': True,
                'to': name,
            }

        return self._parse_response(
            self.publish(topic=self._topic('bridge/request/device/rename'),
                         msg=req,
                         reply_topic=self._topic('bridge/response/device/rename'),
                         **self._mqtt_args(**kwargs)))

        Rename a device on the network.

        :param name: New name.
        :param device: Current name of the device to rename. If no name is specified then the rename will
            affect the last device that joined the network.
        :param kwargs: Extra arguments to be passed to :meth:`platypush.plugins.mqtt.MqttPlugin.publish``
            (default: query the default configured device).
        
Rename a device on the network.
Rename a device on the network .
def device_rename(self, name: str, device: Optional[str] = None, **kwargs):
        if name == device:
            self.logger.info('Old and new name are the same: nothing to do')
            return
        devices = self.devices().output
        assert not [dev for dev in devices if dev.get('friendly_name') == name], \
            'A device named {} already exists on the network'.format(name)
        if device:
            req = {
                'from': device,
                'to': name,
            }
        else:
            req = {
                'last': True,
                'to': name,
            }
        return self._parse_response(
            self.publish(topic=self._topic('bridge/request/device/rename'),
                         msg=req,
                         reply_topic=self._topic('bridge/response/device/rename'),
                         **self._mqtt_args(**kwargs)))
def device_rename ( self , name : str , device : Optional [ str ] = None , ** kwargs ) : if name == device : self . logger . info ( 'Old and new name are the same: nothing to do' ) return devices = self . devices ( ) . output assert not [ dev for dev in devices if dev . get ( 'friendly_name' ) == name ] , 'A device named {} already exists on the network' . format ( name ) if device : req = { 'from' : device , 'to' : name , } else : req = { 'last' : True , 'to' : name , } return self . _parse_response ( self . publish ( topic = self . _topic ( 'bridge/request/device/rename' ) , msg = req , reply_topic = self . _topic ( 'bridge/response/device/rename' ) , ** self . _mqtt_args ( ** kwargs ) ) )
Rename a device on the network.
Rename a device on the network .
"""
        Rename a device on the network.

        :param name: New name.
        :param device: Current name of the device to rename. If no name is specified then the rename will
            affect the last device that joined the network.
        :param kwargs: Extra arguments to be passed to :meth:`platypush.plugins.mqtt.MqttPlugin.publish``
            (default: query the default configured device).
        """ # noinspection PyUnresolvedReferences
self
name
str
None
device
Optional[str]
Current name of the device to rename. If no name is specified then the rename will
affect the last device that joined the network.
Current name of the device to rename . If no name is specified then the rename will affect the last device that joined the network .
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 ) .