Has anyone collected practical experiences with IoT-Devices from Shelly - particularly controlling them from KNX via LM5?
e.g.: interesting applications are mainly in budget-sensitive environments:
- Power-measurement with LM3 for visualisation and triggering event based actions
- Using the Shelly i3 as a wireless-KNX-sensor in a retrofit environment
- Using the Shelly RGBW2 as a KNX to WiFi-RGBW-LED-dimmer in a retrofit environment
... to name a few
28.11.2020, 14:31 (This post was last modified: 28.11.2020, 14:40 by Todayslife.)
(24.11.2020, 13:35)admin Wrote: This can be implemented either by using MQTT broker in LM (two-way) or HTTP (remote services to LM, HTTP requests from LM scripts).
Thanks for the very quick reply :-)
Very well so far, using the MQTT Broker in LM5 sounds indeed promising.
Therefor, one might be really happy getting a more specific answer to the original question; in particular about actual practical experiences - if any exists already - in terms of how to integrate Shelly' IoT-Devices within the LogicMachine's "ecosystem".
(eg. using the LM5's new MQTT Broker).
Hence, trying to precise above question as follows (and please excuse, if this may sound amateurish):
"Has anyone already made practical experiences with IoT-Devices from Shelly? In particular; successfully controlling Shelly-Devices from the KNX-bus via LM5's MQTT Broker"?
I don't think that anybody has made an integration yet but it's very easy to do. On LM side you need to enable broker and create a script to exchange values between MQTT and LM objects. On Shelly device you need to set MQTT broker address and topic.
28.11.2020, 15:41 (This post was last modified: 28.11.2020, 15:42 by Todayslife.)
(28.11.2020, 14:55)admin Wrote: I don't think that anybody has made an integration yet but it's very easy to do. On LM side you need to enable broker and create a script to exchange values between MQTT and LM objects. On Shelly device you need to set MQTT broker address and topic.
Thank you for the - again - quick response.
Well, just enabling the MQTT-Broker on the LM5 (SW: 20200720) wasn't bringing up much questions as it seemed.
So it appeared as easy on the Shelly-Device to set the MQTT broker's address and topic.
Whereis - for someone being unexperienced and feeling rather uncomfortable writing software - creating a script to exchange values between MQTT and LM objects seems indeed much more troublesome - hence, please excuse, if asking for your help in writing such scripts may try your patience.
See this thread for a fully working script with two-way exchange between LM objects and MQTT: https://forum.logicmachine.net/showthrea...6#pid10926
You need to set the broker address to 127.0.0.1 and edit mqtt_to_object/object_to_mqtt tables. Make sure that you don't have the same topic mapped to both tables otherwise you can get a loop.
I changed the broker address with 127.0.0.1 (local borker) and modified the mqtt_to_object/object_to_mqtt tables in order to do a simple ON /OFF of an mqtt object (shelly) as example.
My tables has:
mqtt_to_object = {
['shellies/shellyplug-s-??????/relay/0'] = '0/0/12'
}
Are you able to control your Shelly device using an external MQTT client? You can monitor what LM is writing to these topics and check what's wrong. The last change will publish on/off for binary objects.
(22.06.2022, 09:27)admin Wrote: Add logging to ON_MESSAGE to check that you are getting the data. Also do a full script restart the script via disable/enable.
The same script works for me when sending messages from MQTT explorer. Do you have "Allow anonymous connection" enabled in MQTT broker configuration on LM? If not then you need to specify the login/password in the script.
Modify the script around line 45 by adding login_set call and restart it via disable/enable:
29.06.2022, 13:45 (This post was last modified: 30.06.2022, 08:21 by a455115.)
Hello admin!
I did it and my script is already working! I still didn't understand where the problem was. I returned the original settings to LM, I wrote the same script and it already works!
Thanks again for your help and time
30.06.2022, 15:12 (This post was last modified: 30.06.2022, 15:14 by a455115.)
I have another problem. The value I take from shelly is string, how do I convert it so I can use it as int or bool? And is there a way to add all the shelly functions to a library and call them only by name and serial number?
In case somebody else needs this, here's an example that logs all messages for all topics from the local broker. If anonymous access is disabled then remove the comment (--) from line 23 and set username and password as needed.