I don’t use qos: 2
in script. If you want I can send you test version of the script with qos
.
Hey,
Very interesting mosquitto upgrade broke this, something with the ~ syntax? Maybe remove availability topic altogether as seems to work without? Happy to test if you want to send me something.
Cheers.
Qos no problem, I was customising it already to 2, but thanks anyway - don’t think it’s pertinent to main problem. Must admit after reverting to manual config am just relieved the unit wasn’t supremely fuckwitted in being unavailable at hardware level!
I think that issue with new Mosquitto comes from Shelly firmware. In my case, when the state of the relay changed, the broker disconnected Shelly. Shelly became unavailable in HA, after a few seconds it was again connected with the broker and brought back the state from before the change, so it was impossible to turn on the light.
I doubt it would be related to the abbreviations of variable names because this is only used by HA.
Which version of Mosquitto do you use?
Thanks for reply. I’ve updated HA to latest (0.93.1) and got my Shelly 2.5 finally registered as cover.
I’ve noticed that this latest version of HA has some auto-discovery (the option to tick the box appears when adding MQTT broker details) should this in-build auto-discovery be enabled or disabled when using your script?
Also using your latest version 0.9.1 Iam seeing this error message in HA (currently I have only single Shelly 2.5 connected to HA) hence I suspect there is something wrong with your script.
2019-05-19 13:23:35 ERROR (SyncWorker_16) [homeassistant.components.python_script.shellies_discovery.py] Error executing script: name 'white_lights' is not defined
Traceback (most recent call last):
File "/usr/src/app/homeassistant/components/python_script/__init__.py", line 159, in execute
exec(compiled.code, restricted_globals, local)
File "shellies_discovery.py", line 621, in <module>
NameError: name 'white_lights' is not defined
New version: 0.9.2
Changelog:
- fix
white_lights
issue - add
qos
argument
Should be enabled.
Ah okay, but if we ignore availability, e.g. in the config yaml above with just state and command topics, all seems to ‘work’ as it should. Hopefully the new firmware release due this week addresses this.
I’m using mosquitto 1.6.x - will check exact version when I get home.
I’m waiting for a shipment with new Shellies. If I get it, I will be able to debug this problem and report it to support.
You could set an automation to publish ‘announce’ to shellies/command every x?
This will cause configuration topics for all Shellies in local network to be sent periodically. Payloads for these topics are very large. Sending a large amount of data just to create one sensor isn’t a good idea in my opinion.
To keep track of software versions, it’s better to use the REST component.
- platform: rest
resource: http://<SHELLY_IP>/status
name: 'Shelly Firmware New Version'
value_template: "{{ value_json['update'].new_version }}"
authentication: basic
username: <SHELLY_USERNAME>
password: <SHELLY_PASSWORD>
scan_interval: 7200
There is a new custom component for all Shelly devices. It works over http and it also has full discovery capabilities. I think it was developed by one of Shelly’s distributors. It works great for me with covers, lights and a 4Pro. Just thought I’d mention it here in case someone has problems with Mqtt.
hello Bieniu and thanks a lot for your scripts!
just setup them for my first shellyrgbw2.
the script found the device and i can see it in ha/lovelace/etc but i think there is a little problem (don’t know if my side or script/config).
i need to operate this shelly in WHITE mode (instead of RGB).
- if i set the shelly in white mode, i cannot operate it from HA (turn on, always go back to off, dimming slider doesn’t work)
- tried to set the shelly in RGB mode, and in this configuration mode, i can operate it correctly from HA. (i can set dimming with the ‘W’ slider - see below)
Any idea to have shellyrgb working in white mode? Can i make some testing my side and report to you?
Thanks
emilicus
Do You add to script configuration information about white mode?
shellyrgbw2-AABB22: 'white'
How do you get all the info grouped like (Shellies Discovery Script) ? For my switch I only see this
Configuration -> Integrations -> MQTT
hello - sorry for asking…
where exactly should i add the extra line of code?
tks
emilicus
This is an 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 }}'
shellyrgbw2-AABBCC: 'white'
ok! got it thank you very much
hi! it’s all ok now - thanks for your time and help