Shellies Discovery Script

Shellies Discovery is a script for python_script component. This component imposes huge restrictions, therefore only config topics can be removed from the broker by the script.

@truglodite Maybe we should take this into another thread, as it is more a mqtt-remove problem in general, than a shelly-discovery problem.

I found an older thread, with a guide to remove mqtt entries, here it is: [Guide] How to remove MQTT entity from Zigbee2mqtt, Mosquitto broker and Home Assisntant

I agree this isn’t really related to the shellies discovery script, and actually it isn’t related to mqtt removal either (I already read those threads and knew how to do it). If anything, this would be better in a shelly dimmer thread, due to the settings not sticking until after reboot problem that resulted in issues with the usual mqtt removal methods.

Hi.
After the last update I kepp getting this in the log.
Can you tell whats wrong or do I need to activate debug logger ?

Exception in discovery_callback when dispatching 'mqtt_discovery_updated_('binary_sensor', 'shellyswitch25-*******-overtemperature')': ({'name': 'Shelly2.5 ***** Overtemperature', 'state_topic': 'shellies/shellyswitch25-********/overtemperature', 'payload_on': '1', 'payload_off': '0', 'availability_topic': 'shellies/shellyswitch25-*********/online', 'payload_available': 'true', 'payload_not_available': 'false', 'device_class': 'heat', 'unique_id': 'shellyswitch25-**********-overtemperature', 'qos': '0', 'device': {'identifiers': ['******'], 'name': 'Shelly2.5 *******', 'model': 'Shelly2.5', 'sw_version': '20200309-104051/v1.6.0@43056d58', 'manufacturer': 'Allterco Robotics'}, 'platform': 'mqtt'},)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/mqtt/__init__.py", line 1186, in discovery_callback
    payload.pop(ATTR_DISCOVERY_HASH)
KeyError: 'discovery_hash'

It seems that this error isn’t related to Shellies Discovery. You can turn on debug and post the log here. Maybe I will find something that help you.

When I run the script it adds my shelly 2.5 as a relay. How can i force the script to add my shelly 2.5 as a cover?
The Shelly1PM and Dimmer work perfectly with this script

Please read the docs https://github.com/bieniu/ha-shellies-discovery/blob/master/README.md#arguments-for-shelly25

Hello,

I’m new to HA and MQTT and I have some problems with shelly working via MQTT.

First problem:
Discovery script don’t work. I make everything as described in instructions.

  • Installed shellies_discovery.py to python_scripts folder and add python_script: to configuration.yaml.
  • Add minimal configuration to automation.yaml
  • Configure shelly to mqtt:
  • Configure mosquitto broker:

In mosquitto broker LOG I can see that shelly is comunicating with broker:
“1586091984: New connection from 192.168.1.61 on port 1883.
1586091984: New client connected from 192.168.1.61 as shelly1-B9FACE (p2, c1, k60).”

  • Restart several times and there is NO shellies in integration.

Second problem:
I also tried manual adding shellies with code:

 - platform: mqtt
    name: "Kitchen Light mqtt"
    state_topic: "shellies/shelly1-B9FACE/relay/0"
    command_topic: "shellies/shelly1-B9FACE/relay/0/command"
    payload_on: "ON"
    payload_off: "OFF"
    state_on: "ON"
    state_off: "OFF"
    retain: false
    optimistic: false

After that I can add a button, but it is always OFF. Even if I press ON via button or via HA the button goes automaticaly back to OFF. The light didn’t turn ON.

With REST api everything work, but I want to MQTT start working.

What I am doing wrong?

Thanks.

Turn on debug for the python_script component and show me a log.

I put log on wetrransfer: https://we.tl/t-rH7uxpJ5oT

thx

Hello,

Please forgive me if this has been covered before. I tried to search but was not successful in finding answers.

I am using this amazing script and it is discovering all my devices. I am using a Shelly 1 for my garage doors and I have attached reed switches to them in hopes of detecting open/close states.

My confusion is how to use the information this script provides to create a card to display the open/close state. Any help would be appreciated.

Thank you

There is no information about running the Shellies Discovery script in your log.

Does Shelly1 support reed switches at all?

They do. Here is a url that has a guide that I was following in case it may help. https://www.sweharris.org/post/2019-05-19-garage/

Nie znałem tego rozwiązania. Nie znam żadnej karty frontendowej, która pokazywałaby taką konfigurację.

I don’t know what is wrong?

I put this to configuration.yaml:

logger:
  logs:
    homeassistant.components.python_script: debug

python_script:

Now I run both automation manualy in automation and there is a log file: https://we.tl/t-VlBVnNnwrc

Thx
David

Still nothing. You can’t run shellies_discovery script manually. Change logger default level to warning because the log is totally unreadable! Look at the troubleshooting checklist. Check if automations are turned on. Is there a service mqtt.publish in the developer options?

Changed loger default setings to warning and now it is only this in LOG file:

"
2020-04-06 16:02:19 WARNING (MainThread) [homeassistant.components.mqtt] Data in your configuration entry is going to override your configuration.yaml: {‘broker’: ‘core-mosquitto’, ‘discovery’: False, ‘password’: ‘rei5Ieg0QuaeRien2pe1ThooBei5woh2oolo9phai0teag4Jie3Aethaetheefie’, ‘port’: 1883, ‘protocol’: ‘3.1.1’, ‘username’: ‘homeassistant’}
2020-04-06 16:02:30 WARNING (MainThread) [homeassistant.components.switch] Setup of switch platform rest is taking over 10 seconds.
2020-04-06 16:02:30 ERROR (MainThread) [homeassistant.components.rest.switch] No route to resource/endpoint: http://192.168.86.51/relay/1
"

I checked everything in troubleshooting list and everything is as writen.
Automation in ON at both Shellies Anounce and Shellies discovery.
mqtt.publish is in developer options.

In LOG file I see this “‘broker’: ‘core-mosquitto’, ‘discovery’: False”. Is this a problem?

I have this configuration and discovery is included:

discovery:
mqtt:
    broker: 192.168.1.138
    port: 1883
    discovery: true
    discovery_prefix: homeassistant

logger:
  default: warning
  logs:
    homeassistant.components.python_script: debug

Yes, discovery is required.

Continuing the discussion from Shellies Discovery Script:

Is it possible to change on the HT battery with external power supply? I have two USB powered ones but I see 100% grace