Unknown service: mqtt.publish (but only for a second)

Hi there,

I was playing with HA (but not changing anything) when suddenly, I had a repair show up as follows:
Screenshot 2022-10-19 at 09.21.44

The log details screen shows:

The script being called by the automation is:

  lights_all_off:
    alias: 'Lights: off'
    sequence:
      - service: input_select.select_option
        target:
          entity_id: input_select.light_scene
        data:
          option: all_off
      - service: light.turn_off
        data:
          transition: 1
        target:
          entity_id: light.bedroom_1_ceiling
      - service: mqtt.publish
        data:
          topic: zigbee2mqtt/house_lights/set
          payload: '{"scene_recall": 0}'
    mode: single
    icon: phu:bulb-classic-off

I ran the script manually (seconds later) - and it is working fine.

I am running HA container (Docker) 2022.10.4 on a Rpi 4 (2Gb) and it is showing no high loads etc. Z2M shows no errors.

My mqtt.publish scripts have run many times since that update (before the repair showed itself and once since - all working as expected with no more errors.

Any ideas?

…sorry, but not sure which category this goes in…

1 Like

hello,

i have the same issue,

i restart and nothing new, just “save” the repair like if i have really repaired but i do nothing and the error goes and doesnt come back…

Perhaps not related but the 2 sensors used are from Arduino MQTT and perhaps no more up to date with the last MQTT broker version…i will investigate if the error goes back

1 Like

My devices are mainly Hue/Aqara but I am not sure it’s related (as you suggested) as the issue appears to be around the availability of the service call: mqtt.publish.

yes, seems not related…wait to see if someone else encounter the same problem…

same problem here, after update version 2022.11

I have the same Issue, using Home Assistant OS

Does this happen when HA is starting up? It could be the MQTT config entry is not ready yet and an automation could fail if mqtt.publish is called, because it is not registered yet.

1 Like

That’s an excellent question.
I haven’t had the error in a while (plenty of restarts since the last one for upgrades etc) but I will keep a lookout - thank you for the suggestion.

I have two questions:

  1. Can you check you have if this file is still present in your install?
    homeassistant/components/mqtt/device_tracker/schema_yaml.py.
    B.T.W. This file should have been removed with the upgrade to HA Core 2022.12, you can safely remove it.

  2. What method do you use to upgrade Home Assistant core?

I don’t have a homeassistant/components/ directory which may be because of my answer to your 2nd question.

I am running HA Container (so it’s docker-compose pull to upgrade).

Hmm, that file should be checked upon inside the docker container. But okay so you use a Docker image.

Can you share info on the docker image you are using?

Sure, it’s homeassistant/home-assistant:stable

I’m not sure how to look inside the container itself. I only look at the directory that I have linked to /config via the docker-compose volumes: command:

[edit: clarification]

Right, I checked that image (issue not found). It seems to be a problem to some users that are using pip to upgrade their install.

Thanks for checking though. Can you tell me how you did it (so I can learn)?

Started the image like:
sudo docker run -it --rm --name homeassistant -v ~/config:/config -e TZ=Europe/Amsterdam --net=host homeassistant/home-assistant

Then I opened a shell on the running container:
docker exec -it homeassistant /bin/bash

The mqtt source files are at:
cd /usr/src/homeassistant/homeassistant/components/mqtt

ls -al shows all the files in the folder.

1 Like

Thanks - that’s appreciated!