oh, I thought that could be a bug in the script. Because if I don’t use the “ignore_mode” arguement the cases are correct.
This naming of devices is related to the feature request from a few months ago, if I remember correctly.
thanks it was that! last 24hrs have been smooth!!
Hi, I have some troubles to discover my Shellies 1 PM and a Shelly EM. All my Shellies dimmer 2 are working properly.
From the logs I get errors also on the dimmers
Exception in async_discover when dispatching 'mqtt_discovery_new_switch_mqtt': ({'name': 'Shelly 1PM luce_balcone2 Relay 0', 'command_topic': 'shellies/luce_balcone2/relay/0/command', 'state_topic': 'shellies/luce_balcone2/relay/0', 'payload_off': 'off', 'payload_on': 'on', 'availability_topic': 'shellies/luce_balcone2/online', 'payload_available': 'true', 'payload_not_available': 'false', 'unique_id': 'luce_balcone2-relay-0', 'qos': 0, 'device': {'identifiers': ['d8bfc01a1158'], 'connections': [['mac', 'd8:bf:c0:1a:11:58']], 'name': 'Shelly 1PM luce_balcone2', 'model': 'Shelly 1PM', 'sw_version': '20210909-145919/v1.11.4-DNSfix-ge6b2f6d', 'manufacturer': 'Allterco Robotics', 'cu': 'http://None/'}, 'platform': 'mqtt'},) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/mqtt/mixins.py", line 180, in async_discover config = schema(discovery_payload) File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 272, in __call__ return self._compiled([], data) File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict return base_validate(path, iteritems(data), out) File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping raise er.MultipleInvalid(errors) voluptuous.error.MultipleInvalid: extra keys not allowed @ data['device']['cu']
Exception in async_discover when dispatching 'mqtt_discovery_new_switch_mqtt': ({'name': 'Shelly EM power_monitor Relay 0', 'command_topic': 'shellies/power_monitor/relay/0/command', 'state_topic': 'shellies/power_monitor/relay/0', 'payload_off': 'off', 'payload_on': 'on', 'availability_topic': 'shellies/power_monitor/online', 'payload_available': 'true', 'payload_not_available': 'false', 'unique_id': 'power_monitor-relay-0', 'qos': 0, 'device': {'identifiers': ['68c63af9d429'], 'connections': [['mac', '68:c6:3a:f9:d4:29']], 'name': 'Shelly EM power_monitor', 'model': 'Shelly EM', 'sw_version': '20210909-150325/v1.11.4-DNSfix-ge6b2f6d', 'manufacturer': 'Allterco Robotics', 'cu': 'http://None/'}, 'platform': 'mqtt'},) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/mqtt/mixins.py", line 180, in async_discover config = schema(discovery_payload) File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 272, in __call__ return self._compiled([], data) File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict return base_validate(path, iteritems(data), out) File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping raise er.MultipleInvalid(errors) voluptuous.error.MultipleInvalid: extra keys not allowed @ data['device']['cu']
Exception in async_discover when dispatching 'mqtt_discovery_new_device_automation_mqtt': ({'automation_type': 'trigger', 'topic': 'shellies/luce_cucina/input/0', 'payload': '0', 'qos': 0, 'device': {'identifiers': ['e8db84d78943'], 'connections': [['mac', 'e8:db:84:d7:89:43']], 'name': 'Shelly Dimmer 2 luce_cucina', 'model': 'Shelly Dimmer 2', 'sw_version': '20210909-150154/v1.11.4-DNSfix-ge6b2f6d', 'manufacturer': 'Allterco Robotics', 'cu': 'http://None/'}, 'type': 'button_short_release', 'subtype': 'button_1', 'platform': 'mqtt'},) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/mqtt/mixins.py", line 181, in async_discover await async_setup(config, discovery_data=discovery_data) File "/usr/src/homeassistant/homeassistant/components/mqtt/device_automation.py", line 40, in _async_setup_automation await device_trigger.async_setup_trigger( File "/usr/src/homeassistant/homeassistant/components/mqtt/device_trigger.py", line 201, in async_setup_trigger config = TRIGGER_DISCOVERY_SCHEMA(config) File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 272, in __call__ return self._compiled([], data) File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict return base_validate(path, iteritems(data), out) File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping raise er.MultipleInvalid(errors) voluptuous.error.MultipleInvalid: extra keys not allowed @ data['device']['cu']
Exception in async_discover when dispatching 'mqtt_discovery_new_device_automation_mqtt': ({'automation_type': 'trigger', 'topic': 'shellies/luce_cucina/input_event/0', 'payload': 'L', 'value_template': '{{value_json.event}}', 'qos': 0, 'device': {'identifiers': ['e8db84d78943'], 'connections': [['mac', 'e8:db:84:d7:89:43']], 'name': 'Shelly Dimmer 2 luce_cucina', 'model': 'Shelly Dimmer 2', 'sw_version': '20210909-150154/v1.11.4-DNSfix-ge6b2f6d', 'manufacturer': 'Allterco Robotics', 'cu': 'http://None/'}, 'type': 'button_long_press', 'subtype': 'button_1', 'platform': 'mqtt'},) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/mqtt/mixins.py", line 181, in async_discover await async_setup(config, discovery_data=discovery_data) File "/usr/src/homeassistant/homeassistant/components/mqtt/device_automation.py", line 40, in _async_setup_automation await device_trigger.async_setup_trigger( File "/usr/src/homeassistant/homeassistant/components/mqtt/device_trigger.py", line 201, in async_setup_trigger config = TRIGGER_DISCOVERY_SCHEMA(config) File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 272, in __call__ return self._compiled([], data) File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict return base_validate(path, iteritems(data), out) File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping raise er.MultipleInvalid(errors) voluptuous.error.MultipleInvalid: extra keys not allowed @ data['device']['cu']
Exception in async_discover when dispatching 'mqtt_discovery_new_device_automation_mqtt': ({'automation_type': 'trigger', 'topic': 'shellies/luce_cucina/input_event/0', 'payload': 'S', 'value_template': '{{value_json.event}}', 'qos': 0, 'device': {'identifiers': ['e8db84d78943'], 'connections': [['mac', 'e8:db:84:d7:89:43']], 'name': 'Shelly Dimmer 2 luce_cucina', 'model': 'Shelly Dimmer 2', 'sw_version': '20210909-150154/v1.11.4-DNSfix-ge6b2f6d', 'manufacturer': 'Allterco Robotics', 'cu': 'http://None/'}, 'type': 'button_short_press', 'subtype': 'button_1', 'platform': 'mqtt'},) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/mqtt/mixins.py", line 181, in async_discover await async_setup(config, discovery_data=discovery_data) File "/usr/src/homeassistant/homeassistant/components/mqtt/device_automation.py", line 40, in _async_setup_automation await device_trigger.async_setup_trigger( File "/usr/src/homeassistant/homeassistant/components/mqtt/device_trigger.py", line 201, in async_setup_trigger config = TRIGGER_DISCOVERY_SCHEMA(config) File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 272, in __call__ return self._compiled([], data) File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict return base_validate(path, iteritems(data), out) File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping raise er.MultipleInvalid(errors) voluptuous.error.MultipleInvalid: extra keys not allowed @ data['device']['cu']
any suggestion to make the 1PM and EM work?
Why are you using the script from master branch?
Hi,
I have a problem with Shellybutton1. I have done as instructed (hopefully) to setup this script. I downloaded 0.41.0 “shellies_discovery.py” and put it into phyton_scripts (before I had master branch script). I restarted the home assistant several time thinking the problem is in old cached script, as you wrote in previous comment about using master branch script @Bieniu
when I click the shelly button I get in log and the button does not show up:
2021-11-04 11:31:15 INFO (MainThread) [homeassistant.components.automation.shellies_discovery] Shellies Discovery: Running automation actions
2021-11-04 11:31:15 INFO (MainThread) [homeassistant.components.automation.shellies_discovery] Shellies Discovery: Executing step call service
2021-11-04 11:31:16 INFO (SyncWorker_4) [homeassistant.components.python_script] Executing shellies_discovery.py: {'id': 'shellybutton1-C45BBE6BAE45', 'mac': 'C45BBE6BAE45', 'fw_ver': '20211004-121522/v1.11.5-gdedfb52', 'model': 'SHBTN-2', 'mode': '', 'host': '192.168.1.70', 'discovery_prefix': 'homeassistant', 'qos': 2, 'shelly1-AABB9900': {'relay-0': 'light', 'ext-temperature-0': True, 'ext-temperature-1': True, 'ext-temperature-2': True, 'force_update_sensors': True, 'ext-switch': True}, 'shelly1pm-aabb9911': {'ext-temperature-0': True, 'ext-humidity-0': True, 'push_off_delay': False, 'force_update_sensors': True}, 'shelly1l-ddbb9911': {'ext-temperature-0': True, 'ext-temperature-1': True, 'ext-temperature-2': True, 'ext-humidity-0': True}, 'shellyswitch-123409FF': {'relay-0': 'fan', 'relay-0-name': 'Bathroom Fan', 'relay-1': 'light', 'relay-1-name': 'Livingroom Light'}, 'shellyswitch-123409cc': {'relay-1': 'fan'}, 'shellydimmer-883409cc': {'light-0-name': 'Bedroom Lamp'}, 'shellyswitch25-334455AA': {'roller-0-name': 'Garage', 'roller-0-class': 'garage'}, 'shellyplug-s-CCBBCCAA': {'relay-0': 'light', 'force_update_sensors': True}, 'shellyht-11AA00CCDD': {'force_update_sensors': True, 'expire_after': 500}, 'shellyht-11AA00CCEE': {'powered': 'battery'}, 'shellyht-11AA00CCFF': {'powered': 'ac'}, 'shellyswitch2-AA4455AA': {'position_template': '{% if value | float < 30 %}0{% else %}{{ value }}{% endif %}', 'set_position_template': '{%if position | float < 30 %}0{% else %}{{ position }}{% endif %}'}, 'shellybutton1-112200CCFF': {'powered': 'ac'}, 'shellymotionsensor-113300CCFF': {'powered': 'ac'}, 'shellyrgbw2-AA123FF32': {'light-1-name': 'Living room', 'light-2-name': 'Bedroom', 'light-3-name': 'Kitchen'}, 'shellyem-BB23CC45': {'force_update_sensors': True}, 'ignored_devices': ['shelly1-DD0011', 'shellyem-EECC22']}
2021-11-04 11:31:16 DEBUG (SyncWorker_4) [homeassistant.components.python_script.shellies_discovery.py] id: shellybutton1-C45BBE6BAE45, mac: c45bbe6bae45, fw_ver: 20211004-121522/v1.11.5-gdedfb52, model: SHBTN-2
2021-11-04 11:31:16 DEBUG (SyncWorker_4) [homeassistant.components.python_script.shellies_discovery.py] {'topic': 'homeassistant/sensor/shellybutton1-C45BBE6BAE45-battery/config', 'payload': '{"name": "Shelly Button1 C45BBE6BAE45 Battery", "stat_t": "~sensor/battery", "frc_upd": "False", "en": "True", "uniq_id": "shellybutton1-c45bbe6bae45-battery", "qos": 2, "dev": {"ids": ["c45bbe6bae45"], "cns": [["mac", "c4:5b:be:6b:ae:45"]], "name": "Shelly Button1 C45BBE6BAE45", "mdl": "Shelly Button1", "sw": "20211004-121522/v1.11.5-gdedfb52", "mf": "Allterco Robotics", "cu": "http://192.168.1.70/"}, "~": "shellies/shellybutton1-C45BBE6BAE45/", "entity_category": "diagnostic", "stat_cla": "measurement", "unit_of_meas": "%", "dev_cla": "battery", "val_tpl": "{{value|float|round}}", "exp_aft": 51839}', 'retain': True, 'qos': 0}
2021-11-04 11:31:16 DEBUG (SyncWorker_4) [homeassistant.components.python_script.shellies_discovery.py] Sending to MQTT broker: homeassistant/sensor/shellybutton1-C45BBE6BAE45-battery/config {'name': 'Shelly Button1 C45BBE6BAE45 Battery', 'stat_t': '~sensor/battery', 'frc_upd': 'False', 'en': 'True', 'uniq_id': 'shellybutton1-c45bbe6bae45-battery', 'qos': 2, 'dev': {'ids': ['c45bbe6bae45'], 'cns': [['mac', 'c4:5b:be:6b:ae:45']], 'name': 'Shelly Button1 C45BBE6BAE45', 'mdl': 'Shelly Button1', 'sw': '20211004-121522/v1.11.5-gdedfb52', 'mf': 'Allterco Robotics', 'cu': 'http://192.168.1.70/'}, '~': 'shellies/shellybutton1-C45BBE6BAE45/', 'entity_category': 'diagnostic', 'stat_cla': 'measurement', 'unit_of_meas': '%', 'dev_cla': 'battery', 'val_tpl': '{{value|float|round}}', 'exp_aft': 51839}
2021-11-04 11:31:16 DEBUG (MainThread) [homeassistant.components.mqtt] Transmitting message on homeassistant/sensor/shellybutton1-C45BBE6BAE45-battery/config: '{"name": "Shelly Button1 C45BBE6BAE45 Battery", "stat_t": "~sensor/battery", "frc_upd": "False", "en": "True", "uniq_id": "shellybutton1-c45bbe6bae45-battery", "qos": 2, "dev": {"ids": ["c45bbe6bae45"], "cns": [["mac", "c4:5b:be:6b:ae:45"]], "name": "Shelly Button1 C45BBE6BAE45", "mdl": "Shelly Button1", "sw": "20211004-121522/v1.11.5-gdedfb52", "mf": "Allterco Robotics", "cu": "http://192.168.1.70/"}, "~": "shellies/shellybutton1-C45BBE6BAE45/", "entity_category": "diagnostic", "stat_cla": "measurement", "unit_of_meas": "%", "dev_cla": "battery", "val_tpl": "{{value|float|round}}", "exp_aft": 51839}', mid: 252
2021-11-04 11:31:16 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on homeassistant/sensor/shellybutton1-C45BBE6BAE45-battery/config: b'{"name": "Shelly Button1 C45BBE6BAE45 Battery", "stat_t": "~sensor/battery", "frc_upd": "False", "en": "True", "uniq_id": "shellybutton1-c45bbe6bae45-battery", "qos": 2, "dev": {"ids": ["c45bbe6bae45"], "cns": [["mac", "c4:5b:be:6b:ae:45"]], "name": "Shelly Button1 C45BBE6BAE45", "mdl": "Shelly Button1", "sw": "20211004-121522/v1.11.5-gdedfb52", "mf": "Allterco Robotics", "cu": "http://192.168.1.70/"}, "~": "shellies/shellybutton1-C45BBE6BAE45/", "entity_category": "diagnostic", "stat_cla": "measurement", "unit_of_meas": "%", "dev_cla": "battery", "val_tpl": "{{value|float|round}}", "exp_aft": 51839}'
2021-11-04 11:31:16 DEBUG (SyncWorker_4) [homeassistant.components.python_script.shellies_discovery.py] {'topic': 'homeassistant/sensor/shellybutton1-C45BBE6BAE45-rssi/config', 'payload': '', 'retain': True, 'qos': 0}
2021-11-04 11:31:16 DEBUG (SyncWorker_4) [homeassistant.components.python_script.shellies_discovery.py] Sending to MQTT broker: homeassistant/sensor/shellybutton1-C45BBE6BAE45-rssi/config
2021-11-04 11:31:16 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Process discovery payload {'name': 'Shelly Button1 C45BBE6BAE45 Battery', 'state_topic': 'shellies/shellybutton1-C45BBE6BAE45/sensor/battery', 'force_update': 'False', 'enabled_by_default': 'True', 'unique_id': 'shellybutton1-c45bbe6bae45-battery', 'qos': 2, 'device': {'identifiers': ['c45bbe6bae45'], 'connections': [['mac', 'c4:5b:be:6b:ae:45']], 'name': 'Shelly Button1 C45BBE6BAE45', 'model': 'Shelly Button1', 'sw_version': '20211004-121522/v1.11.5-gdedfb52', 'manufacturer': 'Allterco Robotics', 'cu': 'http://192.168.1.70/'}, 'entity_category': 'diagnostic', 'state_class': 'measurement', 'unit_of_measurement': '%', 'device_class': 'battery', 'value_template': '{{value|float|round}}', 'expire_after': 51839, 'platform': 'mqtt'}
2021-11-04 11:31:16 INFO (MainThread) [homeassistant.components.mqtt.discovery] Found new component: sensor shellybutton1-C45BBE6BAE45-battery
2021-11-04 11:31:16 ERROR (MainThread) [homeassistant.util.logging] Exception in async_discover when dispatching 'mqtt_discovery_new_sensor_mqtt': ({'name': 'Shelly Button1 C45BBE6BAE45 Battery', 'state_topic': 'shellies/shellybutton1-C45BBE6BAE45/sensor/battery', 'force_update': 'False', 'enabled_by_default': 'True', 'unique_id': 'shellybutton1-c45bbe6bae45-battery', 'qos': 2, 'device': {'identifiers': ['c45bbe6bae45'], 'connections': [['mac', 'c4:5b:be:6b:ae:45']], 'name': 'Shelly Button1 C45BBE6BAE45', 'model': 'Shelly Button1', 'sw_version': '20211004-121522/v1.11.5-gdedfb52', 'manufacturer': 'Allterco Robotics', 'cu': 'http://192.168.1.70/'}, 'entity_category': 'diagnostic', 'state_class': 'measurement', 'unit_of_measurement': '%', 'device_class': 'battery', 'value_template': '{{value|float|round}}', 'expire_after': 51839, 'platform': 'mqtt'},)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/mqtt/mixins.py", line 180, in async_discover
config = schema(discovery_payload)
File "/usr/local/lib/python3.9/site-packages/voluptuous/validators.py", line 218, in __call__
return self._exec((Schema(val) for val in self.validators), v)
File "/usr/local/lib/python3.9/site-packages/voluptuous/validators.py", line 341, in _exec
raise e if self.msg is None else AllInvalid(self.msg, path=path)
File "/usr/local/lib/python3.9/site-packages/voluptuous/validators.py", line 337, in _exec
v = func(v)
File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 272, in __call__
return self._compiled([], data)
File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 817, in validate_callable
return schema(data)
File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 272, in __call__
return self._compiled([], data)
File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict
return base_validate(path, iteritems(data), out)
File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping
raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: extra keys not allowed @ data['device']['cu']
and here is my shellies_discovery.py:
I updated now to core-2021.11.1 . Shelly button appears now.
Great work and thank you on this script.
Has anyone gotten the script to discover Shelly Plus 1PM devices?
MQTT is visible on the broker but the device is not being discovered. Shelly Button 1 has been detected without issues.
Pro/plus devices are not supported.
Noted. Thanks for the quick reply!
I have an issue with a 2.5 in roller mode. I also have one in detached switch/relay mode that works fine but the roller only allows me to roll up or stop but not down.
my automations:
- id: shellies_announce
alias: Shellies Announce
trigger:
- platform: homeassistant
event: start
- platform: time_pattern
hours: /1
action:
service: mqtt.publish
data:
topic: shellies/command
payload: announce
- id: shellies_discovery
alias: Shellies Discovery
mode: queued
max: 999
trigger:
platform: mqtt
topic: shellies/announce
action:
service: python_script.shellies_discovery
data:
id: '{{ trigger.payload_json.id }}'
mac: '{{ trigger.payload_json.mac }}'
fw_ver: '{{ trigger.payload_json.fw_ver }}'
model: '{{ trigger.payload_json.model }}'
mode: '{{ trigger.payload_json.mode | default }}'
host: '{{ trigger.payload_json.ip }}'
beamerlift:
mode: roller
I tried with and without roller mode but that did not change anything … any pointers?
EDIT: Firmware: 20211109-125214/v1.11.7-g682a0db
Debug log?
Hi, When support for Shelly 1 plus?
Thanks!!
Probably never. Configuration differences between generation 1 and 2 are too big. I plan to create a new script for gen 2 devices, but not this year
Thanks for the info @Bieniu!
I was planning to purchase some gen 2 devices, but without your script it could be a PITA
Gen2 devices work very well with the core integration.
I notice that when I restart home assistant, some of my mqtt entities become unavailable. It seems that if I trigger a change, it becomes available.
I have read up on retained messages, but before I make a change that could perhaps break more than it fixes I wanted to make sure: if I click the Retain box in the Shelly devices, will that fix this issue, and not create any other issue? Like turning on lights when restarting Home assistant?
I recommend disabling “clean session” and enabling “retain”.
I want to use longpush via shelly 1PM but it not work. When I used this via Shelly dimmer it works. If I look via MQTT Explorer to MQTT communication I saw that the longpush will send from the shelly 1PM device
shellies/shelly1pm-XXXXXXX/longpush/0
And when I create a own MQTT binary_sensor like this:
platform: mqtt
name: "Shelly1PM-example-longpush"
unique_id: "shelly_1pm_example_longpush"
expire_after: 604800
payload_on: 1
payload_off: 0
qos: 1
state_topic: "shellies/shelly1pm-XXXXXXX/longpush/0"
it also work. Is it a bug in the shelly discovery script or did I make something wrong?