Shellies Discovery Script

Yes. Thats the problem. I hit your link to the python_script documentation but there it only shows how to use the “python_script” but not how to find it or install it.

Are you sure?
Read first line https://www.home-assistant.io/integrations/python_script/#writing-your-first-script

Where is <config> and where is configuration.yaml? I looked on my HA server in the /etc directory and found nothing… As you can see, I am totally lost.

You should read this https://www.home-assistant.io/getting-started/configuration/

Wow. Thanks. Now I’m finally getting somewhere.

Is there a way to change a switch entity (relay) into a light entity?

Yes, light or fan.

Great. Can you point me in the right direction?
Tried to change the device class via UI customization, but only get the options for outlet and switch.

Please read the documentation.

Ok. Thanks to your help I’ve installed shellies_discovery.py and the minimal config into configuration.yaml and restarted twice. I also installed the logging. I see nothing. What should I do to detect my Shelly Button? The shelly button is setup for the correct mqtt server and such.

Alright, now i got it. Will need to change the value in the discovery automation.
Thank you! Must have read over.

1 Like


Ok. I actually do see something on my dashboard! But I don’t see them in my Integrations page where I was expecting them. Shouldn’t I see something on my integrations page?
No. Actually I think it is working 100% Thanks so much. I bought you a coffee! Thanks a bunch!

Check Integrations -> MQTT

YES. Of course it is there. I never thought to look there. Thanks again.

1 Like

A question about Shelly 3EM:
I have a 3 phase SolarEdge inverter. I would like to monitor the consumed and produced power. Not entirely clear how it works. According to the documentation, I’m afraid the device can measure only 1 phase solar production, but this option is only for 1 phase systems… (Althrough the solar inverter can be monitored via it’s own integration, but that data has 5-15 min delay, since this model allow only cloud based monitoring, so unfortunately no local readout option…)

Anyone has experience with 3 phase solar inverter and Shelly 3EM system together??

thanks!

Will we be getting Shelly Uni support please? Thank you!

running hass 0.117.6 as well as the latest script.
It seems that no mqtt entities are imported into hass.
Other external mqtt entities seem to import fine, ESPHOME etc.

I’ve configured the MQTT integration in the UI and not in config.yaml
Discover new devices is also activated, as otherwise stuff like esphhome would not import its entities.

Do you feel loggy ?
Yes I do, here are the logs:

When I run the “Shellies Announce” autom. I see the following in the hass logs:

2020-11-17 09:09:06 INFO (MainThread) [homeassistant.components.automation.shellies_announce] Shellies Announce: Running automation actions
2020-11-17 09:09:06 INFO (MainThread) [homeassistant.components.automation.shellies_announce] Shellies Announce: Executing step call service
2020-11-17 09:09:06 DEBUG (MainThread) [homeassistant.components.mqtt] Transmitting message on shellies/command: 'announce', mid: 1490
2020-11-17 09:09:06 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on shellies/announce: b'{"id":"enkegaard/firstfloor/hall","model":"SHDM-2","mac":"40F5200165A5","ip":"192.168.1.181","new_fw":false,"fw_ver":"20201007-085431/v1.8.5@5fbcbaa3"}'
2020-11-17 09:09:06 INFO (MainThread) [homeassistant.components.automation.shellies_discovery] Shellies Discovery: Running automation actions
2020-11-17 09:09:06 INFO (MainThread) [homeassistant.components.automation.shellies_discovery] Shellies Discovery: Executing step call service
2020-11-17 09:09:06 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on shellies/announce: b'{"id":"enkegaard/firstfloor/livingroom","model":"SHDM-2","mac":"D8BFC019E3A0","ip":"192.168.1.227","new_fw":false,"fw_ver":"20201007-085431/v1.8.5@5fbcbaa3"}'
2020-11-17 09:09:07 INFO (SyncWorker_25) [homeassistant.components.python_script] Executing shellies_discovery.py: {'id': 'enkegaard/firstfloor/hall', 'mac': '40F5200165A5', 'fw_ver': '20201007-085431/v1.8.5@5fbcbaa3', 'model': 'SHDM-2'}
2020-11-17 09:09:07 DEBUG (SyncWorker_25) [homeassistant.components.python_script.shellies_discovery.py] id: enkegaard/firstfloor/hall, mac: 40f5200165a5, fw_ver: 20201007-085431/v1.8.5@5fbcbaa3, model: SHDM-2
2020-11-17 09:09:07 DEBUG (SyncWorker_25) [homeassistant.components.python_script.shellies_discovery.py] Sending to MQTT broker: homeassistant/sensor/enkegaard/firstfloor/hall-temperature/config {"name": "Shelly Dimmer 2 enkegaard/firstfloor/hall Temperature", "stat_t": "~temperature", "frc_upd": "False", "uniq_id": "enkegaard/firstfloor/hall-temperature", "qos": 0, "dev": {"ids": ["40f5200165a5"], "name": "Shelly Dimmer 2 enkegaard/firstfloor/hall", "mdl": "Shelly Dimmer 2", "sw": "20201007-085431/v1.8.5@5fbcbaa3", "mf": "Allterco Robotics"}, "~": "shellies/enkegaard/firstfloor/hall/", "unit_of_meas": "°C", "dev_cla": "temperature", "val_tpl": "{{value|float|round(1)}}", "avty_t": "~online", "pl_avail": "true", "pl_not_avail": "false"}
2020-11-17 09:09:07 DEBUG (SyncWorker_25) [homeassistant.components.python_script.shellies_discovery.py] Sending to MQTT broker: homeassistant/sensor/enkegaard/firstfloor/hall-rssi/config {"name": "Shelly Dimmer 2 enkegaard/firstfloor/hall RSSI", "stat_t": "~info", "frc_upd": "False", "uniq_id": "enkegaard/firstfloor/hall-rssi", "qos": 0, "dev": {"ids": ["40f5200165a5"], "name": "Shelly Dimmer 2 enkegaard/firstfloor/hall", "mdl": "Shelly Dimmer 2", "sw": "20201007-085431/v1.8.5@5fbcbaa3", "mf": "Allterco Robotics"}, "~": "shellies/enkegaard/firstfloor/hall/", "unit_of_meas": "dB", "dev_cla": "signal_strength", "val_tpl": "{{value_json['wifi_sta'].rssi}}", "avty_t": "~online", "pl_avail": "true", "pl_not_avail": "false"}
2020-11-17 09:09:07 DEBUG (SyncWorker_25) [homeassistant.components.python_script.shellies_discovery.py] Sending to MQTT broker: homeassistant/sensor/enkegaard/firstfloor/hall-ssid/config {"name": "Shelly Dimmer 2 enkegaard/firstfloor/hall SSID", "stat_t": "~info", "frc_upd": "False", "uniq_id": "enkegaard/firstfloor/hall-ssid", "qos": 0, "dev": {"ids": ["40f5200165a5"], "name": "Shelly Dimmer 2 enkegaard/firstfloor/hall", "mdl": "Shelly Dimmer 2", "sw": "20201007-085431/v1.8.5@5fbcbaa3", "mf": "Allterco Robotics"}, "~": "shellies/enkegaard/firstfloor/hall/", "val_tpl": "{{value_json['wifi_sta'].ssid}}", "icon": "mdi:wifi", "avty_t": "~online", "pl_avail": "true", "pl_not_avail": "false"}
2020-11-17 09:09:07 DEBUG (SyncWorker_25) [homeassistant.components.python_script.shellies_discovery.py] Sending to MQTT broker: homeassistant/sensor/enkegaard/firstfloor/hall-uptime/config {"name": "Shelly Dimmer 2 enkegaard/firstfloor/hall Uptime", "stat_t": "~info", "frc_upd": "False", "uniq_id": "enkegaard/firstfloor/hall-uptime", "qos": 0, "dev": {"ids": ["40f5200165a5"], "name": "Shelly Dimmer 2 enkegaard/firstfloor/hall", "mdl": "Shelly Dimmer 2", "sw": "20201007-085431/v1.8.5@5fbcbaa3", "mf": "Allterco Robotics"}, "~": "shellies/enkegaard/firstfloor/hall/", "dev_cla": "timestamp", "val_tpl": "{{(as_timestamp(now())-value_json.uptime)|timestamp_local}}", "icon": "mdi:timer-outline", "avty_t": "~online", "pl_avail": "true", "pl_not_avail": "false"}

mqtt wise we have:

shellies/enkegaard/firstfloor/livingroom/info 
=>
{
    "wifi_sta": {
        "connected": true,
        "ssid": "enkegaard",
        "ip": "192.168.1.227",
        "rssi": -58
    },
    "cloud": {
        "enabled": false,
        "connected": false
    },
    "mqtt": {
        "connected": true
    },
    "time": "09:12",
    "unixtime": 1605604345,
    "serial": 30683,
    "has_update": false,
    "mac": "D8BFC019E3A0",
    "cfg_changed_cnt": 13,
    "actions_stats": {
        "skipped": 0
    },
    "lights": [
        {
            "ison": false,
            "has_timer": false,
            "timer_started": 0,
            "timer_duration": 0,
            "timer_remaining": 0,
            "mode": "white",
            "brightness": 95
        }
    ],
    "meters": [
        {
            "power": 0,
            "is_valid": true,
            "timestamp": 1605604345,
            "counters": [
                0,
                0,
                0
            ],
            "total": 69267
        }
    ],
    "inputs": [
        {
            "input": 0,
            "event": "L",
            "event_cnt": 58
        },
        {
            "input": 0,
            "event": "",
            "event_cnt": 0
        }
    ],
    "tmp": {
        "tC": 46.48,
        "tF": 115.67,
        "is_valid": true
    },
    "calib_progress": 0,
    "calib_status": 0,
    "wire_mode": 1,
    "overtemperature": false,
    "loaderror": 0,
    "overload": false,
    "debug": 0,
    "update": {
        "status": "idle",
        "has_update": false,
        "new_version": "20201007-085431/v1.8.5@5fbcbaa3",
        "old_version": "20201007-085431/v1.8.5@5fbcbaa3"
    },
    "ram_total": 48816,
    "ram_free": 34264,
    "fs_size": 233681,
    "fs_free": 114456,
    "uptime": 1450264
}


Script works well so you have problem with MQTT or discovery. Do you check discovery_prefix?

hmm… no where to spot discovery prefix in that mqtt integration dialog.
I would guess the default is: “homeassistant”

when configging mqtt in configuration.yaml there is indeed a discovery_prefix attrib. which defaults to homeassistant, if nothing defined.
I would expect the same thing when configuring it from the UI.