Skip to content

Instantly share code, notes, and snippets.

@techwithjake
Last active September 4, 2022 16:34
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save techwithjake/e3907228be08c217de3ce350d774a384 to your computer and use it in GitHub Desktop.
Save techwithjake/e3907228be08c217de3ce350d774a384 to your computer and use it in GitHub Desktop.
clear-mqtt-from-HA
automation:
- alias: clear_mqtt_topic
initial_state: 'on'
trigger:
- platform: state
entity_id:
- input_text.clear_mqtt_topic
condition:
- condition: template
value_template: "{{ 'homeassistant/sensor/' in states.input_text.clear_mqtt_topic.state }}"
action:
- service: mqtt.publish
data_template:
topic: "{{ states.input_text.clear_mqtt_topic.state }}"
retain: true
input_text:
clear_mqtt_topic:
name: MQTT Topic to Clear
mode: text
initial: ''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment