Shellies Discovery Script

You can use this site http://archive.shelly-tools.de/ to update the firmware.

Hi Bieniu, thank you for the reply; I unfortunately tried that several times (including downgrading) and it was not working.

I figured out what my problem was - I didn’t realize I needed to enable cloud access to update the firmware and then could turn off cloud access after use the MQTT discovery script to keep everything local.

I hope this helps someone else with their troubleshooting. Thanks again!

1 Like

Gen2 devices script preview: GitHub - bieniu/ha-shellies-discovery-gen2

Work in progress so use with caution!

1 Like

Still no luck with TRV discovery… the only discovery was the entity of new FW update… but thinking that this has no relate to this script but to original shelly discovery…

Sorry I don’t understand. Please post a debug log if you need help.

First release of Shellies Discovery Gen2 is available here GitHub - bieniu/ha-shellies-discovery-gen2

Community thread: Shellies Discovery Gen2 Script

Dear all,

in an effort to improve my home assistant set-up, among other things I renamed all devices. The naming convention contains a dash, which does not work well with Your script.

Is there a way to use the Shelly device name in all length as the entity ID? If so how?

For example: Shelly device name 15-02-Blinds-WindowLeft (set on the device itself) should translate to cover.15_02_blinds_windowleft. And with it all related entities.

Is this something you can help with?

It’s not possible. Only MQTT prefix is using by the script.

1 Like

Actually, custom MQTT prefix is set identically.
Unfortunately, Your script only picks up the last portion of the prefix to give it an ID.

MQTT-topics are like:
Shellies/15-01-Blind-Window

With Shelly Discovery scripts IDs in home assistant become:
cover.shelly_2_5_window

I would like to have cover.15_01_blind_window as device ID in home assistant such that all the entities use this as a prefix.

Is that possible?

I have 2 shellies 1 switch and only one is found by the HA shelly integration. This is the one connect to the wifi of my modem. The other one is in the garage and i am using a power plug wifi accesspoint.
I can connect to both by ip address. I was hoping your addon would solve this problem but it’s not found. I added python_script: to my configuration.yaml and shellies_discovery.py file in config/python_scripts folder.

This is my automation:

- id: '1643542991448'
  alias: Shelly Discovery
  description: ''
  trigger:
  - platform: homeassistant
    event: start
  condition: []
  action:
  - service: mqtt.publish
    data:
      payload: announce
      topic: shellies/command
- id: '1643544074521'
  alias: Shellies Discovery
  trigger:
  - platform: mqtt
    topic: shellies/announce
  action:
  - service: python_script.shellies_discovery
    data:
      id: '{{ trigger.payload_json.id }}'
      mac: '{{ trigger.payload_json.mac }}'
      fw_ver: '{{ trigger.payload_json.fw_ver }}'

Your automation is not up-to-date.

Yes, this limitation is related to Shelly ID (it contains - sign).

You can use device_name parameter or try to convince the Shelly team to send device/channel name in the announce topic payload.

Can you tell me what’s wrong in the automation code?

Dziękuje bardzo!

I will give device_name parameter a try.

@Bieniu
Feedback: The approach works for me. The entity IDs appear in a way how I would want them to be.

My configuration takes place in an automations.yaml file, is it somehow possible to externalize the config itself? I’m referring to the part that follows after the comment:

- id: 'shellies_discovery'
  alias: 'Shellies Discovery'
  mode: queued
  max: 999
  trigger:
    platform: mqtt
    topic: shellies/announce
  action:
    service: python_script.shellies_discovery
    data:
      id: '{{ trigger.payload_json.id }}'
      mac: '{{ trigger.payload_json.mac }}'
      fw_ver: '{{ trigger.payload_json.fw_ver }}'
      model: '{{ trigger.payload_json.model }}'
      mode: '{{ trigger.payload_json.mode | default }}'
      host: '{{ trigger.payload_json.ip }}'
      # Following allows for setting the device's entity ID in HA as per naming convention
      03-02-Licht-Decke:
        device_name: "03-02-Licht-Decke"
      13-01-Raffstore-FensterLinks:
        device_name: "13-01-Raffstore-FensterLinks"
      13-02-Raffstore-FensterRechts:
        device_name: "13-02-Raffstore-FensterRechts"
      ...

Some include-statement or something similar?

Where do you find the newest firmware ?
My shelly Plug S all said they had the newest firmware availible.
20190516-073020/master@ea1b23db
but the Discovery script Claimed I needed 220126 version
So I searched, and ended up at http://archive.shelly-tools.de/
There I find v 1.11.7, which seems to be the newest (but strange sorting on the version list)
I’ve upgraded 2 of my 4 devices, but the Discovery script still claims I need a newer firmware. Looking through the code, it seems I need version 1.11.8-rc2. But that one is not available from archive.shelly-tools.de, nor from shelly.cloud, where the newest version is 1.9

I Tried now to enable Cloud integration, and now it found version 1.11.7 on one of the plugs that I hadn’t already upgraded using archive.shelly-tools.de

Still unsure what to do.

Finally it’s working. There is one thing i can’t figure out. I have one Shelly in the garage connected to a wifi booster plug. It does not connect in the garage, but in the livingroom connected directly to my modem/router there is no problem at all. This is in my log:

Cannot connect to host 192.168.178.38:80 ssl:default [Connect call failed (‘192.168.178.38’, 80)

Why are you using the script from the master branch and not from the release?

Master branch contains the code with changes related to firmware that is available only for Shelly QA group.

The script uses only MQTT so this error is not related.