Shellies Discovery Script

Look here https://github.com/bieniu/ha-shellies-discovery#minimal-configuration

1 Like

Hi!

I have the script working for 2 Shelly i3, a Shelly 2.5 and a H&T. I struggle to get the Shelly Button 1 to work though, even though I have the same settings applied and I am seeing input events in MQTT explorer.
The button is not discovered.
What can I do?

Kind regards,

Pete

Hi!

I remember you mentioning somewhere that the IP address (sent in the mqtt info topic) is not possible to display @ the device info page. Could you please explain me why not? (Like explaining it to a child:))

Thanks

HA frontend doesn’t support this.

1 Like

Show me debug log.

Thanks! Happy New Year!

1 Like

Mmh… strange… I’m seeing this:

Firmware dated 20201124 is required, please update your device homeassistant/shellybt1_02

The button itself does not show an available firmware update however:

Current version: 20201029-170348/v1.9.0@85c87178
You have latest version on your device! 

Current firmware for Shelly Button1 is 20201228-092628/v1.9.3@ad2bb4e3

Open this URL in the browser:

http://<deviceIP>/ota?url=http://repo.shelly.cloud/firmware/SHBTN-1.zip

Mmmh…
doing exactly that it comes back with

{"status":"updating","has_update":false,"new_version":"","old_version":"20201029-170348/v1.9.0@85c87178"}

And nothing is happening… Am I doing something wrong?

Strange, maybe ask for help on Shelly Support Group on FB?

It takes some time to update. Probably now it is already updated to 1.9.3. check in webgui

My Button reports as SHBTN-2 in /settings, so I tried updating it with /firmware/SHBTN-2.zip instead of SHBTN-1. Since that didn’t work, I used the beta from /firmware/rc/, which now seemed to have worked.

The button doesn’t show up in HA however, here is the latest log:

2021-01-02 12:47:26 INFO (MainThread) [homeassistant.components.automation.shellies_discovery] Shellies Discovery: Running automation actions
2021-01-02 12:47:26 INFO (MainThread) [homeassistant.components.automation.shellies_discovery] Shellies Discovery: Executing step call service
2021-01-02 12:47:26 INFO (SyncWorker_9) [homeassistant.components.python_script] Executing shellies_discovery.py: {'id': 'homeassistant/shellybt1_02', 'mac': 'somemac', 'fw_ver': '20201223-093914/v1.9.3-rc5@3f583801', 'model': 'SHBTN-2'}
2021-01-02 12:47:26 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] id: homeassistant/shellybt1_02, mac: somemac, fw_ver: 20201223-093914/v1.9.3-rc5@3f583801, model: SHBTN-2

I have a second button with the same behaviour, I updated that one to 20201228-092700/v1.9.3@ad2bb4e3 (which seems to be more recent than the RC). But also the same:

2021-01-02 12:57:32 INFO (MainThread) [homeassistant.components.automation.shellies_discovery] Shellies Discovery: Running automation actions
2021-01-02 12:57:32 INFO (MainThread) [homeassistant.components.automation.shellies_discovery] Shellies Discovery: Executing step call service
2021-01-02 12:57:32 INFO (SyncWorker_11) [homeassistant.components.python_script] Executing shellies_discovery.py: {'id': 'homeassistant/shellybt1_01', 'mac': 'somemac', 'fw_ver': '20201228-092700/v1.9.3@ad2bb4e3', 'model': 'SHBTN-2'}
2021-01-02 12:57:32 DEBUG (SyncWorker_11) [homeassistant.components.python_script.shellies_discovery.py] id: homeassistant/shellybt1_01, mac: somemac, fw_ver: 20201228-092700/v1.9.3@ad2bb4e3, model: SHBTN-2

Could you show me topics/payloads from this device? You can use MQTT-Explorer for that.

Is this the right stuff? I’m quite new to the whole MQTT world…

shellies/homeassistant/shellybt1_01
online = true
announce = {"id":"homeassistant/shellybt1_01","model":"SHBTN-2","mac":"somemac","ip":"someip","new_fw":false,"fw_ver":"20201228-092700/v1.9.3@ad2bb4e3"}
sensor
battery = 100
charger = true
error = 0
act_reasons = []
input_event
0 = {"event":"S","event_cnt":1}
info = {"wifi_sta":{"connected":true,"ssid":"somessid","ip":"someip","rssi":-51},"cloud":{"enabled":false,"connected":false},"mqtt":{"connected":true},"time":"","unixtime":0,"serial":2,"has_update":false,"mac":"somemac","cfg_changed_cnt":0,"actions_stats":{"skipped":0},"inputs":[{"input":0,"event":"","event_cnt":0}], "is_valid":true,"bat":{"value":100,"voltage":4.24},"charger":true,"act_reasons":["ext_power"],"connect_retries":0,"update":{"status":"unknown","has_update":false,"new_version":"","old_version":"20201228-092700/v1.9.3@ad2bb4e3"},"ram_total":51256,"ram_free":40440,"fs_size":233681,"fs_free":159134,"uptime":10394}

(somemac, somessid and someip are my changes)

1 Like

New version: 0.36.0

Changelog:

  • add support for SHBTN-2 ( Shelly Button1 hardware version 2)
  • add charger and rssi sensors for Shelly Motion
  • add charger , ip , rssi , ssid , uptime sensors for Shelly Button1
  • add powered option for Shelly Motion , Shelly Sense and Shelly Button1

Look here https://github.com/bieniu/ha-shellies-discovery/releases/tag/0.36.0

Very cool, thanks a lot! I’ll try it out this afternoon and let you know how it went.

I am happy to report: It works!
Again, thank you very much!

@Bieniu Thanks so much for the fantastic script! It has worked perfectly for me for months now.

I was curious to see if you had been tracking the work on the new Tasmota Integration? Looks like that integration laid the ground work for other components that rely on MQTT for communication, but have a component for device discovery.

Hopefully it means that going forward scripts like this won’t be necessary for new MQTT device manufacturers, and instead an official component can be built. Was just curious to hear your opinion on it!