Help - Automation (that doesn't exist) runs on startup

Pasted below is the error that I am receiving on restart. The automation runs 4 times if I reload or restart HA or Automations.

Crazy thing is, this automation doesn’t exist anymore. It was renamed because I was using it to template my other options. It does use a MQTT trigger from a tag for the renamed automations.

Any ideas on what could be happening? Thanks in advance!

Logger: homeassistant.components.automation.audio_pool_music_disney_favorites_duplicate
Source: helpers/script.py:1097
Integration: Automation ([documentation](https://www.home-assistant.io/integrations/automation), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+automation%22))
First occurred: 2:34:33 PM (8 occurrences)
Last logged: 2:36:50 PM

Audio - Pool Music - Ultra HD Alternative: Already running

Example of the automation:

- id: '1602607727445'
  alias: Audio - Pool Music - Ultra HD Alternative
  description: ''
  trigger:
  - platform: mqtt
    topic: pool/uid
    payload: 04b7092ab46d84
  condition: []
  action:
  - service: input_select.select_option
    data:
      entity_id: input_select.music_options
      option: Ultra HD Alternative
  - service: media_player.play_media
    data:
      entity_id: media_player.echo_link_amp
      media_content_id: Ultra HD Alternative
      media_content_type: AMAZON_MUSIC
  mode: single

edited post header to clarify that I am asking for help.

Where are you looking to confirm it no longer exists?

1 Like

I have been looking in my automations.yaml (plus checking all the other .yaml’s for strays) and automations tab.

Is there another place I should be looking?

Okay, so I found it in entities, I was just looking at the friendly name. Thanks for the prodding.

Now, to figure out why it is firing on startup. MQTT problem maybe?

My guess is the payload 04b7092ab46d84 was published to the topic pool/uid as a retained message. That means the MQTT broker has stored it.

Every time you restart Home Assistant, it re-subscribes to pool/uid and receives the payload 04b7092ab46d84. Naturally, this serves to trigger the automation.

If you have an MQTT client handy, like MQTT Explorer, you can easily purge the retained message from the MQTT Broker. That will prevent Home Assistant from receiving it on startup.

Alternately, go to Developer Tools > Services and publish an empty retained message to pool/uid and that will purge it.

Screenshot from 2020-10-15 17-09-06

For your convenience, copy/paste the following into the Service Data area:

topic: pool/uid
payload: ''
retain: true
1 Like

That is exactly what it was. I’ll fix my code on the client as well. Greatly appreciate the help!

1 Like