Shellies Discovery Script

Installation went fine and my shellies are showing in the devices. I’m using the client MQTT integration and wonder if you use that or rely on manual HA configuration. Are there any downsides in using the integration? I’m still at the early stages of redoing HA so kicking out the MQTT integration can be best done from the start I guess.

You have to test both ways of integration and decide for yourself what is better for you. I use MQTT because with CoAP (native HA integration uses this) I have occasional delays when turning the lights on/off and my wife complained about it. Besides, currently native integration has limitations on battery-powered devices - these limitations will be removed in a month or two.

When using the MQTT integration with discovery enabled do I need to setup the automations.yaml file? Without it I noticed the shiellies were found. Of what I understand the MQTT integration is quite new and therefore a lot of howto’s describe the manual way.

I don’t understand what you mean. MQTT integration with discovery? For Shelly? There is no such thing.

I explained that completely wrong. I’m using the integration for zigbee2mqtt and zwave2mqtt. After I added your script to python_scripts I noticed the 2 Shelly plugs showed up in devices. So I wondered what the automations.yaml is for. But only after adding the automations.yaml they actually gave info. So, I kinda answered my own question I guess :wink: Anyways thanks a lot for your hard work. Really happy with it!

1 Like

shellies_discovery automation catches the announce topic from the Shelly device and calls the shellies_discovery.py script. Without this automation, new devices will not be discovered.
shellies_announce automation helps in determining availability of Shelly devices after HA restart and forces refreshing state of sensors from topic info.

Hello.

Running version 0.37.0 on HA core-2021.1.5. I installed a Shelly 1 + temperature addon + 1xDS18B20.

The discovery script did add the shelly without a problem but did not add the temperature sensor automatically. I added it manually now by adding this to the config.yaml.

sensor:
  - platform: mqtt
    name: "Office Temperature"
    state_topic: "shellies/OfficeThermostat/ext_temperature/0"
    unit_of_measurement: '°C'

I hope this helps to improve the script even more. Other than this it has been working like a charm for me so far.

Cheers,
Patric

Did you add sensor to the script configuration?

Hello Bieniu,

I did not to be honest. The automations are pretty much default and I think I found what was missing.

You are talking about this part, right?

      shelly1-AABB9900:
        relay-0: "light"
        ext-temperature-0: true
        ext-temperature-1: true
        ext-temperature-2: true
        force_update_sensors: true

Which for me would just include the temp-0 since I only have 1 sensor right now on the shelly1.

If this is the wrong direction I might need a pointer to the right one.

Cheers,
Patric

Yes, you need:

ext-temperature-0: true

Then the last and most likely stupid question. Where do I get the shelly1-AABB9900: part from? I tried the mqtt name, shelly1- and in the /settings nothing else looks like something I might want to use for that.

You are using custom prefix so

It’s the last part of the device’s MAC address.

Greetings!

Thank you guys for the pointers back to the start. The customer topic was my first attempt but it did not work. The reason was however, at least I think it was, the manually added sensor in my configuration.yaml, that was subscribed to the same topic. Once i had that one removed everything worked like a charm.

Happy to have learned something new again and also happy about a very friendly and helpful community here.

Cheers,
Patric

1 Like

I’ve opened a feature request on the Allterco GitLab server to add information about external sensors to the announce topic, so it may not be necessary to add a sensor to the script configuration in the future.

1 Like

I tried to install your script using HACS, but I’m getting following error:
2021-02-02 20:44:18 ERROR (MainThread) [homeassistant] Error doing job: SSL error in data received
Traceback (most recent call last):
File “/usr/lib/python3.7/asyncio/sslproto.py”, line 526, in data_received
ssldata, appdata = self._sslpipe.feed_ssldata(data)
File “/usr/lib/python3.7/asyncio/sslproto.py”, line 207, in feed_ssldata
self._sslobj.unwrap()
File “/usr/lib/python3.7/ssl.py”, line 767, in unwrap
return self._sslobj.shutdown()
ssl.SSLError: [SSL: KRB5_S_INIT] application data after close notify (_ssl.c:2609)
2021-02-02 20:44:18 ERROR (MainThread) [custom_components.hacs] Could not use repository with ID 194319685 (‘HacsPythonScript’ object has no attribute ‘errors’)

Any thoughts on what might be wrong?

Instead of going through HACS, I installed it manually and everything works fine.

1 Like

Hello,

I have 2 Shelly Button 1’s and have them integrated using with the Discovery script.
I want to trigger a fan using an automation:

grafik

I have the Buttons on battery power, not USB-plugged in.
In order for the automation to trigger, I currently need to push the button twice, although I get
a green light on the ring after the first press too.

Do you know what might cause this behaviour?

Regards,
Pete

No
Show me please MQTT topics/payloads at the press of a button and YAML code for this automation.

Hi,

wehen trying to add your repo as custom respository in HA (using HACS) I’ve got the following error:
Repostitory structure for 0.37.0 is not compliant

Do you know whats wrong here?