Please update the script to version 0.27.2. I made a stupid mistake in 0.27.1.
The script will add cover entities to your HA without manually configuring YAML.
I add ur script in the python script folder then i restart twice but i cant see just 2 entities the announce and discovery entities i can see my shellys .
Can u help me with the custom script config. How i can add my shellys , see my shellys topics in the link i sent before
Have you read the documentation? You have to add automations and script configuration.
This the code I add in the automation.yaml
- 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_template:
id: '{{ trigger.payload_json.id }}'
mac: '{{ trigger.payload_json.mac }}'
fw_ver: '{{ trigger.payload_json.fw_ver }}'
discovery_prefix: 'hass'
qos: 2
shellyswitch25-68EF11:
mode: "roller"
roller-0-name: "Room Door"
roller-0-class: "door"
shellyswitch25-693FA7:
mode: "roller"
roller-0-name: "Room Window"
roller-0-class: "window"
Looks good. If it’s not working check https://github.com/bieniu/ha-shellies-discovery#troubleshooting-checklist and enable logging https://github.com/bieniu/ha-shellies-discovery#how-to-debug
I assume you have the python_script
component enabled in configuration.yaml
.
I just update my mqtt config like this , any comment ?
mqtt:
broker: 192.168.1.101
port: 1883
username: mqtt_admin
password: ******
discovery: true
discovery_prefix: homeassistant
logger:
default: warning
logs:
homeassistant.components.python_script: debug
homeassistant.components.automation: info
python_script:
You have a different discovery_prefix
in your MQTT configuration and in your script configuration.
I will change it , where u see my discovery_prefix ?
Still cant see my shelly’s , do I need any configurations through the shelly web ui ? on the device ?
I see this in mosquitto
1597657881: Warning: Mosquitto should not be run as root/administrator.
1597657882: New connection from 192.168.1.100 on port 1883.
[INFO] found mqtt_admin on local database
1597657883: New client connected from 192.168.1.100 as shellyswitch25-693FA7 (p2, c1, k60, u'mqtt_admin').
1597657883: New connection from 172.30.32.1 on port 1883.
[INFO] found homeassistant on local database
1597657883: New client connected from 172.30.32.1 as auto-FE235D0D-7E2F-EFBE-FC90-2E473C17D963 (p2, c1, k60, u'homeassistant').
1597657888: New connection from 192.168.1.100 on port 1883.
1597657888: New client connected from 192.168.1.100 as DVES_C69844 (p2, c1, k15, u'mqtt_admin').
1597657939: New connection from 192.168.1.100 on port 1883.
1597657939: Socket error on client <unknown>, disconnecting.
1597657998: New connection from 192.168.1.100 on port 1883.
1597657998: Socket error on client <unknown>, disconnecting.
1597658063: New connection from 192.168.1.100 on port 1883.
1597658063: Socket error on client <unknown>, disconnecting.
1597658117: New connection from 192.168.1.100 on port 1883.
1597658117: Socket error on client <unknown>, disconnecting.
1597658181: New connection from 192.168.1.100 on port 1883.
1597658181: Socket error on client <unknown>, disconnecting.
What about HA log? You should see entries for python_script
.
2020-08-17 13:00:00 INFO (SyncWorker_2) [homeassistant.components.python_script] Executing shellies_discovery.py: {'id': 'shellyswitch25-693FA7', 'mac': '2EF432693FA7', 'fw_ver': '20190329-124426/master@854171ac', 'discovery_prefix': 'hass', 'qos': 2, 'shellyswitch25-68EF11': {'mode': 'roller', 'roller-0-name': 'Room Door', 'roller-0-class': 'door'}, 'shellyswitch25-693FA7': {'mode': 'roller', 'roller-0-name': 'Room Window', 'roller-0-class': 'window'}}
2020-08-17 13:00:00 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 353, in <module>
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
Your Shellies firmware is out of date. The script only works only with the current version.
You the Best Man , work as a charm
I’m glad You found the script useful.
After updating to 0.27.3, I’m having problems with my Shelly Dimmer 2 devices
My version numbers:
Shellies Discovery: 0.27.3
Home Assistant: 0.114.2
Shelly Dimmer2 FW: 20200812-092210/v1.8.0@8acf41b0
The dimmers are reporting their status correctly if controlled using the physical switch or through their http interface, but can’t be controlled in HA. I have reverted back to 0.27.2, and this is working correctly.
I think the issue appears to be single vs double quotes in the MQTT payload.
0.27.2 (Working)
Message 1 received on shellies/shellydimmer2-E09806950DF1/light/0 at 10:54 AM:
on
Message 0 received on shellies/shellydimmer2-E09806950DF1/light/0/set at 10:54 AM:
{
"turn": "on"
}
0.27.3 (Not working)
Message 0 received on shellies/shellydimmer2-E09806950DF1/light/0/set at 10:59 AM:
{'turn':'on'}
Hello and thank you for this script, and the community for the added knowledge - it made my life a lot easier!
I have a small problem though. I have a Shelly DUO that - while reports the status/states correctly if I set it in the devices webgui - it won’t work the other way around - so if I try to set it from hass. FW is 1.8.0. And the script is the latest. Did anyone experience something similiar?
For the record: I also have a Shelly 1, and that is behaving correctly with the same setup.
Use version 0.27.2 of the script, version 0.27.3 has an issue for lights.