bieniu / ha-shellies-discovery Goto Github PK
View Code? Open in Web Editor NEWScript that adds MQTT discovery support for Shellies devices
License: Apache License 2.0
Script that adds MQTT discovery support for Shellies devices
License: Apache License 2.0
For the Shelly H&T the Device Argument table has "powered" as an entry, the Custom configuration example uses "power"
Currently, the uptime is reported in days (https://github.com/bieniu/ha-shellies-discovery/blob/master/python_scripts/shellies_discovery.py#L254 ). The raw value is seconds, and this seems to be the convention for most other devices I have. Can you report seconds directly, and if someone wants days, they can create an HA template sensor to convert it.
I have a shelly 1 with 3 temp sensors working fine, and sending MQTT payloads:
shellies/shelly1-F42054/ext_temperature_f/0
shellies/shelly1-F42054/ext_temperature_f/1
shellies/shelly1-F42054/ext_temperature_f/2
shellies/shelly1-F42054/ext_temperature/0
shellies/shelly1-F42054/ext_temperature/1
shellies/shelly1-F42054/ext_temperature/2
(monitored with MQTT.fx)
but in HA Mosquito MQTT intergrations it only shows up with relais and input as if no addon attached,
is this correct and do I need to setup sensors throu yaml?
or am I doing someting wrong.
The repositoy cannot be added to HACS. I get the following error message:
Repostitory structure for 0.26.0 is not compliant
It would be also nice to see this repo in the default HACS repository list.
Hey,
As per issue #4, I cannot install this using HACS. I removed the integration, reinstalled it (making sure to check the python_script integration), but it doesn't show up. I've restarted HA in between, but no dice.
When I checked the configuration on https://hacs.xyz/docs/configuration/basic, it is listed that python_scripts and themes are deprecated - and they actually don't show up in my GUI anymore :(
EDIT: Nevermind. You actually need to add python_script:
to your configuration.yaml
or nothing happens in HACS.
The script discovers the Shelly 1PM but does not discover the temperature add-on connected to that Shelly.
Hi,
after a restart the energy meter "0" is duplicated inside the entity registry.
During startup i can find:
Component has already been discovered: sensor shellyem-B9F090-power-0, sending update
Component has already been discovered: sensor shellyem-B9F090-energy-0, sending update
Registered new sensor.mqtt entity: sensor.shellyem_b9f090_power_0_2
Registered new sensor.mqtt entity: sensor.shellyem_b9f090_energy_0_2
To fix i have to manually adjust the entity_id on the device page:
Deleting the duplicated "_0" entities and renaming back the "_0_2" one to "_0"
Can you help me?
Thanks
My shelly door windows 2 is not recognized. Could you give support, please.
hi
I see mutch error after installing shelly discovery.
cold you help me?
2020-06-01 02:04:17 ERROR (SyncWorker_5) [homeassistant.components.python_script.shellies_discovery.py] Error executing script: 'NoneType' object is not callable
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/init.py", line 205, in execute
exec(compiled.code, restricted_globals)
File "shellies_discovery.py", line 560, in
TypeError: 'NoneType' object is not callable
2020-06-01 02:04:24 ERROR (SyncWorker_16) [homeassistant.components.python_script.shellies_discovery.py] Error executing script: 'NoneType' object is not callable
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/init.py", line 205, in execute
exec(compiled.code, restricted_globals)
File "shellies_discovery.py", line 560, in
TypeError: 'NoneType' object is not callable
2020-06-01 02:04:27 ERROR (SyncWorker_7) [homeassistant.components.python_script.shellies_discovery.py] Error executing script: list index out of range
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/init.py", line 205, in execute
exec(compiled.code, restricted_globals)
File "shellies_discovery.py", line 783, in
File "/usr/local/lib/python3.7/site-packages/RestrictedPython/Eval.py", line 35, in default_guarded_getitem
return ob[index]
IndexError: list index out of range
2020-06-01 02:04:30 ERROR (SyncWorker_13) [homeassistant.components.python_script.shellies_discovery.py] Error executing script: 'NoneType' object is not callable
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/init.py", line 205, in execute
exec(compiled.code, restricted_globals)
File "shellies_discovery.py", line 560, in
TypeError: 'NoneType' object is not callable
2020-06-01 02:04:30 ERROR (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] Error executing script: 'NoneType' object is not callable
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/init.py", line 205, in execute
exec(compiled.code, restricted_globals)
File "shellies_discovery.py", line 560, in
TypeError: 'NoneType' object is not callable
2020-06-01 02:04:30 ERROR (SyncWorker_10) [homeassistant.components.python_script.shellies_discovery.py] Error executing script: 'NoneType' object is not callable
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/init.py", line 205, in execute
exec(compiled.code, restricted_globals)
File "shellies_discovery.py", line 560, in
TypeError: 'NoneType' object is not callable
2020-06-01 02:04:31 ERROR (SyncWorker_16) [homeassistant.components.python_script.shellies_discovery.py] Error executing script: 'NoneType' object is not callable
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/init.py", line 205, in execute
exec(compiled.code, restricted_globals)
File "shellies_discovery.py", line 560, in
TypeError: 'NoneType' object is not callable
2020-06-01 02:04:33 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.temperatura_cpu is taking over 10 seconds
2020-06-01 02:04:33 WARNING (MainThread) [homeassistant.components.sensor] Updating command_line sensor took longer than the scheduled update interval 0:00:10
2020-06-01 02:04:34 ERROR (SyncWorker_6) [homeassistant.components.python_script.shellies_discovery.py] Error executing script: list index out of range
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/init.py", line 205, in execute
exec(compiled.code, restricted_globals)
File "shellies_discovery.py", line 783, in
File "/usr/local/lib/python3.7/site-packages/RestrictedPython/Eval.py", line 35, in default_guarded_getitem
return ob[index]
IndexError: list index out of range
2020-06-01 02:04:34 ERROR (SyncWorker_15) [homeassistant.components.python_script.shellies_discovery.py] Error executing script: list index out of range
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/init.py", line 205, in execute
exec(compiled.code, restricted_globals)
File "shellies_discovery.py", line 783, in
File "/usr/local/lib/python3.7/site-packages/RestrictedPython/Eval.py", line 35, in default_guarded_getitem
return ob[index]
IndexError: list index out of range
2020-06-01 02:04:34 ERROR (SyncWorker_8) [homeassistant.components.python_script.shellies_discovery.py] Error executing script: list index out of range
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/init.py", line 205, in execute
exec(compiled.code, restricted_globals)
File "shellies_discovery.py", line 783, in
File "/usr/local/lib/python3.7/site-packages/RestrictedPython/Eval.py", line 35, in default_guarded_getitem
return ob[index]
IndexError: list index out of range
2020-06-01 02:04:34 ERROR (SyncWorker_2) [homeassistant.components.python_script.shellies_discovery.py] Error executing script: list index out of range
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/init.py", line 205, in execute
exec(compiled.code, restricted_globals)
File "shellies_discovery.py", line 783, in
File "/usr/local/lib/python3.7/site-packages/RestrictedPython/Eval.py", line 35, in default_guarded_getitem
return ob[index]
IndexError: list index out of range
2020-06-01 02:04:34 ERROR (SyncWorker_0) [homeassistant.components.python_script.shellies_discovery.py] Error executing script: list index out of range
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/init.py", line 205, in execute
exec(compiled.code, restricted_globals)
File "shellies_discovery.py", line 783, in
File "/usr/local/lib/python3.7/site-packages/RestrictedPython/Eval.py", line 35, in default_guarded_getitem
return ob[index]
IndexError: list index out of range
2020-06-01 02:04:35 ERROR (SyncWorker_5) [homeassistant.components.python_script.shellies_discovery.py] Error executing script: list index out of range
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/init.py", line 205, in execute
exec(compiled.code, restricted_globals)
File "shellies_discovery.py", line 783, in
File "/usr/local/lib/python3.7/site-packages/RestrictedPython/Eval.py", line 35, in default_guarded_getitem
return ob[index]
IndexError: list index out of range
2020-06-01 02:04:35 ERROR (SyncWorker_19) [homeassistant.components.python_script.shellies_discovery.py] Error executing script: list index out of range
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/init.py", line 205, in execute
exec(compiled.code, restricted_globals)
File "shellies_discovery.py", line 783, in
File "/usr/local/lib/python3.7/site-packages/RestrictedPython/Eval.py", line 35, in default_guarded_getitem
return ob[index]
IndexError: list index out of range
2020-06-01 02:04:35 ERROR (SyncWorker_12) [homeassistant.components.python_script.shellies_discovery.py] Error executing script: list index out of range
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/init.py", line 205, in execute
exec(compiled.code, restricted_globals)
File "shellies_discovery.py", line 783, in
File "/usr/local/lib/python3.7/site-packages/RestrictedPython/Eval.py", line 35, in default_guarded_getitem
return ob[index]
IndexError: list index out of range
2020-06-01 02:04:35 ERROR (SyncWorker_4) [homeassistant.components.python_script.shellies_discovery.py] Error executing script: list index out of range
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/init.py", line 205, in execute
exec(compiled.code, restricted_globals)
File "shellies_discovery.py", line 783, in
File "/usr/local/lib/python3.7/site-packages/RestrictedPython/Eval.py", line 35, in default_guarded_getitem
return ob[index]
IndexError: list index out of range
Example:
- id: 'shellies_discovery'
alias: 'Shellies Discovery'
trigger:
- platform: mqtt
topic: shellies/announce
action:
service: python_script.shellies_discovery
data_template:
id: '{{ trigger.payload_json.id }}'
mac: '{{ trigger.payload_json.mac }}'
fw_ver: '{{ trigger.payload_json.fw_ver }}'
discovery_prefix: 'hass'
qos: 2
shelly1-001122:
relay-0: 'light'
shellyswitch-9900AA:
relay-0: 'light'
relay-1: 'fan'
longpush_off_delay: true
force_update_sensors: true
shellyswitch25-334411:
relay-1: 'light'
longpush_off_delay: false
force_update_sensors: false
shellyswitch-334455:
mode: 'roller'
shellyrgbw2-AABB22:
mode: 'white'
shellyrgbw2-AABB22:
mode: 'rgbw'
shellyht-2200AA:
power: 'ac'
shellyht-2200BB:
power: 'battery'
shelly1-001122:
ext-0: 'temperature'
ext-1: 'temperature'
ext-2: 'temperature'
ignored_devices:
- shelly1-DD0011
- shellyem-EECC22
To control the bulb with a simple on-off switch functionality, use:
shellies/ShellyVintage-/light/0/command accepts on and off payloads
shellies/ShellyVintage-/light/0 is used by the device to report its current on-off state
For controlling other parameters of the light channel publish to:
shellies/ShellyVintage-/light/0/set
The device expects a JSON payload on this topic, with the following sample contents:
{
"brightness": 100, /* brightness, 0..100 /
"turn": "on" / "on", "off" or "toggle" */
}
A JSON payload will be published by Shelly Vintage on:
shellies/ShellyVintage-/light/0/status
Subscribers can use this to obtain the latest device state.
{
"ison": false, /* whether the bulb is on /
"has_timer": false, / whether a timer is currently armed /
"timer_remaining": 0, / if there is an active timer, shows seconds until timer elapses; 0 otherwise /
"brightness": 90 / brightness, 0..100 */
}
Power and energy info can be obtained at:
shellies/ShellyVintage-/light/0/power reports instantaneous power consumption rate in Watts
shellies/ShellyVintage-/light/0/energy reports amount of energy consumed in Watt-minute
It would be great if the cover device_class
e.g. shutter
could also be specified, because different cover types have different icons for open and closed state. The standard icon actually does not show rollers, the rollers are better shown as cover shutters:
Also it would be great if the current movement direction would be shown in real time, like the ShellyForHASS does (could probably work based on the state topic and a proper value template, not sure exactly how to do it):
Finally I suggest to add support for the position feature as a sensor and as an input_number (when number is entered, the cover.set_cover_position service could be called):
Example code for the position sensor:
sensor:
- platform: mqtt
name: "Roller Left Bedroom Position"
icon: mdi:window-shutter-open
unit_of_measurement: "%"
availability_topic: "shellies/shellyswitch25-xyz/online"
state_topic: "shellies/shellyswitch25-bed_xyz/roller/0/pos"
json_attributes_topic: "shellies/shellyswitch25-xyz/announce"
# json_attributes_template: "{{ tbd }}"
value_template: "{{ value }}"
payload_available: "true"
payload_not_available: "false"
# expire_after: 30
# off_delay: 30
force_update: false
qos: 2
shellies/shellyswitch-/relay/ to report status: on, off or overpower
I'm running the script but get an error. It indicates that there's a FW upgrade required but my devices already are on 1.8.0. This was the reason for me to move to MQTT.
2020-08-23 15:40:15 ERROR (SyncWorker_19) [homeassistant.components.python_script.shellies_discovery.py] Error executing script: Firmware version 1.8.0 is required, please update your device {{ trigger.payload_json.id }}
Traceback (most recent call last):
File "shellies_discovery.py", line 350, in
File "/usr/local/lib/python3.8/site-packages/RestrictedPython/Eval.py", line 35, in default_guarded_getitem
return ob[index]
IndexError: list index out of range
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/init.py", line 205, in execute
exec(compiled.code, restricted_globals)
File "shellies_discovery.py", line 352, in
ValueError: Firmware version 1.8.0 is required, please update your device {{ trigger.payload_json.id }}
2020-08-23 15:40:16 INFO (MainThread) [homeassistant.components.automation.shellies_discovery] shellies_discovery: Running script
2020-08-23 15:40:16 INFO (MainThread) [homeassistant.components.automation.shellies_discovery] shellies_discovery: Executing step call service
2020-08-23 15:40:16 INFO (SyncWorker_12) [homeassistant.components.python_script] Executing shellies_discovery.py: {'fw_ver': '{{ trigger.payload_json.fw_ver }}', 'id': '{{ trigger.payload_json.id }}', 'mac': '{{ trigger.payload_json.mac }}', 'shelly1pm-68C63AFAD367': OrderedDict([('force_update_sensors', False)]), 'shellydimmer-DB3DAC': OrderedDict([('force_update_sensors', False)])}
2020-08-23 15:40:16 ERROR (SyncWorker_12) [homeassistant.components.python_script.shellies_discovery.py] Error executing script: Firmware version 1.8.0 is required, please update your device {{ trigger.payload_json.id }}
Traceback (most recent call last):
File "shellies_discovery.py", line 350, in
File "/usr/local/lib/python3.8/site-packages/RestrictedPython/Eval.py", line 35, in default_guarded_getitem
return ob[index]
IndexError: list index out of range
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/init.py", line 205, in execute
exec(compiled.code, restricted_globals)
File "shellies_discovery.py", line 352, in
ValueError: Firmware version 1.8.0 is required, please update your device {{ trigger.payload_json.id }}
=================
Hi,
since I installed firmware 1.8 on my shelly 1 (and updated your script) I'm getting a strange beahviour.
Sometimes the two entities (for RSSI and SSID) became unavailable
even if the shelly itself is online and every other entities created by your script works fine.
I even checked in the MQTT broker and I found the RSSI and SSID right there.
It looks like this issue temporarely disappear every time I restart HA.
Hi, firstly let me say thankyou for the excellent work you have done on this script.
I have Shelly 1's, Shelly 2.5's and shelly rgbw2's that are discovered without problems. But it does say that the scrips supports shelly 4pro's, but the latest firmware for the shelly 4pro is less than 1.8.0, it is 20200716-114943/1.6.5_4Pro@2092f96b so they are not detected. Is it possible for this firmware to be accepted by your script ? I have included the entry from the log below.
Many Thanks Paul.
2020-08-22 16:35:55 INFO (SyncWorker_56) [homeassistant.components.python_script] Executing shellies_discovery.py: {'id': 'shellypro4-4', 'mac': 'E415F64D0105', 'fw_ver': '20200716-114943/1.6.5_4Pro@2092f96b'}
2020-08-22 16:35:55 ERROR (SyncWorker_56) [homeassistant.components.python_script.shellies_discovery.py] Error executing script: Firmware version 1.8.0 is required, please update your device shellypro4-4
Traceback (most recent call last):
Hi.
Is it possible to show energy for dimmers like we have on plugs and switches ?
shellies/shellydimmer-XXXXXX/light/0/energy
Hi.
After update to 0.19 i get this in logs.
`2020-05-15 08:04:56 ERROR (MainThread) [homeassistant.util.logging] Exception in message_received when handling msg on 'shellies/shellyplug-s-B86AC1/temperature': '30.15'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/mqtt/debug_info.py", line 34, in wrapper
_log_message(msg)
File "/usr/src/homeassistant/homeassistant/components/mqtt/debug_info.py", line 24, in _log_message
messages = debug_info["entities"][entity_id]["subscriptions"][
KeyError: 'sensor.shelly_plug_s_b86ac1_temperature'
2020-05-15 08:04:58 ERROR (MainThread) [homeassistant.util.logging] Exception in message_received when handling msg on 'shellies/shellyplug-s-B86AC1/relay/0/energy': '0'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/mqtt/debug_info.py", line 34, in wrapper
_log_message(msg)
File "/usr/src/homeassistant/homeassistant/components/mqtt/debug_info.py", line 24, in _log_message
messages = debug_info["entities"][entity_id]["subscriptions"][
KeyError: 'sensor.shelly_plug_s_b86ac1_energy_0'
2020-05-15 08:05:04 ERROR (MainThread) [homeassistant.util.logging] Exception in state_message_received when handling msg on 'shellies/shellyplug-s-B86AC1/overtemperature': '0'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/mqtt/debug_info.py", line 34, in wrapper
_log_message(msg)
File "/usr/src/homeassistant/homeassistant/components/mqtt/debug_info.py", line 24, in _log_message
messages = debug_info["entities"][entity_id]["subscriptions"][
KeyError: 'binary_sensor.shelly_plug_s_b86ac1_overtemperature'
2020-05-15 08:05:13 ERROR (MainThread) [homeassistant.util.logging] Exception in message_received when handling msg on 'shellies/shellyplug-s-B86AC1/relay/0/power': '0.00'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/mqtt/debug_info.py", line 34, in wrapper
_log_message(msg)
File "/usr/src/homeassistant/homeassistant/components/mqtt/debug_info.py", line 24, in _log_message
messages = debug_info["entities"][entity_id]["subscriptions"][
KeyError: 'sensor.shelly_plug_s_b86ac1_power_0'
Do you know whats wrong or do I need to enable deubg ?`
shellies/<shellymodel>-<deviceid>/ext_humidity/0
Hello,
I'm trying to install this script using HACS, but it shows a fatal error and the repository is not added to HACS.
Can you please check it?
2020-01-26 18:10:13 ERROR (MainThread) [hacs.repository.plugin.bieniu.ha-shellies-discovery] Repostitory structure not compliant
2020-01-26 18:10:13 ERROR (MainThread) [hacs] Validation for bieniu/ha-shellies-discovery failed.
Thanks,
Best regards
I have the following config
automation:
- id: shellies_announce
alias: 'Shellies Announce'
trigger:
- platform: homeassistant
event: start
action:
service: mqtt.publish
data:
topic: shellies/command
payload: announce
- id: 'shellies_discovery'
alias: 'Shellies Discovery'
trigger:
- platform: mqtt
topic: shellies/announce
action:
service: python_script.shellies_discovery
data_template:
id: '{{ trigger.payload_json.id }}'
mac: '{{ trigger.payload_json.mac }}'
fw_ver: '{{ trigger.payload_json.fw_ver }}'
discovery_prefix: 'hass'
temp_unit: 'F'
qos: 2
shelly1-001122-relay-0: 'light'
shellyswitch-9900AA-relay-0: 'light'
shellyswitch-9900AA-relay-1: 'fan'
shellyswitch25-334411-relay-1: 'light'
shellyswitch-334455: 'cover'
shellyrgbw2-AABB22: 'white'
shellyrgbw2-CC2211: 'rgbw'
shellyht-2200AA: 'ac_power'
and when I run the discovery script
[]
I get the following error
2019-09-12 07:59:13 INFO (SyncWorker_5) [homeassistant.components.python_script] Executing shellies_discovery.py: {}
2019-09-12 07:59:13 ERROR (SyncWorker_5) [homeassistant.components.python_script.shellies_discovery.py] Error executing script: 'NoneType' object is not subscriptable
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/__init__.py", line 197, in execute
exec(compiled.code, restricted_globals, local)
File "shellies_discovery.py", line 219, in <module>
File "/usr/local/lib/python3.7/site-packages/RestrictedPython/Eval.py", line 35, in default_guarded_getitem
return ob[index]
TypeError: 'NoneType' object is not subscriptable
It would be useful, if I could set some devices to exclude from discovery, for example by writing 'manual' to configuration.
I need to define a shelly1 as a cover component with custom state_topic and payloads. I could set it manually if the script wouldn't find it.
shellies/shellydw-/sensor/tilt: tilt in °
shellies/shellydw-/sensor/vibration: 0 - no vibration, 1 - vibration detected
Longpush does not work well on the Shelly i3. Longpush on a fisical button causes home assistant to fire the longpush event every 30 seconds. This does not happen for example in a Shelly 2.5 that works perfectly with the longpush.
I have tested it on several Shelly i3s with the same result.
I have 5 dimmers. 4 of them work okay, the fifth does report the state perfectly fine, but I cannot turn on/off the light in HA. In the web interface of the dimmer all goes well. I have tried removing the entity, and having it re-provisioned. I see it appearing in the Mosquitto add-on log (and it should otherwise it can't report the state).
Anything else that I'm missing?
Shelly i3 is discovered but status is always off
When trying to add https://github.com/bieniu/ha-shellies-discovery as a custom repository to HACS, HACS complains that the repository structure of 0.25.2 is not compliant.
Is it possible to set the friendly name via the script?
Something like this...
action:
service: python_script.shellies_discovery
data_template:
id: "{{ trigger.payload_json.id }}"
mac: "{{ trigger.payload_json.mac }}"
fw_ver: "{{ trigger.payload_json.fw_ver }}"
shellyswitch25-XXXXXX:
relay-0: "light"
friendly_name-0: "Livingroom light"
relay-1: "light"
friendly_name-1: "Kitchen light"
mode: "relay"
Hi and thanks for all your great work with shellies discovery :)
I´m using the switch input om my rgbw2 as an integration for my alarm-system.
When my alarm is "on", my switch turns to "on" on my rgbw2. And when my alarm is "off" the switch turns "off".
I have the button detached in my shelly configuration and my question is if there is any chance of getting it to show up in hassio with your script ?
Thanks.
/Jerry
Can you implement click count like it is done in shellyforhass so we can use double_click event? Or can it already be used using your script ?
Hi,
I was wondering if there's some way to expose the new_fw flag, and perhaps a switch to trigger an update to the shelly?
"new_fw": true
in the announce message
Hi,
The script fails with the following output:
2020-05-27 18:00:32 ERROR (SyncWorker_2) [homeassistant.components.python_script.shellies_discovery.py] Error executing script: 'NoneType' object is not callable
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/__init__.py", line 205, in execute
exec(compiled.code, restricted_globals)
File "shellies_discovery.py", line 535, in <module>
TypeError: 'NoneType' object is not callable
2020-05-27 18:00:34 ERROR (SyncWorker_19) [homeassistant.components.python_script.shellies_discovery.py] Error executing script: 'NoneType' object is not callable
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/__init__.py", line 205, in execute
exec(compiled.code, restricted_globals)
File "shellies_discovery.py", line 535, in <module>
TypeError: 'NoneType' object is not callable
2020-05-27 18:00:34 ERROR (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] Error executing script: 'NoneType' object is not callable
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/__init__.py", line 205, in execute
exec(compiled.code, restricted_globals)
File "shellies_discovery.py", line 535, in <module>
TypeError: 'NoneType' object is not callable
2020-05-27 18:00:35 ERROR (SyncWorker_14) [homeassistant.components.python_script.shellies_discovery.py] Error executing script: 'NoneType' object is not callable
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/__init__.py", line 205, in execute
exec(compiled.code, restricted_globals)
File "shellies_discovery.py", line 535, in <module>
TypeError: 'NoneType' object is not callable
2020-05-27 18:00:35 ERROR (SyncWorker_11) [homeassistant.components.python_script.shellies_discovery.py] Error executing script: 'NoneType' object is not callable
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/__init__.py", line 205, in execute
exec(compiled.code, restricted_globals)
File "shellies_discovery.py", line 535, in <module>
TypeError: 'NoneType' object is not callable
2020-05-27 18:00:39 ERROR (SyncWorker_2) [homeassistant.components.python_script.shellies_discovery.py] Error executing script: 'NoneType' object is not callable
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/__init__.py", line 205, in execute
exec(compiled.code, restricted_globals)
File "shellies_discovery.py", line 535, in <module>
TypeError: 'NoneType' object is not callable
2020-05-27 18:00:41 ERROR (SyncWorker_19) [homeassistant.components.python_script.shellies_discovery.py] Error executing script: 'NoneType' object is not callable
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/__init__.py", line 205, in execute
exec(compiled.code, restricted_globals)
File "shellies_discovery.py", line 535, in <module>
TypeError: 'NoneType' object is not callable
2020-05-27 18:00:41 ERROR (SyncWorker_9) [homeassistant.components.python_script.shellies_discovery.py] Error executing script: 'NoneType' object is not callable
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/__init__.py", line 205, in execute
exec(compiled.code, restricted_globals)
File "shellies_discovery.py", line 535, in <module>
TypeError: 'NoneType' object is not callable
no configuration changes
Hi ,
I have 62 shellies, only with shellydw i have a issue, the part of vibration:
Shelly windows/door sensor vibration error log:
return base_validate(path, iteritems(data), out)
File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping
raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: invalid template (TemplateSyntaxError: unexpected '%') for dictionary value @ data['value_template']
2020-07-08 15:58:28 ERROR (SyncWorker_18) [homeassistant.components.python_script.shellies_discovery.py] Error executing script: list index out of range
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/__init__.py", line 205, in execute
exec(compiled.code, restricted_globals)
File "shellies_discovery.py", line 1399, in
File "/usr/local/lib/python3.7/site-packages/RestrictedPython/Eval.py", line 35, in default_guarded_getitem
return ob[index]
IndexError: list index out of range
2020-07-08 15:58:28 ERROR (MainThread) [homeassistant.util.logging] Exception in async_discover when dispatching 'mqtt_discovery_new_binary_sensor_mqtt': ({'name': 'Shelly Door/Window 764B7A Vibration', 'state_topic': 'shellies/shellydw-764B7A/announce', 'unique_id': 'shellydw-764b7a-vibration', 'qos': 0, 'device': {'identifiers': ['dc4f22764b7a'], 'name': 'Shelly Door/Window 764B7A', 'model': 'Shelly Door/Window', 'sw_version': '20200625-102424/v1.7.3@2aa0993a', 'manufacturer': 'Allterco Robotics'}, 'value_template': "{{% if value_json.id == '{0}' and value_json.new_fw == true %}}ON{{% else %}}OFF{{% endif %}}", 'expire_after': 43200, 'device_class': 'vibration', 'platform': 'mqtt'},)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/mqtt/binary_sensor.py", line 85, in async_discover
config = PLATFORM_SCHEMA(discovery_payload)
File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 272, in __call__
return self._compiled([], data)
File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict
return base_validate(path, iteritems(data), out)
File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping
raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: invalid template (TemplateSyntaxError: unexpected '%') for dictionary value @ data['value_template']
return base_validate(path, iteritems(data), out)
File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping
raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: invalid template (TemplateSyntaxError: unexpected '%') for dictionary value @ data['value_template']
Tks
Good.
Can you help me, before I had declared everything manually and had no problem.
Now with the integration when I restart home assistant or when I restart the home wifi, the shellys are disconnected and I can only reconnect if I enter the shelly web ui and in mqtt options without changing anything to save.
https://www.youtube.com/watch?v=GbXJBNRnpBw
https://www.youtube.com/watch?v=0Fd1QgCsCzU
Shortpush: shellies/shelly1-328900/input_event/0 {"event":"S","event_cnt":12}
Longpush: shellies/shelly1-328900/input_event/0 {"event":"L","event_cnt":11}
The changelog for 0.27.1 just mentions "small fixes", but this version changed the parameter to the python script from id to dev_id, so the automation needs to be updated as well:
@@ -16,7 +18,7 @@
action:
- service: python_script.shellies_discovery
data_template:
- id: '{{ trigger.payload_json.id }}'
+ dev_id: '{{ trigger.payload_json.id }}'
mac: '{{ trigger.payload_json.mac }}'
fw_ver: '{{ trigger.payload_json.fw_ver }}'
I'm not opening a PR because I'm not sure if you want to revert this and release it as part of a new major version (0.28) or something.
Stacktrace:
Log Details (ERROR)
Logger: homeassistant.components.python_script.shellies_discovery.py
Source: components/python_script/init.py:205
Integration: Python Scripts (documentation, issues)
First occurred: 9:39:04 AM (1 occurrences)
Last logged: 9:39:04 AM
Error executing script: 'NoneType' object is not callable
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/init.py", line 205, in execute
exec(compiled.code, restricted_globals)
File "shellies_discovery.py", line 1401, in
TypeError: 'NoneType' object is not callable
More data:
2020-09-04 09:39:04 INFO (MainThread) [homeassistant.components.automation.shellies_discovery] Shellies Discovery: Running script,
2020-09-04 09:39:04 INFO (MainThread) [homeassistant.components.automation.shellies_discovery] Shellies Discovery: Executing step call service,
2020-09-04 09:39:04 INFO (SyncWorker_4) [homeassistant.components.python_script] Executing shellies_discovery.py: {'id': 'shellyswitch25-68DE2A', 'mac': '2CF43268DE2A', 'fw_ver': '20200827-065456/v1.8.3@4a8bc427', 'model': 'SHSW-25', 'shelly1_246334_relay_0': 'light', 'shelly1_2c8012_relay_0': 'light', 'shelly1_55dE73_relay_0': 'light', 'shelly1_59dA5c_relay_0': 'light', 'shelly1_E0E863_relay_0': 'light', 'shelly1_E2CDCD_relay_0': 'light', 'shellyswitch25-E619B2-relay-1': 'fan', 'shellyswitch25-E619B2-relay-0': 'light', 'shellyswitch25-E61B55-relay-1': 'fan', 'shellyswitch25-E61B55-relay-0': 'light', 'shellyswitch25-688455-relay-1': 'light', 'shelly1_BA3DAF_relay_0': 'light', 'shelly1_e2d1bc_relay_0': 'light', 'shellyswitch25-68DE2A': 'cover', 'shellydimmer-DB3B75': 'dimmer'},
2020-09-04 09:39:04 DEBUG (SyncWorker_4) [homeassistant.components.python_script.shellies_discovery.py] dev_id: shellyswitch25-68DE2A, mac: 2cf43268de2a, fw_ver: 20200827-065456/v1.8.3@4a8bc427, model_id: SHSW-25,
2020-09-04 09:39:04 ERROR (SyncWorker_4) [homeassistant.components.python_script.shellies_discovery.py] Error executing script: 'NoneType' object is not callable,
Traceback (most recent call last):,
File "/usr/src/homeassistant/homeassistant/components/python_script/init.py", line 205, in execute,
exec(compiled.code, restricted_globals),
File "shellies_discovery.py", line 1401, in ,
TypeError: 'NoneType' object is not callable,
This is for a roller shutter.
Have it for another one (dimmer 1):
2020-09-04 09:42:05 INFO (SyncWorker_32) [homeassistant.components.python_script] Executing shellies_discovery.py: {'id': 'shellydimmer-DB3B75', 'mac': '84F3EBDB3B75', 'fw_ver': '20200827-070608/v1.8.3@4a8bc427', 'model': 'SHDM-1', 'shelly1_246334_relay_0': 'light', 'shelly1_2c8012_relay_0': 'light', 'shelly1_55dE73_relay_0': 'light', 'shelly1_59dA5c_relay_0': 'light', 'shelly1_E0E863_relay_0': 'light', 'shelly1_E2CDCD_relay_0': 'light', 'shellyswitch25-E619B2-relay-1': 'fan', 'shellyswitch25-E619B2-relay-0': 'light', 'shellyswitch25-E61B55-relay-1': 'fan', 'shellyswitch25-E61B55-relay-0': 'light', 'shellyswitch25-688455-relay-1': 'light', 'shelly1_BA3DAF_relay_0': 'light', 'shelly1_e2d1bc_relay_0': 'light', 'shellyswitch25-68DE2A': 'cover', 'shellydimmer-DB3B75': 'dimmer'},
2020-09-04 09:42:05 DEBUG (SyncWorker_32) [homeassistant.components.python_script.shellies_discovery.py] dev_id: shellydimmer-DB3B75, mac: 84f3ebdb3b75, fw_ver: 20200827-070608/v1.8.3@4a8bc427, model_id: SHDM-1,
2020-09-04 09:42:05 ERROR (SyncWorker_32) [homeassistant.components.python_script.shellies_discovery.py] Error executing script: 'NoneType' object is not callable,
Traceback (most recent call last):,
File "/usr/src/homeassistant/homeassistant/components/python_script/init.py", line 205, in execute,
exec(compiled.code, restricted_globals),
File "shellies_discovery.py", line 1687, in ,
TypeError: 'NoneType' object is not callable
Any idea? I'm not that good with python, but when I try to log the device_config, it just gives me an empty object
2020-07-28 23:33:59 ERROR (SyncWorker_0) [homeassistant.components.python_script.shellies_discovery.py] Error executing script: 'NoneType' object is not callable
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/init.py", line 205, in execute
exec(compiled.code, restricted_globals)
File "shellies_discovery.py", line 265, in
TypeError: 'NoneType' object is not callable
Using HA 0.113.2 (error is the same for 0.113.1)
Getting this error when running the shellies discovery service
When i try to add repository to HACS i receive the error: "Repository structure for 0.27.6 is not compliant".
Could this be resolved somehow?
Hi Bieniu
Thank you for your hard work on this plugin, its really helpfull.
I'm really new with MQTT and i was wondering where i can find the actual state of my 2.5. I use them as Shutters in Roller mode. DO I have to change something in your configs to get there?
At the moment i'm using the "cover.shelly_shsw_25_xxxxxxxx" service, but this state is no instant and takes always 10 seconds to switch to the correct state.
Thanks for your help!
Hello, it looks like that 0.22 with latest home assistant 0.111.* do not work.
I can see the messages going back and forth in MQTT but all devices are offline.
This is a minor issue for me. Not sure how others are using Lovelce, but I nowhere have use a a separate light card for a simple light switch. I would suggest to put that light switch in the same entities card together with the switch input etc.
Looking at the event stream in Developer tools I see many small internal temperature change events coming from my shelly 2.5's internal sensors. My understanding is that this sensor is for internal overheating protection so it's state is not so useful in Home Assistant for most people.
Suggest adding ability to ignore these events and as they are just noise, e.g :
{
"event_type": "state_changed",
"data": {
"entity_id": "sensor.shelly2_5_111111_temperature",
"old_state": {
"entity_id": "sensor.shelly2_5_111111_temperature",
"state": "58.5",
"attributes": {
"unit_of_measurement": "°C",
"friendly_name": "Shelly 2.5 111111 Temperature",
"device_class": "temperature"
},
"last_changed": "2020-07-25T06:57:40.851376+00:00",
"last_updated": "2020-07-25T06:57:40.851376+00:00",
"context": {
"id": "b3b092c652b345f2a3bda6a7ca4a7ffd",
"parent_id": null,
"user_id": null
}
},
"new_state": {
"entity_id": "sensor.shelly2_5_111111_temperature",
"state": "58.4",
"attributes": {
"unit_of_measurement": "°C",
"friendly_name": "Shelly 2.5 111111 Temperature",
"device_class": "temperature"
},
"last_changed": "2020-07-25T06:59:10.706531+00:00",
"last_updated": "2020-07-25T06:59:10.706531+00:00",
"context": {
"id": "99de225021244b30ab9fd4eaab5c8d9c",
"parent_id": null,
"user_id": null
}
}
},
"origin": "LOCAL",
"time_fired": "2020-07-25T06:59:10.706575+00:00",
"context": {
"id": "99de225021244b30ab9fd4eaab5c8d9c",
"parent_id": null,
"user_id": null
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.