Shellies Discovery Script

when I look into my HA log files I found for all my shelly-1pm devices the following warning

2021-11-29 01:01:08 WARNING (MainThread) [homeassistant.components.mqtt.discovery] Received message on illegal discovery topic 'homeassistant/binary_sensor/shelly1pm-XXXXXX-longpush 0-0/config'

This is only for shelly-1pm devices. All my shelly dimmer devices works fine with longpush.

When i try the official shelly integration, longpush for shelly 1pm also didn’t worked :sleepy:

Please share the debug log for python_script.

2021-11-30 13:30:37 WARNING (MainThread) [homeassistant.components.mqtt.discovery] Received message on illegal discovery topic 'homeassistant/binary_sensor/shelly1pm-68C63AFAE2F9-longpush 0-0/config'
2021-11-30 13:32:04 INFO (MainThread) [homeassistant.components.automation.system_shellies_discovery] [system] - shellies discovery: Running automation actions
2021-11-30 13:32:04 INFO (MainThread) [homeassistant.components.automation.system_shellies_discovery] [system] - shellies discovery: Executing step call service
2021-11-30 13:32:04 INFO (SyncWorker_9) [homeassistant.components.python_script] Executing shellies_discovery.py: {'id': 'shelly1pm-68C63AFAE2F9', 'mac': '68C63AFAE2F9', 'fw_ver': '20211109-130756/v1.11.7-g682a0db', 'model': 'SHSW-PM', 'mode': '', 'host': '192.168.4.34'}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] id: shelly1pm-68C63AFAE2F9, mac: 68c63afae2f9, fw_ver: 20211109-130756/v1.11.7-g682a0db, model: SHSW-PM
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] {'topic': 'homeassistant/switch/shelly1pm-68C63AFAE2F9-relay-0/config', 'payload': '{"name": "Shelly 1PM 68C63AFAE2F9 Relay 0", "cmd_t": "~relay/0/command", "stat_t": "~relay/0", "pl_off": "off", "pl_on": "on", "avty_t": "~online", "pl_avail": "true", "pl_not_avail": "false", "uniq_id": "shelly1pm-68c63afae2f9-relay-0", "qos": 0, "dev": {"ids": ["68c63afae2f9"], "cns": [["mac", "68:c6:3a:fa:e2:f9"]], "name": "Shelly 1PM 68C63AFAE2F9", "mdl": "Shelly 1PM", "sw": "20211109-130756/v1.11.7-g682a0db", "mf": "Allterco Robotics", "cu": "http://192.168.4.34/"}, "~": "shellies/shelly1pm-68C63AFAE2F9/"}', 'retain': True, 'qos': 0}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] Sending to MQTT broker: homeassistant/switch/shelly1pm-68C63AFAE2F9-relay-0/config {'name': 'Shelly 1PM 68C63AFAE2F9 Relay 0', 'cmd_t': '~relay/0/command', 'stat_t': '~relay/0', 'pl_off': 'off', 'pl_on': 'on', 'avty_t': '~online', 'pl_avail': 'true', 'pl_not_avail': 'false', 'uniq_id': 'shelly1pm-68c63afae2f9-relay-0', 'qos': 0, 'dev': {'ids': ['68c63afae2f9'], 'cns': [['mac', '68:c6:3a:fa:e2:f9']], 'name': 'Shelly 1PM 68C63AFAE2F9', 'mdl': 'Shelly 1PM', 'sw': '20211109-130756/v1.11.7-g682a0db', 'mf': 'Allterco Robotics', 'cu': 'http://192.168.4.34/'}, '~': 'shellies/shelly1pm-68C63AFAE2F9/'}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] {'topic': 'homeassistant/light/shelly1pm-68C63AFAE2F9-relay-0/config', 'payload': '', 'retain': True, 'qos': 0}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] Sending to MQTT broker: homeassistant/light/shelly1pm-68C63AFAE2F9-relay-0/config 
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] {'topic': 'homeassistant/fan/shelly1pm-68C63AFAE2F9-relay-0/config', 'payload': '', 'retain': True, 'qos': 0}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] Sending to MQTT broker: homeassistant/fan/shelly1pm-68C63AFAE2F9-relay-0/config 
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] {'topic': 'homeassistant/sensor/shelly1pm-68C63AFAE2F9-power/config', 'payload': '', 'retain': True, 'qos': 0}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] Sending to MQTT broker: homeassistant/sensor/shelly1pm-68C63AFAE2F9-power/config 
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] {'topic': 'homeassistant/sensor/shelly1pm-68C63AFAE2F9-energy/config', 'payload': '', 'retain': True, 'qos': 0}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] Sending to MQTT broker: homeassistant/sensor/shelly1pm-68C63AFAE2F9-energy/config 
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] {'topic': 'homeassistant/sensor/shelly1pm-68C63AFAE2F9-power-0/config', 'payload': '{"name": "Shelly 1PM 68C63AFAE2F9 Power 0", "stat_t": "~relay/0/power", "unit_of_meas": "W", "val_tpl": "{{value|float|round(1)}}", "dev_cla": "power", "avty_t": "~online", "pl_avail": "true", "pl_not_avail": "false", "frc_upd": "False", "uniq_id": "shelly1pm-68c63afae2f9-relay-power-0", "qos": 0, "dev": {"ids": ["68c63afae2f9"], "cns": [["mac", "68:c6:3a:fa:e2:f9"]], "name": "Shelly 1PM 68C63AFAE2F9", "mdl": "Shelly 1PM", "sw": "20211109-130756/v1.11.7-g682a0db", "mf": "Allterco Robotics", "cu": "http://192.168.4.34/"}, "~": "shellies/shelly1pm-68C63AFAE2F9/", "stat_cla": "measurement"}', 'retain': True, 'qos': 0}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] Sending to MQTT broker: homeassistant/sensor/shelly1pm-68C63AFAE2F9-power-0/config {'name': 'Shelly 1PM 68C63AFAE2F9 Power 0', 'stat_t': '~relay/0/power', 'unit_of_meas': 'W', 'val_tpl': '{{value|float|round(1)}}', 'dev_cla': 'power', 'avty_t': '~online', 'pl_avail': 'true', 'pl_not_avail': 'false', 'frc_upd': 'False', 'uniq_id': 'shelly1pm-68c63afae2f9-relay-power-0', 'qos': 0, 'dev': {'ids': ['68c63afae2f9'], 'cns': [['mac', '68:c6:3a:fa:e2:f9']], 'name': 'Shelly 1PM 68C63AFAE2F9', 'mdl': 'Shelly 1PM', 'sw': '20211109-130756/v1.11.7-g682a0db', 'mf': 'Allterco Robotics', 'cu': 'http://192.168.4.34/'}, '~': 'shellies/shelly1pm-68C63AFAE2F9/', 'stat_cla': 'measurement'}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] {'topic': 'homeassistant/sensor/shelly1pm-68C63AFAE2F9-energy-0/config', 'payload': '{"name": "Shelly 1PM 68C63AFAE2F9 Energy 0", "stat_t": "~relay/0/energy", "unit_of_meas": "kWh", "val_tpl": "{{(value|float/60/1000)|round(2)}}", "dev_cla": "energy", "avty_t": "~online", "pl_avail": "true", "pl_not_avail": "false", "frc_upd": "False", "uniq_id": "shelly1pm-68c63afae2f9-relay-energy-0", "qos": 0, "dev": {"ids": ["68c63afae2f9"], "cns": [["mac", "68:c6:3a:fa:e2:f9"]], "name": "Shelly 1PM 68C63AFAE2F9", "mdl": "Shelly 1PM", "sw": "20211109-130756/v1.11.7-g682a0db", "mf": "Allterco Robotics", "cu": "http://192.168.4.34/"}, "~": "shellies/shelly1pm-68C63AFAE2F9/", "stat_cla": "total_increasing"}', 'retain': True, 'qos': 0}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] Sending to MQTT broker: homeassistant/sensor/shelly1pm-68C63AFAE2F9-energy-0/config {'name': 'Shelly 1PM 68C63AFAE2F9 Energy 0', 'stat_t': '~relay/0/energy', 'unit_of_meas': 'kWh', 'val_tpl': '{{(value|float/60/1000)|round(2)}}', 'dev_cla': 'energy', 'avty_t': '~online', 'pl_avail': 'true', 'pl_not_avail': 'false', 'frc_upd': 'False', 'uniq_id': 'shelly1pm-68c63afae2f9-relay-energy-0', 'qos': 0, 'dev': {'ids': ['68c63afae2f9'], 'cns': [['mac', '68:c6:3a:fa:e2:f9']], 'name': 'Shelly 1PM 68C63AFAE2F9', 'mdl': 'Shelly 1PM', 'sw': '20211109-130756/v1.11.7-g682a0db', 'mf': 'Allterco Robotics', 'cu': 'http://192.168.4.34/'}, '~': 'shellies/shelly1pm-68C63AFAE2F9/', 'stat_cla': 'total_increasing'}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] {'topic': 'homeassistant/binary_sensor/shelly1pm-68C63AFAE2F9-input-0/config', 'payload': '{"name": "Shelly 1PM 68C63AFAE2F9 Input 0", "stat_t": "~input/0", "avty_t": "~online", "pl_avail": "true", "pl_not_avail": "false", "uniq_id": "shelly1pm-68c63afae2f9-input-0", "qos": 0, "dev": {"ids": ["68c63afae2f9"], "cns": [["mac", "68:c6:3a:fa:e2:f9"]], "name": "Shelly 1PM 68C63AFAE2F9", "mdl": "Shelly 1PM", "sw": "20211109-130756/v1.11.7-g682a0db", "mf": "Allterco Robotics", "cu": "http://192.168.4.34/"}, "~": "shellies/shelly1pm-68C63AFAE2F9/", "pl_on": "1", "pl_off": "0"}', 'retain': True, 'qos': 0}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] Sending to MQTT broker: homeassistant/binary_sensor/shelly1pm-68C63AFAE2F9-input-0/config {'name': 'Shelly 1PM 68C63AFAE2F9 Input 0', 'stat_t': '~input/0', 'avty_t': '~online', 'pl_avail': 'true', 'pl_not_avail': 'false', 'uniq_id': 'shelly1pm-68c63afae2f9-input-0', 'qos': 0, 'dev': {'ids': ['68c63afae2f9'], 'cns': [['mac', '68:c6:3a:fa:e2:f9']], 'name': 'Shelly 1PM 68C63AFAE2F9', 'mdl': 'Shelly 1PM', 'sw': '20211109-130756/v1.11.7-g682a0db', 'mf': 'Allterco Robotics', 'cu': 'http://192.168.4.34/'}, '~': 'shellies/shelly1pm-68C63AFAE2F9/', 'pl_on': '1', 'pl_off': '0'}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] {'topic': 'homeassistant/binary_sensor/shelly1pm-68C63AFAE2F9-longpush-0/config', 'payload': '{"name": "Shelly 1PM 68C63AFAE2F9 Longpush 0", "stat_t": "~input_event/0/0", "avty_t": "~online", "pl_avail": "true", "pl_not_avail": "false", "uniq_id": "shelly1pm-68c63afae2f9-longpush-0", "qos": 0, "dev": {"ids": ["68c63afae2f9"], "cns": [["mac", "68:c6:3a:fa:e2:f9"]], "name": "Shelly 1PM 68C63AFAE2F9", "mdl": "Shelly 1PM", "sw": "20211109-130756/v1.11.7-g682a0db", "mf": "Allterco Robotics", "cu": "http://192.168.4.34/"}, "~": "shellies/shelly1pm-68C63AFAE2F9/", "off_dly": 2, "val_tpl": "{%if value_json.event==\'L\'%}ON{%else%}OFF{%endif%}"}', 'retain': True, 'qos': 0}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] Sending to MQTT broker: homeassistant/binary_sensor/shelly1pm-68C63AFAE2F9-longpush-0/config {'name': 'Shelly 1PM 68C63AFAE2F9 Longpush 0', 'stat_t': '~input_event/0/0', 'avty_t': '~online', 'pl_avail': 'true', 'pl_not_avail': 'false', 'uniq_id': 'shelly1pm-68c63afae2f9-longpush-0', 'qos': 0, 'dev': {'ids': ['68c63afae2f9'], 'cns': [['mac', '68:c6:3a:fa:e2:f9']], 'name': 'Shelly 1PM 68C63AFAE2F9', 'mdl': 'Shelly 1PM', 'sw': '20211109-130756/v1.11.7-g682a0db', 'mf': 'Allterco Robotics', 'cu': 'http://192.168.4.34/'}, '~': 'shellies/shelly1pm-68C63AFAE2F9/', 'off_dly': 2, 'val_tpl': '{%if value_json.event==^L^%}ON{%else%}OFF{%endif%}'}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] {'topic': 'homeassistant/binary_sensor/shelly1pm-68C63AFAE2F9-shortpush-0/config', 'payload': '{"name": "Shelly 1PM 68C63AFAE2F9 Shortpush 0", "stat_t": "~input_event/0/0", "avty_t": "~online", "pl_avail": "true", "pl_not_avail": "false", "uniq_id": "shelly1pm-68c63afae2f9-shortpush-0", "qos": 0, "dev": {"ids": ["68c63afae2f9"], "cns": [["mac", "68:c6:3a:fa:e2:f9"]], "name": "Shelly 1PM 68C63AFAE2F9", "mdl": "Shelly 1PM", "sw": "20211109-130756/v1.11.7-g682a0db", "mf": "Allterco Robotics", "cu": "http://192.168.4.34/"}, "~": "shellies/shelly1pm-68C63AFAE2F9/", "off_dly": 2, "val_tpl": "{%if value_json.event==\'S\'%}ON{%else%}OFF{%endif%}"}', 'retain': True, 'qos': 0}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] Sending to MQTT broker: homeassistant/binary_sensor/shelly1pm-68C63AFAE2F9-shortpush-0/config {'name': 'Shelly 1PM 68C63AFAE2F9 Shortpush 0', 'stat_t': '~input_event/0/0', 'avty_t': '~online', 'pl_avail': 'true', 'pl_not_avail': 'false', 'uniq_id': 'shelly1pm-68c63afae2f9-shortpush-0', 'qos': 0, 'dev': {'ids': ['68c63afae2f9'], 'cns': [['mac', '68:c6:3a:fa:e2:f9']], 'name': 'Shelly 1PM 68C63AFAE2F9', 'mdl': 'Shelly 1PM', 'sw': '20211109-130756/v1.11.7-g682a0db', 'mf': 'Allterco Robotics', 'cu': 'http://192.168.4.34/'}, '~': 'shellies/shelly1pm-68C63AFAE2F9/', 'off_dly': 2, 'val_tpl': '{%if value_json.event==^S^%}ON{%else%}OFF{%endif%}'}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] {'topic': 'homeassistant/binary_sensor/shelly1pm-68C63AFAE2F9-overpower-0/config', 'payload': '{"name": "Shelly 1PM 68C63AFAE2F9 Overpower 0", "stat_t": "~relay/0", "avty_t": "~online", "pl_avail": "true", "pl_not_avail": "false", "uniq_id": "shelly1pm-68c63afae2f9-overpower-0", "qos": 0, "dev": {"ids": ["68c63afae2f9"], "cns": [["mac", "68:c6:3a:fa:e2:f9"]], "name": "Shelly 1PM 68C63AFAE2F9", "mdl": "Shelly 1PM", "sw": "20211109-130756/v1.11.7-g682a0db", "mf": "Allterco Robotics", "cu": "http://192.168.4.34/"}, "~": "shellies/shelly1pm-68C63AFAE2F9/", "entity_category": "diagnostic", "val_tpl": "{%if value==\'overpower\'%}ON{%else%}OFF{%endif%}", "dev_cla": "problem", "json_attr_t": "~relay/0/overpower_value", "json_attr_tpl": "{{{\'overpower_value\':value}|tojson}}"}', 'retain': True, 'qos': 0}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] Sending to MQTT broker: homeassistant/binary_sensor/shelly1pm-68C63AFAE2F9-overpower-0/config {'name': 'Shelly 1PM 68C63AFAE2F9 Overpower 0', 'stat_t': '~relay/0', 'avty_t': '~online', 'pl_avail': 'true', 'pl_not_avail': 'false', 'uniq_id': 'shelly1pm-68c63afae2f9-overpower-0', 'qos': 0, 'dev': {'ids': ['68c63afae2f9'], 'cns': [['mac', '68:c6:3a:fa:e2:f9']], 'name': 'Shelly 1PM 68C63AFAE2F9', 'mdl': 'Shelly 1PM', 'sw': '20211109-130756/v1.11.7-g682a0db', 'mf': 'Allterco Robotics', 'cu': 'http://192.168.4.34/'}, '~': 'shellies/shelly1pm-68C63AFAE2F9/', 'entity_category': 'diagnostic', 'val_tpl': '{%if value==^overpower^%}ON{%else%}OFF{%endif%}', 'dev_cla': 'problem', 'json_attr_t': '~relay/0/overpower_value', 'json_attr_tpl': '{{{^overpower_value^:value}|tojson}}'}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] {'topic': 'homeassistant/sensor/shelly1pm-68C63AFAE2F9-temperature/config', 'payload': '{"name": "Shelly 1PM 68C63AFAE2F9 Temperature", "stat_t": "~temperature", "frc_upd": "False", "en": "True", "uniq_id": "shelly1pm-68c63afae2f9-temperature", "qos": 0, "dev": {"ids": ["68c63afae2f9"], "cns": [["mac", "68:c6:3a:fa:e2:f9"]], "name": "Shelly 1PM 68C63AFAE2F9", "mdl": "Shelly 1PM", "sw": "20211109-130756/v1.11.7-g682a0db", "mf": "Allterco Robotics", "cu": "http://192.168.4.34/"}, "~": "shellies/shelly1pm-68C63AFAE2F9/", "entity_category": "diagnostic", "stat_cla": "measurement", "unit_of_meas": "°C", "dev_cla": "temperature", "val_tpl": "{%if value!=999%}{{value|float|round(1)}}{%endif%}", "avty_t": "~online", "pl_avail": "true", "pl_not_avail": "false"}', 'retain': True, 'qos': 0}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] Sending to MQTT broker: homeassistant/sensor/shelly1pm-68C63AFAE2F9-temperature/config {'name': 'Shelly 1PM 68C63AFAE2F9 Temperature', 'stat_t': '~temperature', 'frc_upd': 'False', 'en': 'True', 'uniq_id': 'shelly1pm-68c63afae2f9-temperature', 'qos': 0, 'dev': {'ids': ['68c63afae2f9'], 'cns': [['mac', '68:c6:3a:fa:e2:f9']], 'name': 'Shelly 1PM 68C63AFAE2F9', 'mdl': 'Shelly 1PM', 'sw': '20211109-130756/v1.11.7-g682a0db', 'mf': 'Allterco Robotics', 'cu': 'http://192.168.4.34/'}, '~': 'shellies/shelly1pm-68C63AFAE2F9/', 'entity_category': 'diagnostic', 'stat_cla': 'measurement', 'unit_of_meas': '°C', 'dev_cla': 'temperature', 'val_tpl': '{%if value!=999%}{{value|float|round(1)}}{%endif%}', 'avty_t': '~online', 'pl_avail': 'true', 'pl_not_avail': 'false'}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] {'topic': 'homeassistant/sensor/shelly1pm-68C63AFAE2F9-rssi/config', 'payload': '{"name": "Shelly 1PM 68C63AFAE2F9 RSSI", "stat_t": "~info", "frc_upd": "False", "en": "False", "uniq_id": "shelly1pm-68c63afae2f9-rssi", "qos": 0, "dev": {"ids": ["68c63afae2f9"], "cns": [["mac", "68:c6:3a:fa:e2:f9"]], "name": "Shelly 1PM 68C63AFAE2F9", "mdl": "Shelly 1PM", "sw": "20211109-130756/v1.11.7-g682a0db", "mf": "Allterco Robotics", "cu": "http://192.168.4.34/"}, "~": "shellies/shelly1pm-68C63AFAE2F9/", "entity_category": "diagnostic", "unit_of_meas": "dBm", "dev_cla": "signal_strength", "val_tpl": "{{value_json[\'wifi_sta\'].rssi}}", "avty_t": "~online", "pl_avail": "true", "pl_not_avail": "false"}', 'retain': True, 'qos': 0}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] Sending to MQTT broker: homeassistant/sensor/shelly1pm-68C63AFAE2F9-rssi/config {'name': 'Shelly 1PM 68C63AFAE2F9 RSSI', 'stat_t': '~info', 'frc_upd': 'False', 'en': 'False', 'uniq_id': 'shelly1pm-68c63afae2f9-rssi', 'qos': 0, 'dev': {'ids': ['68c63afae2f9'], 'cns': [['mac', '68:c6:3a:fa:e2:f9']], 'name': 'Shelly 1PM 68C63AFAE2F9', 'mdl': 'Shelly 1PM', 'sw': '20211109-130756/v1.11.7-g682a0db', 'mf': 'Allterco Robotics', 'cu': 'http://192.168.4.34/'}, '~': 'shellies/shelly1pm-68C63AFAE2F9/', 'entity_category': 'diagnostic', 'unit_of_meas': 'dBm', 'dev_cla': 'signal_strength', 'val_tpl': '{{value_json[^wifi_sta^].rssi}}', 'avty_t': '~online', 'pl_avail': 'true', 'pl_not_avail': 'false'}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] {'topic': 'homeassistant/sensor/shelly1pm-68C63AFAE2F9-ssid/config', 'payload': '{"name": "Shelly 1PM 68C63AFAE2F9 SSID", "stat_t": "~info", "frc_upd": "False", "en": "False", "uniq_id": "shelly1pm-68c63afae2f9-ssid", "qos": 0, "dev": {"ids": ["68c63afae2f9"], "cns": [["mac", "68:c6:3a:fa:e2:f9"]], "name": "Shelly 1PM 68C63AFAE2F9", "mdl": "Shelly 1PM", "sw": "20211109-130756/v1.11.7-g682a0db", "mf": "Allterco Robotics", "cu": "http://192.168.4.34/"}, "~": "shellies/shelly1pm-68C63AFAE2F9/", "entity_category": "diagnostic", "val_tpl": "{{value_json[\'wifi_sta\'].ssid}}", "icon": "mdi:wifi", "avty_t": "~online", "pl_avail": "true", "pl_not_avail": "false"}', 'retain': True, 'qos': 0}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] Sending to MQTT broker: homeassistant/sensor/shelly1pm-68C63AFAE2F9-ssid/config {'name': 'Shelly 1PM 68C63AFAE2F9 SSID', 'stat_t': '~info', 'frc_upd': 'False', 'en': 'False', 'uniq_id': 'shelly1pm-68c63afae2f9-ssid', 'qos': 0, 'dev': {'ids': ['68c63afae2f9'], 'cns': [['mac', '68:c6:3a:fa:e2:f9']], 'name': 'Shelly 1PM 68C63AFAE2F9', 'mdl': 'Shelly 1PM', 'sw': '20211109-130756/v1.11.7-g682a0db', 'mf': 'Allterco Robotics', 'cu': 'http://192.168.4.34/'}, '~': 'shellies/shelly1pm-68C63AFAE2F9/', 'entity_category': 'diagnostic', 'val_tpl': '{{value_json[^wifi_sta^].ssid}}', 'icon': 'mdi:wifi', 'avty_t': '~online', 'pl_avail': 'true', 'pl_not_avail': 'false'}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] {'topic': 'homeassistant/sensor/shelly1pm-68C63AFAE2F9-uptime/config', 'payload': '{"name": "Shelly 1PM 68C63AFAE2F9 Uptime", "stat_t": "~info", "frc_upd": "False", "en": "False", "uniq_id": "shelly1pm-68c63afae2f9-uptime", "qos": 0, "dev": {"ids": ["68c63afae2f9"], "cns": [["mac", "68:c6:3a:fa:e2:f9"]], "name": "Shelly 1PM 68C63AFAE2F9", "mdl": "Shelly 1PM", "sw": "20211109-130756/v1.11.7-g682a0db", "mf": "Allterco Robotics", "cu": "http://192.168.4.34/"}, "~": "shellies/shelly1pm-68C63AFAE2F9/", "entity_category": "diagnostic", "dev_cla": "timestamp", "val_tpl": "{{(as_timestamp(now())-value_json.uptime)|timestamp_local}}", "avty_t": "~online", "pl_avail": "true", "pl_not_avail": "false"}', 'retain': True, 'qos': 0}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] Sending to MQTT broker: homeassistant/sensor/shelly1pm-68C63AFAE2F9-uptime/config {'name': 'Shelly 1PM 68C63AFAE2F9 Uptime', 'stat_t': '~info', 'frc_upd': 'False', 'en': 'False', 'uniq_id': 'shelly1pm-68c63afae2f9-uptime', 'qos': 0, 'dev': {'ids': ['68c63afae2f9'], 'cns': [['mac', '68:c6:3a:fa:e2:f9']], 'name': 'Shelly 1PM 68C63AFAE2F9', 'mdl': 'Shelly 1PM', 'sw': '20211109-130756/v1.11.7-g682a0db', 'mf': 'Allterco Robotics', 'cu': 'http://192.168.4.34/'}, '~': 'shellies/shelly1pm-68C63AFAE2F9/', 'entity_category': 'diagnostic', 'dev_cla': 'timestamp', 'val_tpl': '{{(as_timestamp(now())-value_json.uptime)|timestamp_local}}', 'avty_t': '~online', 'pl_avail': 'true', 'pl_not_avail': 'false'}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] {'topic': 'homeassistant/sensor/shelly1pm-68C63AFAE2F9-ip/config', 'payload': '{"name": "Shelly 1PM 68C63AFAE2F9 IP", "stat_t": "~announce", "frc_upd": "False", "en": "False", "uniq_id": "shelly1pm-68c63afae2f9-ip", "qos": 0, "dev": {"ids": ["68c63afae2f9"], "cns": [["mac", "68:c6:3a:fa:e2:f9"]], "name": "Shelly 1PM 68C63AFAE2F9", "mdl": "Shelly 1PM", "sw": "20211109-130756/v1.11.7-g682a0db", "mf": "Allterco Robotics", "cu": "http://192.168.4.34/"}, "~": "shellies/shelly1pm-68C63AFAE2F9/", "entity_category": "diagnostic", "val_tpl": "{{value_json.ip}}", "avty_t": "~online", "pl_avail": "true", "pl_not_avail": "false"}', 'retain': True, 'qos': 0}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] Sending to MQTT broker: homeassistant/sensor/shelly1pm-68C63AFAE2F9-ip/config {'name': 'Shelly 1PM 68C63AFAE2F9 IP', 'stat_t': '~announce', 'frc_upd': 'False', 'en': 'False', 'uniq_id': 'shelly1pm-68c63afae2f9-ip', 'qos': 0, 'dev': {'ids': ['68c63afae2f9'], 'cns': [['mac', '68:c6:3a:fa:e2:f9']], 'name': 'Shelly 1PM 68C63AFAE2F9', 'mdl': 'Shelly 1PM', 'sw': '20211109-130756/v1.11.7-g682a0db', 'mf': 'Allterco Robotics', 'cu': 'http://192.168.4.34/'}, '~': 'shellies/shelly1pm-68C63AFAE2F9/', 'entity_category': 'diagnostic', 'val_tpl': '{{value_json.ip}}', 'avty_t': '~online', 'pl_avail': 'true', 'pl_not_avail': 'false'}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] {'topic': 'homeassistant/sensor/shelly1pm-68C63AFAE2F9-temperature_status/config', 'payload': '{"name": "Shelly 1PM 68C63AFAE2F9 Temperature Status", "stat_t": "~temperature_status", "frc_upd": "False", "en": "True", "uniq_id": "shelly1pm-68c63afae2f9-temperature_status", "qos": 0, "dev": {"ids": ["68c63afae2f9"], "cns": [["mac", "68:c6:3a:fa:e2:f9"]], "name": "Shelly 1PM 68C63AFAE2F9", "mdl": "Shelly 1PM", "sw": "20211109-130756/v1.11.7-g682a0db", "mf": "Allterco Robotics", "cu": "http://192.168.4.34/"}, "~": "shellies/shelly1pm-68C63AFAE2F9/", "entity_category": "diagnostic", "val_tpl": "{{value|lower}}", "icon": "mdi:thermometer", "avty_t": "~online", "pl_avail": "true", "pl_not_avail": "false"}', 'retain': True, 'qos': 0}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] Sending to MQTT broker: homeassistant/sensor/shelly1pm-68C63AFAE2F9-temperature_status/config {'name': 'Shelly 1PM 68C63AFAE2F9 Temperature Status', 'stat_t': '~temperature_status', 'frc_upd': 'False', 'en': 'True', 'uniq_id': 'shelly1pm-68c63afae2f9-temperature_status', 'qos': 0, 'dev': {'ids': ['68c63afae2f9'], 'cns': [['mac', '68:c6:3a:fa:e2:f9']], 'name': 'Shelly 1PM 68C63AFAE2F9', 'mdl': 'Shelly 1PM', 'sw': '20211109-130756/v1.11.7-g682a0db', 'mf': 'Allterco Robotics', 'cu': 'http://192.168.4.34/'}, '~': 'shellies/shelly1pm-68C63AFAE2F9/', 'entity_category': 'diagnostic', 'val_tpl': '{{value|lower}}', 'icon': 'mdi:thermometer', 'avty_t': '~online', 'pl_avail': 'true', 'pl_not_avail': 'false'}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] {'topic': 'homeassistant/device_automation/shelly1pm-68C63AFAE2F9-input-0/button_release/config', 'payload': '{"atype": "trigger", "t": "shellies/shelly1pm-68C63AFAE2F9/input/0", "pl": "0", "qos": 0, "dev": {"ids": ["68c63afae2f9"], "cns": [["mac", "68:c6:3a:fa:e2:f9"]], "name": "Shelly 1PM 68C63AFAE2F9", "mdl": "Shelly 1PM", "sw": "20211109-130756/v1.11.7-g682a0db", "mf": "Allterco Robotics", "cu": "http://192.168.4.34/"}, "type": "button_short_release", "stype": "button_1"}', 'retain': True, 'qos': 0}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] Sending to MQTT broker: homeassistant/device_automation/shelly1pm-68C63AFAE2F9-input-0/button_release/config {'atype': 'trigger', 't': 'shellies/shelly1pm-68C63AFAE2F9/input/0', 'pl': '0', 'qos': 0, 'dev': {'ids': ['68c63afae2f9'], 'cns': [['mac', '68:c6:3a:fa:e2:f9']], 'name': 'Shelly 1PM 68C63AFAE2F9', 'mdl': 'Shelly 1PM', 'sw': '20211109-130756/v1.11.7-g682a0db', 'mf': 'Allterco Robotics', 'cu': 'http://192.168.4.34/'}, 'type': 'button_short_release', 'stype': 'button_1'}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] {'topic': 'homeassistant/device_automation/shelly1pm-68C63AFAE2F9-input-0/button_long_press/config', 'payload': '{"atype": "trigger", "t": "shellies/shelly1pm-68C63AFAE2F9/input_event/0", "pl": "L", "val_tpl": "{{value_json.event}}", "qos": 0, "dev": {"ids": ["68c63afae2f9"], "cns": [["mac", "68:c6:3a:fa:e2:f9"]], "name": "Shelly 1PM 68C63AFAE2F9", "mdl": "Shelly 1PM", "sw": "20211109-130756/v1.11.7-g682a0db", "mf": "Allterco Robotics", "cu": "http://192.168.4.34/"}, "type": "button_long_press", "stype": "button_1"}', 'retain': True, 'qos': 0}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] Sending to MQTT broker: homeassistant/device_automation/shelly1pm-68C63AFAE2F9-input-0/button_long_press/config {'atype': 'trigger', 't': 'shellies/shelly1pm-68C63AFAE2F9/input_event/0', 'pl': 'L', 'val_tpl': '{{value_json.event}}', 'qos': 0, 'dev': {'ids': ['68c63afae2f9'], 'cns': [['mac', '68:c6:3a:fa:e2:f9']], 'name': 'Shelly 1PM 68C63AFAE2F9', 'mdl': 'Shelly 1PM', 'sw': '20211109-130756/v1.11.7-g682a0db', 'mf': 'Allterco Robotics', 'cu': 'http://192.168.4.34/'}, 'type': 'button_long_press', 'stype': 'button_1'}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] {'topic': 'homeassistant/device_automation/shelly1pm-68C63AFAE2F9-input-0/button_short_press/config', 'payload': '{"atype": "trigger", "t": "shellies/shelly1pm-68C63AFAE2F9/input_event/0", "pl": "S", "val_tpl": "{{value_json.event}}", "qos": 0, "dev": {"ids": ["68c63afae2f9"], "cns": [["mac", "68:c6:3a:fa:e2:f9"]], "name": "Shelly 1PM 68C63AFAE2F9", "mdl": "Shelly 1PM", "sw": "20211109-130756/v1.11.7-g682a0db", "mf": "Allterco Robotics", "cu": "http://192.168.4.34/"}, "type": "button_short_press", "stype": "button_1"}', 'retain': True, 'qos': 0}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] Sending to MQTT broker: homeassistant/device_automation/shelly1pm-68C63AFAE2F9-input-0/button_short_press/config {'atype': 'trigger', 't': 'shellies/shelly1pm-68C63AFAE2F9/input_event/0', 'pl': 'S', 'val_tpl': '{{value_json.event}}', 'qos': 0, 'dev': {'ids': ['68c63afae2f9'], 'cns': [['mac', '68:c6:3a:fa:e2:f9']], 'name': 'Shelly 1PM 68C63AFAE2F9', 'mdl': 'Shelly 1PM', 'sw': '20211109-130756/v1.11.7-g682a0db', 'mf': 'Allterco Robotics', 'cu': 'http://192.168.4.34/'}, 'type': 'button_short_press', 'stype': 'button_1'}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] {'topic': 'homeassistant/sensor/shelly1pm-68C63AFAE2F9-ext-temperature-0/config', 'payload': '', 'retain': True, 'qos': 0}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] Sending to MQTT broker: homeassistant/sensor/shelly1pm-68C63AFAE2F9-ext-temperature-0/config 
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] {'topic': 'homeassistant/sensor/shelly1pm-68C63AFAE2F9-ext-temperature-1/config', 'payload': '', 'retain': True, 'qos': 0}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] Sending to MQTT broker: homeassistant/sensor/shelly1pm-68C63AFAE2F9-ext-temperature-1/config 
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] {'topic': 'homeassistant/sensor/shelly1pm-68C63AFAE2F9-ext-temperature-2/config', 'payload': '', 'retain': True, 'qos': 0}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] Sending to MQTT broker: homeassistant/sensor/shelly1pm-68C63AFAE2F9-ext-temperature-2/config 
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] {'topic': 'homeassistant/sensor/shelly1pm-68C63AFAE2F9-ext-humidity-0/config', 'payload': '', 'retain': True, 'qos': 0}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] Sending to MQTT broker: homeassistant/sensor/shelly1pm-68C63AFAE2F9-ext-humidity-0/config 
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] {'topic': 'homeassistant/binary_sensor/shelly1pm-68C63AFAE2F9-overtemperature/config', 'payload': '{"name": "Shelly 1PM 68C63AFAE2F9 Overtemperature", "stat_t": "~overtemperature", "en": "True", "uniq_id": "shelly1pm-68c63afae2f9-overtemperature", "qos": 0, "dev": {"ids": ["68c63afae2f9"], "cns": [["mac", "68:c6:3a:fa:e2:f9"]], "name": "Shelly 1PM 68C63AFAE2F9", "mdl": "Shelly 1PM", "sw": "20211109-130756/v1.11.7-g682a0db", "mf": "Allterco Robotics", "cu": "http://192.168.4.34/"}, "~": "shellies/shelly1pm-68C63AFAE2F9/", "entity_category": "diagnostic", "pl_on": "1", "pl_off": "0", "avty_t": "~online", "pl_avail": "true", "pl_not_avail": "false", "dev_cla": "problem"}', 'retain': True, 'qos': 0}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] Sending to MQTT broker: homeassistant/binary_sensor/shelly1pm-68C63AFAE2F9-overtemperature/config {'name': 'Shelly 1PM 68C63AFAE2F9 Overtemperature', 'stat_t': '~overtemperature', 'en': 'True', 'uniq_id': 'shelly1pm-68c63afae2f9-overtemperature', 'qos': 0, 'dev': {'ids': ['68c63afae2f9'], 'cns': [['mac', '68:c6:3a:fa:e2:f9']], 'name': 'Shelly 1PM 68C63AFAE2F9', 'mdl': 'Shelly 1PM', 'sw': '20211109-130756/v1.11.7-g682a0db', 'mf': 'Allterco Robotics', 'cu': 'http://192.168.4.34/'}, '~': 'shellies/shelly1pm-68C63AFAE2F9/', 'entity_category': 'diagnostic', 'pl_on': '1', 'pl_off': '0', 'avty_t': '~online', 'pl_avail': 'true', 'pl_not_avail': 'false', 'dev_cla': 'problem'}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] {'topic': 'homeassistant/binary_sensor/shelly1pm-68C63AFAE2F9-firmware-update/config', 'payload': '{"name": "Shelly 1PM 68C63AFAE2F9 Firmware Update", "stat_t": "~info", "en": "True", "uniq_id": "shelly1pm-68c63afae2f9-firmware-update", "qos": 0, "dev": {"ids": ["68c63afae2f9"], "cns": [["mac", "68:c6:3a:fa:e2:f9"]], "name": "Shelly 1PM 68C63AFAE2F9", "mdl": "Shelly 1PM", "sw": "20211109-130756/v1.11.7-g682a0db", "mf": "Allterco Robotics", "cu": "http://192.168.4.34/"}, "~": "shellies/shelly1pm-68C63AFAE2F9/", "entity_category": "diagnostic", "val_tpl": "{%if value_json[\'update\'].has_update==true%}ON{%else%}OFF{%endif%}", "avty_t": "~online", "pl_avail": "true", "pl_not_avail": "false", "dev_cla": "update", "json_attr_t": "~info", "json_attr_tpl": "{{value_json[\'update\']|tojson}}"}', 'retain': True, 'qos': 0}
2021-11-30 13:32:04 DEBUG (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] Sending to MQTT broker: homeassistant/binary_sensor/shelly1pm-68C63AFAE2F9-firmware-update/config {'name': 'Shelly 1PM 68C63AFAE2F9 Firmware Update', 'stat_t': '~info', 'en': 'True', 'uniq_id': 'shelly1pm-68c63afae2f9-firmware-update', 'qos': 0, 'dev': {'ids': ['68c63afae2f9'], 'cns': [['mac', '68:c6:3a:fa:e2:f9']], 'name': 'Shelly 1PM 68C63AFAE2F9', 'mdl': 'Shelly 1PM', 'sw': '20211109-130756/v1.11.7-g682a0db', 'mf': 'Allterco Robotics', 'cu': 'http://192.168.4.34/'}, '~': 'shellies/shelly1pm-68C63AFAE2F9/', 'entity_category': 'diagnostic', 'val_tpl': '{%if value_json[^update^].has_update==true%}ON{%else%}OFF{%endif%}', 'avty_t': '~online', 'pl_avail': 'true', 'pl_not_avail': 'false', 'dev_cla': 'update', 'json_attr_t': '~info', 'json_attr_tpl': '{{value_json[^update^]|tojson}}'}


2021-11-30 14:00:20 INFO (SyncWorker_8) [homeassistant.components.python_script] Executing shellies_discovery.py: {'id': 'shelly1pm-68C63AFAE2F9', 'mac': '68C63AFAE2F9', 'fw_ver': '20211109-130756/v1.11.7-g682a0db', 'model': 'SHSW-PM', 'mode': '', 'host': '192.168.4.34'}
2021-11-30 14:00:20 DEBUG (SyncWorker_8) 

and this is my working mqtt binary_sensor for this shelly 1pm:

name: "shelly1pm_68C63AFAE2F9_longpush"
unique_id: "shelly1pm_68C63AFAE2F9_longpush"
expire_after: 604800
payload_on: "1"
payload_off: "0"
qos: 1
state_topic: "shellies/shelly1pm-68C63AFAE2F9/longpush/0"

Fixed in Release Version 0.41.1 · bieniu/ha-shellies-discovery · GitHub

1 Like

Hi

I have succesfully installed the Shelly Discovery Script.
It works for all my shellies, except for one Shelly EM.
I have two Shelly EMs.
The powerline Shelly EM is working perfect. All sensors were found.
But the new one for my Solar panels was the device detected by the script… but no Sensor data is coming through.
If I add a manual MQTT sensor in the sensors.yaml file, Homeassistant is picking this up after restart. So the setup of the Solar Shelly EM is ok in my opinion.
Also the new solar Shelly EM has a larger ID name C15B51ECD7D1 (184178318414595) then the other older Powerline Shelly EM. So maybe the script can not handle this for the moment.

Can you help me to find a solution please?

Thanks

Marijn

Please post here debug log for python_script.

Hi

I made a html file of the log. It was too big to post.

Thanks

Marijn

Use pastebin or hastebin to post the log as a text file. HTML is nor readable.

Thanks for the tip:

Hi

Shellie EMs are working again as supposed.
Apparently there was a caching problem.

Thanks for the help anyway

Greetings

Marijn

@Bieniu I am considering whether to move away from your Shellies Discovery Script due to not supporting gen 2 shelly devices or not. I know that you were/are involved in the development of the native shelly integration for HA, so I am asking for your opinion.

I really like your script as it made it possible for me to without extra effort integrate all of my Shelly devices into HA, but I need to have at least one Shelly 1PM Plus, as I have a location with 1PM gen 1 which has a weak signal due to the distance from my AP’s and I am hoping that the 1PM Plus would overcome the problem.

Thanks,
Igor

I plan to write a script for gen2 devices but I have no idea when I will have time for that. Real life is very absorbing in the last days :wink: The core Shelly integration works very well, I use it with my Pro 4PM and I think it is a good choice at the moment.

New version: 0.42.0

Changelog:

  • add pre-commit
  • add support for Shelly Valve
  • rename uptime sensor to last restart
  • add support for button platform
  • remove device_info identifiers
  • fix errors in templates

Requirements:

  • Home Assistant 2021.12 or newer.
1 Like

@Bieniu This has nothing to do with the script but I have a question you probably know the answer.
I am trying to standardize my shelly device names in HA as I had a mixture of names.
Everything (almost) works OK, but when trying to rename my Shelly 2.5, HA asks me if I want to update all of my entity ID names and I say yes, it actually doesn’t do it so the entity ID names remains in the form .shelly_2_5_xxxxxx. Is it a bug in HA or …?
Thanks,
Igor

If you have changed the entity IDs manually before, HA will not change their IDs after changing device name. This is a feature to prevent automations/scripts from breaking.

They are all still on their factory names, ie sensor.shelly_2_5_xxxxxx_energy_0.
The only thing that I changed is the device name but it didn’t propagate itself on the entity ID’s.

It seems that I will have to set them manually…

One more question @Bieniu, if I may:
What are the correct steps for moving from the discovery script to the Shelly Integration?