Shellies Discovery Script

New version: 0.8.1

Changelog:

  • fix temperature sensor for Shelly1PM and Shelly2.5

You have to enable Retain option in Shelly WWW panel.

Hello Bieniu,

First of all, congrats on the great job.

Iā€™m wondering if you are going to support new_fw as a sensor, and update_fw as an action.

That would be really great!

Thanks for kind words.
Currently, topic shellies/announce isnā€™t sent periodically. The sensor would be very rarely updated. I wrote on FB Shelly support group a request to periodically sending announce topic www.facebook.com/groups/1686781668087857/

1 Like

New version: 0.8.2

Changelog:

  • add power as device_class for power and energy sensors (HA 0.92)

New version: 0.8.3

Changelog:

  • fix set topic for Shelly RGBW2

As this thread seems to be frequently visited by Shelly users, I just wanted to share a small security information regarding some of the newer Shelly 2.5:

There is the possibility for a short circuit, because the antenna isnā€™t properly built in!

Here is a news thread from the german wholesaler, CreationX.

For Germany, CreationX is changing the Shellys, even if they are not bought from them. In other countries Iā€™d suggest taking a closer look to your Shelly 2.5 and, if necessary, write an email to the Shelly guys in Bulgaria - they are very friendly!

Thank you for your great and big work. Iā€™d 3 shelly 2.5 as roller shutters, then Iā€™d put in the automations the 3 sentences as below:
shellyswitch25-XXXXXX-relay-0: ā€˜coverā€™
shellyswitch25-XXXXXX-relay-0: ā€˜coverā€™
shellyswitch25-XXXXXX-relay-0: ā€˜coverā€™
but when iā€™d execute the script it has discovered all lights (shelly 1 as light) and all Shelly 2.5 sensors but no Shelly 2.5 cover or Relays.
Iā€™d not error in system log.
Can you help me please?

Iā€™m answer myself hoping that can be useful for others, for shelly 2.5 the roller function should be indicated with roller instead with relay, so:
shellyswitch25-XXXXXX-roller-0: ā€˜coverā€™
shellyswitch25-XXXXXX-roller-0: ā€˜coverā€™
shellyswitch25-XXXXXX-roller-0: ā€˜coverā€™

and it will be perfect

Yes, I have mistake in documentation. Sorry for that.

New version: 0.8.4

Changelog:

  • fix documentation for roller mode

Maybe there is some wrong in roller shutter configuration, because I see that the energy and power sensors are always in unknown state, temperature sensor show correct value, overtemperature sensor isnā€™t discovered.
Following the topics from the MQTT.fx:
shellies/shellyswitch25-XXXXXX/overtemperature
shellies/shellyswitch25-XXXXXX/relay/energy
shellies/shellyswitch25-XXXXXX/relay/power

@gomez85 Do you have latest firmware in your Shelly2.5 (1.4.9 hotfix 3)? https://m.facebook.com/groups/1686781668087857?view=permalink&id=2038468692919151

There is no information about overtemperature sensor. I donā€™t know that this is binary sensor (value 1/0) or numeric sensor.

Yes, Iā€™d the last formware as requested.

For overtemperature i think that is a binary sensor beacause it will indicate only if the state is over temperature or not

New version: 0.8.5

Changelog:

  • fix energy/power topics for Shelly2.5 in roller mode

Are you sure? Each other binary sensor from Shellies (smoke, motion) uses true/false payload.

New version: 0.8.6

Changelog:

  • add overtemperature binary sensor for Shelly2.5 and Shelly1PM (experimental)

Please anyone with Shelly2.5/Shelly1PM to write feedback whether overtemperature sensor is working.

Ok, I may be totally clueless here, Iā€™ve never done anything with the python scripts, but Iā€™m having no success getting the discovery script to work. Is there step by step approach anywhere?

Iā€™ll be happy to verify Shelly 2.5/Shelly1PM info if I can get them working via discovery.

1 Like
  1. Add python_script: to configuration.yaml file
  2. Add shellies_discovery.py file to HA_CONFIG/python_scripts directory
  3. Add to automations.yaml file these automations:
- id: shellies_announce
  alias: 'Shellies Announce'
  trigger:
    - platform: homeassistant
      event: start
  action:
    service: mqtt.publish
    data:
      topic: shellies/command
      payload: announce

- id: 'shellies_discovery'
  alias: 'Shellies Discovery'
  trigger:
  - platform: mqtt
    topic: shellies/announce
  action:
    service: python_script.shellies_discovery
    data_template:
      id: '{{ trigger.payload_json.id }}'
      mac: '{{ trigger.payload_json.mac }}'
      fw_ver: '{{ trigger.payload_json.fw_ver }}'
  1. Check config and restart HA

Well that did it. It picked up all three Shelly1s but didnā€™t grab the Shelly 2.5 anything that would need to be done differently there?