Shellies Discovery Script

No, the script automatically detects all supported Shelly models. You can run the Shellies Announce automation manually once again. If this doesn’t help, send me the shellies/announce topics sent by your Shellies2.5.

Got it all working, turns out it was an MQTT disconnect from the Shelly2.5. Thanks for your help!

Can you confirm if the overtemperature sensor works?

Overtemperature seems to almost work.
I updated your script and send an MQTT message with announce to shellies/command which added the sensor to Home Assistant, but it’s greyed out as “not available”.

Any idea what I could check?

The shelly is sending the overtemperature MQTT message like this:

topic: shellies/shelly1pm-XXXXXX/overtemperature
message: 0

The state of the sensor is not available or unknown? Could you check that the payload for overtemperature topic is string or integer?

The overtemperature sensor is there, it’s reporting normal. Not sure what it would report otherwise and if there’s a good way to test it though.

1 Like

The state was unavailable… I shouldn’t translate myself and just switch the interface language.
After an restart Home Assistant… both sensors (1PM and 2.5) are now reporting as expected. :slight_smile:

1 Like

hi @Bieniu

I have used your script to integrate my shelly 1pm. However I have not added the id and mac as you have suggested in your OP.

I have managed to get it on my HA but all the shelly related items are coming up as unavailable.

Am I doing something wrong or?

Many thanks.

Also how do I get my ID and MAC of my shelly1pm?

@bachoo786 You have to add to your automations.yaml file exactly automations like in OP. You don’t have to know MAC and ID of your Shelly.

I have done that and I get my shelly all integrated in mqtt but if I restart my HA, it says unavailable if I restart it HA again it becomes available. It’s very flaky I am not sure why

It’s completely normal. When the Shellies Announce automation is started for the first time, the device is integrated with the HA, at the second start of automation device is checked for availability. This happens only after installing the script.

I am afraid mine doesn’t work the way you described

How does it work in your case?

So if I reboot my HA it would appear as it’s working with all the entities appearing correctly. However if I was to reboot my HA again it would say unavailable just like now see below:

I am running HA in docker as well as my mqtt. I have done a chmod -R 777 to your python script as well.

I think I know the problem

The automation needs to contain initial_state: 'on' so that everytime it HA restarts the script runs automatically.

On a different note do you get your shelly dropping wifi ? My shelly 1pm mosy of the time drops wifi for 30second to a minute before reconnecting to the internet. I have reset the shelly but experience the same problem

Yes, the Shellies Announce automation must always be run at the start of HA. Do you turn it off manually? HA shouldn’t turn it off. You can use initial_state: 'on' to be sure that automation will be run every HA start.

I have Shelly1 and Shelly2 and they never disconnect from the WiFi network.

yes I have added initial_state: 'on' and it works fine now.

my only criticism of shelly is that it drops wifi occasionally which is annoying. The distance between the router and the shelly is less than 5 meters.

how did you set your shelly up once you wired and installed it ?

also I have this entity from your script discovery Shelly1PM 60971A Energy 0 but the levels are always 0. Do you know if this is supported in your script or in shelly pm1?

When the energy meter will be greater than 0 then the value of the sensor will be greater than 0. The sensor displays the value in kWh, so some energy consumption is needed to display anything greater than 0. You have to remember that the Shelly restart causes the energy meter to be reset.