def METHOD_NAME(self, dict_vars):
    device_measurement = get_measurement(
        self.measurement_measurement_id)
    if not device_measurement:
        msg = f" Error: A measurement needs to be selected as the payload."
        self.logger.error(msg)
        dict_vars["message"] += msg
        return dict_vars
    channel = device_measurement.channel
    try:
        payload = dict_vars["measurements_dict"][channel]['value']
    except:
        payload = None
    self.logger.debug(f"Input channel: {channel}, payload: {payload}")
    if payload is None:
        msg = f" Error: No measurement found in dictionary passed to Action for channel {channel}."
        self.logger.error(msg)
        dict_vars["message"] += msg
        return dict_vars
    try:
        auth_dict = None
        if self.login:
            auth_dict = {
                "username": self.username,
                "password": self.password
            }
        self.publish.single(
            self.topic,
            payload,
            hostname=self.hostname,
            port=self.port,
            client_id=self.clientid,
            keepalive=self.keepalive,
            auth=auth_dict,
            transport='websockets' if self.mqtt_use_websockets else 'tcp')
        dict_vars["message"] += f" MQTT Publish '{payload}'."
    except Exception as err:
        msg = f" Could not execute MQTT Publish: {err}"
        self.logger.error(msg)
        dict_vars["message"] += msg
    return dict_vars