Integrating Shelly using MQTT doesn't work

Hi,
I want to integrate Shelly with Home Assistant using MQTT.
I have already installed the mosquito broker in Hassio and configured the same IP in the shelly switch under mqtt.

I have also added this in the configuration.yaml:

  • platform: mqtt
    name: “Shelly Ch1”
    state_topic: “shellies/shellyswitch25-7404BF/relay/0”
    command_topic: “shellies/shellyswitch25-7404BC/relay/0/command”
    payload_on: “on”
    payload_off: “off”
    state_on: “on”
    state_off: “off”
    optimistic: false
    qos: 0
    retain: true

When going to “integration” in HA, there is, however, no shelly device listed. So auto detection doesn’t seem to work. :frowning: Is there a specfic command I have to add additionally in the config file?

You need some diagnostics here mate. Grab MQTT Explorer it is free and a bit good. There are several other MQTT subscribers, including mosquitto_sub but ME is my favourite. MQTT.fx is pretty good as well. Take your pick.

Once you know what is being said, you have a chance of fixing it. At the moment you are in a room full of chat in a foreign language, most of it is inaudible!

I don’t know whether it will help but your state and command topics do not start with / and they might have to.

I’ve already been running MQTT Explorer to check if everything is working and yes, the Shelly is showing up fine and also showing the correct states.

Is there anything specific I have to look for in MQTT Explorer?

Cool but you didn’t mention that you can see the MQTT messages - we are not mind readers here.

So when you say that the Shelly turns up fine, does it match char for char what the docs mention or perhaps you might want to browse the code (Github) to glean for clues.

It’s rather late now here. I’ll try to have a quick look tomoz.

sorry for not mentioning it. It was rather late here too and I was trying the whole day to get mqtt to work so I forgot this detail :slight_smile:
Here is a screenshot of the messages which seem fine to me.

You can use Shellies Discovery script Shellies Discovery Script

I’ve already tried it out but unfortunately I did not get it work so I’ve hoped that using the manual way would be easier to get it to work. I’ve written in your topic what I did with the script, maybe you can spot the error. :slight_smile:

I use a couple of Shelly 2.5 as rolling shutter.
The MQTT topics is a little bit different of course because of the shutter functionality anyway it looks compatible with yours configuration.
Did you try to raise the QOS to 1 just to be sure that the MQTT messagings was correctly delivered?

I’ve just tried using 1 instead of 0 for QOS in Shelly config but it did not make a different. It still won’t show up in HA :frowning:

You should use 1 in both Shelly and HA configuration otherwise HA still uses its one configuration.
In that way looking at the MQTT log you should see the aknowledge packets too.

I’ve now also added QOS 1 in the configuration under the switch but it doesn’t make a difference…

I have HA installed on a “regular” Raspberry Pi without Hassio.
My MQTT entities are not listed in configuration->integration->MQTT but I find them with the name: given in the configuration in developers Tools → states. So you should look something called <something>.Shelly_Ch1 there or just trying to configure a new UI card browsing the list looking for that name.

Thank you! you were right they don’t show up in configuration->integration->MQTT but they can be directly addressed by the name.

I wonder, however, how to get them to show up in configuration->integration->MQTT . I would like ton configure them and assign to areas.

1 Like

Good evening, I am replacing the sonoffs with shellys for the lights at home command, I have a raspberry with hassio installed and mqtt controller, I have big problems with the mqtt, the devices are are random disconnected with this sentence:

Client shelly1-BA6437 has exceeded timeout

moreover, even the sonoffs that are currently still installed give the same problems. Before the replacement, everything went really smooth. Ideas ??:face_with_raised_eyebrow::face_with_raised_eyebrow:

Did this ever get resolved?