MQTT integration discovery not working

Dear guys,

I am new here and start with a topic which annoys me since a few days.

I have a homeassistant server running, version is 2021.12.10. Many things work, some don’t work, but from time to time I find solutions. But not this time.

My mosquitto broker is well running and I can receive and publish messages manually.
I have also already some MQTT sensors connected. These are a BME280 sensor and two Shelly Plug S.
These devices are manually integrated without using the auto discovery by the MQTT integration. I added them by writing all necessary information into the configuration.yaml:

sensor:
- platform: mqtt
    state_topic: /homeassistant/sensors/arbeitszimmer/drucker/temperature
    name: "Temperatur"
    unit_of_measurement: " °C"
    unique_id: sensor.3D_BME280_temperature
- platform: mqtt
    state_topic: shellies/Shelly_PlugS_AZ-DD28AE/relay/0/energy
    name: Shelly_PlugS_AZ Energie
    device_class: energy
    unit_of_measurement: 'kWh'
    value_template: '{{"{:.2f}".format(value | float / 60000 ) }}'
    icon: mdi:lightning-bolt

These are two examples. This worked fine for me so far, but as I read there is auto discovery of new MQTT devices possible.

As I have many Shelly Plugs and Shelly Button 1 which I want to implement in my house, a smart war of discovery would be nice.
So I tried it, but I were not able to make it running.

This is how my configuration of the integration looks like:
(see first 3 screenshots at the end)

As I said, the configuration works so far. I can communicate with the broker using the listening and publishing fields.

Yesterday I set up a Shelly Button 1which was instantly detected by the Shelly integration, but not by the MQTT integration. The shelly itself has this MQTT configuration:
(see fourth screenshot at the end)

I already tried to change from “core-mosquitto” to 192.168.1.180 inside the config of MQTT integration, but that made no difference.

So I searched in this community and found some hints, that this Shellies discovery script is needed:
https://community.home-assistant.io/t/shellies-discovery-script/94048

So I set that one up. But it also changed anything. My integration symbol in homeassistant allways looks like that:
(see last screenshot at the end)

No numbers of found devices or entities are shown. All other integrations, which use auto discovery work without any problems.

I am starting to get frustrated. Maybe anyone can help me?

Regards

1 Like

Did you configure python_script component for Shellies Discovery?
Did you add Shellies Discovery automations to your configuration?
Did you check Shellies Discovery troubleshooting list?

How can we help you if we don’t know anything about your configuration?

Hello Maciek

What do you mean with configuration especially for Shellies Discovery? I did, what is written here:
https://www.home-assistant.io/integrations/python_script/

That means, I just added this to the configuration.yaml:

python_script:

And I created a folder for the scripts, where now the github script for shellies discovery is located.

Maybe I did something wrong here, or forgot something? I followed the instructions fro the shellies-discovery-readme. But the following phrase maybe missunderstood by yself:

You must have a properly configured python_script component to be able to install the script from the HACS Automations section.

After installing the script and adding automations, run Shellies Announce automation or restart Home Assistant twice.

Can somebody explain for a newbie like me?

After the steps, I described above I moved to HACS and added Shellies Discovery python script to my HACS automations. See picture.

Thats all.