Do you mean external switch
?
Yes, Thank you!!
I am having problems getting my Shellies back online after a (planned) power outage. Some Shellies came back; the most didnāt. I updated Home Assistant and the python script. I also updated the firmware of all my shellies. In the Home Assistant device I can clearly see that the firmware was updated.
When I connect to MQTT with MQTT explorer, I see the devices being online perfectly. So somehow, Home Assistant doesnāt subscribe to the right topics I suppose?
I see no related errors in my home assistant logs.
I really donāt have a clue how to further debug this. I hope you can give me advice.
I had this with some Shylles as well. But I had to say upfront I flashed all my Shellys with ESPHome, so may be different for you.
Take them from the power for at least 30 seconds to one minute. I can only do this by switching off the fuse, but after that they started normally.
Maybe this helps *fingersCrossed
I figured it out eventually. Two devices didnāt (re)connect to MQTT correctly. I had to disable MQTT, reboot the device, enable MQTT, reboot the device. Then it finally came back. I guess it was a Shelly issue after all.
Have added that line of code to the automation.yaml and ran the automation with no changes. Iāve removed the the device and tried to readd, no improvement. The MQTT stream shows the state, what am I missing?
Please post python_script
debug log.
Hi,
Iām using Shelly Colorbulbs RGBW (SHCB-1) and since the last update I canāt control the white channel and the RGB channels at the same time. When any of the three RGB channels is enabled, the white channel shuts off. I was able to recreate the problem by directly controlling the bulb via MQTT Explorer, so it seems the behavior of the discovery script is as it should be. Maybe this is a firmware issue, I found someone on the Shelly Facebook support group with a similar problem. This issue popped up after updating from Shelly firmware 1.9.x to 1.10.4 which was needed for the new discovery script version. Does anyone have a similar issue?
Shelly SHCB-1 firmware: 1.10.4
Homeassistant: 2021.5
Shellies Discovery Script: 0.39.4
Iāve run into an issue with the script supporting my Shelly RGBW2 switch. It fails to discover the switch due to a conflict with the Mode. I am using the switch for color only, so in the Shelly config Mode is set to āColorā.
{"id":"shellyrgbw2-E74CCF","model":"SHRGBW2","mode":"color","mac":"**********","ip":"********","new_fw":false,"fw_ver":"20210429-101438/v1.10.4-g3f94cd7"}
The HA logs show the error:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/python_script/__init__.py", line 221, in execute
exec(compiled.code, restricted_globals)
File "shellies_discovery.py", line 1462, in <module>
ValueError: mode value None is not valid, check script configuration
Script appears to be looking for the light_color or light_white, which are set as variables:
LIGHT_COLOR = "color"
LIGHT_WHITE = "white"
if model_id == MODEL_SHELLYRGBW2_ID or dev_id_prefix == MODEL_SHELLYRGBW2_PREFIX:
if mode not in [LIGHT_COLOR, LIGHT_WHITE]:
raise ValueError(f"mode value {mode} is not valid, check script configuration")
My python is a little rusty., so not sure why it is throwing the error.
Note, I have a shelly1 that was discovered just fine. Thanks in advance for the assistance.
Core-2021.5.1
Shellies Discovery pulled in via HACS. Version 0.39.4
Is your shellies_announce
automation up to date?
Not exactly sure where to check. The script was installed via HACS which created the discovery and announce automations. Did not modify any of that. All done a couple of days ago.
HACS doesnāt create/update script automations. Look here GitHub - bieniu/ha-shellies-discovery: Script that adds MQTT discovery support for Shellies devices
Thanks for the clarification.
Copy-n-paste error. I had followed the instructions and added the āminimum configā from the example. Unfortunately, I had left off the last line in the copy. OF course, the last line contains the mode parameter.
Works 100% now. Thanks for the fast help!
FYI for anyone struggling this, I managed to āsolveā my issue. Downgrading to 1.9.4 fixes it, but the discovery script requires 1.10 at least. 1.10.2 and 1.10.4 are both broken. Using this website (http://archive.shelly-tools.de/) selecting āv1.1.10ā (presumably a typo) I downgraded to 1.10. Now the white channel works properly and the discovery script works as well.
This is my first time using python scripts.
I have installed the python scritp using HACS
added this in the configuration.yaml
python_script:
logger:
default: warning
logs:
homeassistant.components.python_script: debug
homeassistant.components.automation: info
Summary
This text will be hidden
- id: shellies_announce
alias: 'Shellies Announce'
trigger:
- platform: homeassistant
event: start
- platform: time_pattern
hours: "/1" # Modifying this if you are using Shelly Motion can drain your device's battery quickly.
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 }}'
discovery_prefix: 'hass'
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:
mode: "roller"
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:
mode: "roller"
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
but when I run the automation Shellies Discovery I get the following errors
Error while executing automation automation.shellies_discovery: Error rendering data template: UndefinedError: 'dict object' has no attribute 'payload_json'
5:40:06 PM ā (ERROR) Automation
Shellies Discovery: Error executing script. Error for call_service at pos 1: Error rendering data template: UndefinedError: 'dict object' has no attribute 'payload_json'
5:40:06 PM ā (ERROR) Automation
Template variable error: 'dict object' has no attribute 'payload_json' when rendering '{{ trigger.payload_json.id }}'
5:40:06 PM ā (ERROR) helpers/template.py
I am Running Home Assistant Supervised as a Docker Container .
You canāt run it manually since the trigger data wonāt exist. You need to let it trigger automatically. Running an automation manually basically executes the actions as a script. There are other instances of the same issue if you search the thread.
Anyone tried the new Mosquitto broker v6.0.1?
Is it safe to update to it?
Yes, and yes.
Yes much better then the previous version
In what way is it better?