Shellies Discovery Script

I know this, but I need to change everything on that (relay_0, relay_1, longpush, etc). Also, it’s not clear for me: if I change this, the discovery script will not add it again ?

Changing friendly name and entity ID is key feature of entity registry and script is compatible with that.

1 Like

What is the exact procedure of changing type of device?
After initial recognition my shellies1 have been added as switches. Now I would like to change them to lights.
I modified automation adding required lines to change domain but nothing changed (I expected it can’t without an additional action but have not idea what now)

Thanks in advance

Restart HA.

Thanks for the answer.
Pity because I attempted to use your Discovery component in order to avoid HA restarts.
BTW is there a way how to remove single entity from your integration?
I tried Configuration/Entities but it removing attempt does nothing

First I want to thank Bieniu for sharing his excellent script!

I am using it with some shelly dimmers, and everything is working fine for the most part. However, it appears there is no input configured for the dimmer in the script? I tried copying what looked like the necessary parts from the shelly 1pm entry (added the 2 “relays_bin…” lines) to my script but it didn’t seem to work:


if id.rsplit("-", 1)[0] == "shellydimmer":
    model = ATTR_MODEL_SHELLYDIMMER
    white_lights = 1
    sensors = [ATTR_TEMPERATURE]
    sensors_classes = [ATTR_TEMPERATURE]
    sensors_units = [ATTR_UNIT_CELSIUS]
    sensors_tpls = [ATTR_TPL_TEMPERATURE]
    bin_sensors = [ATTR_OVERTEMPERATURE, ATTR_OVERLOAD, ATTR_LOADERROR]
    bin_sensors_classes = [ATTR_HEAT, ATTR_POWER, ATTR_PROBLEM]
    bin_sensors_pl = [ATTR_1_0_PL, ATTR_1_0_PL, ATTR_1_0_PL]
    relays_bin_sensors = [ATTR_INPUT, ATTR_LONGPUSH]
    relays_bin_sensors_pl = [ATTR_1_0_PL, ATTR_1_0_PL]
    lights_sensors = [ATTR_POWER]
    lights_sensors_units = [ATTR_UNIT_W]
    lights_sensors_classes = [ATTR_POWER]
    lights_sensors_tpls = [ATTR_TPL_POWER]

After rebooting, still no shelly switch input binary sensor is discovered. It looks like the input is broken out for the shelly 1pm and other relay devices. Has anyone gotten the inputs from their shelly dimmer to be discovered using this script? I don’t mind helping contribute, but I figured I’d ask in case someone else has a solution handy, before I study the dimmer api etc…

edit: Just scanned over the api for the dimmer, and yep I guess there is no direct bin_sensor to access that way. Can this be done by using the “settings/light/0/btn1_on_url” shelly settings?

edit^2: NM, I found a solution in a reddit I googled up… I used a nodered http endpoint node to process the get from the shelly ‘url when on’ setting. As a bonus I created an input boolean so HA can show the input switch state (updated in nodered via service call).

It seems crazy shelly decided not to break out the input attributes in mqtt like they did on their other devices, and instead rely on a get request to use the input status. I don’t know much python, but it seems some form of discovery can be semi-automated for the shelly dimmer inputs. I’m thinking something like ha auto configures the shelly url using the shelly api (shelly ip and credentials in config… hence semi-automatic), then whatever else to get the binary sensor integrated in ha using rest api?

I can’t help you without any information about configuration and without your log.

It’s not “my integration”. It’s MQTT integration. My script is only the bridge between Shellies and MQTT integration in HA. To remove discovered MQTT entity you have to remove retained configuration topic for this entity from the MQTT broker and restart HA.

This script uses only MQTT. If Dimmer doesn’t send input topic the script will not add sensor for it. You can write to the Shelly support in this case.

1 Like

New version: 0.16.0b0

Changelog:

  • add support for Shelly DUO

Hi,
your Script seems amazing :slight_smile:
But unfortunately when I try to install using the integration I have this popup ad I don’t know what I have to enter

:face_with_raised_eyebrow:

Shellies Discovery is not a integration. You can install the script using HACS.

New version: 0.16.0

Changelog:

  • add support for Shelly 3EM
  • add experimental support for Shelly DUO ( white color temperature control doesn’t work)
  • fix config topics for Shelly EM meters’ power and energy sensors
1 Like

This script is fantastic!
Thank you for your work!
I have only one very beginner question:
What if I need to override the settings of a shelly?
Can I exclude it from discovery somehow?

@Bieniu Thanks for your script!

I have a Shelly Dimmer, and I added it using your script. I am missing both the inputs of the shelly dimmer.

With MQTT Explorer, I get the following:


The input topic only appears after changing the value.

I get the following device after your discovery automation:

Can you add the input topic, or do you need more information about it? Anything I can provide you?

What these input topics mean? Dimmer has one relay but it sends two input topics?

No, all Shelly devices will be discovered. You can fill up feature requests on GitHub.

New version: 0.16.1

Changelog:

  • add input binary sensors for Shelly Dimmer
1 Like

image
I copied this image from the shelly website.

The inputs can be used to detect a switch, or in my case: a motion detector.

The shelly sends the state of the input to MQTT.

Look at one post above :wink:

1 Like

Thanks!
Time for coffee for me…

1 Like