Shelly - WiFi IoT-Devices - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10) +--- Thread: Shelly - WiFi IoT-Devices (/showthread.php?tid=3010) Pages:
1
2
|
Shelly - WiFi IoT-Devices - Todayslife - 24.11.2020 Hi, 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 Thanks RE: Shelly - WiFi IoT-Devices - admin - 24.11.2020 This can be implemented either by using MQTT broker in LM (two-way) or HTTP (remote services to LM, HTTP requests from LM scripts). RE: Shelly - WiFi IoT-Devices - Todayslife - 28.11.2020 (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"? Thanks again RE: Shelly - WiFi IoT-Devices - admin - 28.11.2020 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. RE: Shelly - WiFi IoT-Devices - Todayslife - 28.11.2020 (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. RE: Shelly - WiFi IoT-Devices - admin - 30.11.2020 See this thread for a fully working script with two-way exchange between LM objects and MQTT: https://forum.logicmachine.net/showthread.php?tid=1759&pid=10926#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. RE: Shelly - WiFi IoT-Devices - mdisilvestro - 25.12.2020 Sorry, but I'm not able to use the script. 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' } where 0/0/12 is the On/Off knx status and object_to_mqtt = { ['0/0/11'] = 'shellies/shellyplug-s-??????/relay/0/command' } where 0/0/11 is the On/Off knx command Shelly want on and off command, not 0 or 1. I used custom value to modify that, but doesn't work Here is my log: * arg: 1 * string: mqtt connect status * arg: 2 * bool: true * arg: 3 * number: 0 * arg: 4 * string: connection accepted * arg: 5 * number: 0 * arg: 6 * nil Thank you RE: Shelly - WiFi IoT-Devices - admin - 26.12.2020 Modify the script around line 108, change this: Code: if type(value) == 'boolean' then To this: Code: if type(value) == 'boolean' then Also make sure that Shelly MQTT address is not 127.0.0.1 but LM IP address. RE: Shelly - WiFi IoT-Devices - mdisilvestro - 26.12.2020 Thanks, but something is wrong. Here is my script: Code: if not broker then LOG1: * arg: 1 * string: mqtt connect status * arg: 2 * bool: false * arg: 3 * number: 5 * arg: 4 * string: connection refused - not authorized * arg: 5 * number: 0 * arg: 6 * nil LOG2: * arg: 1 * string: mqtt disconnect * arg: 2 * bool: false * arg: 3 * number: 0 * arg: 4 * string: unexpected disconnect * arg: 5 * nil logging continusly, every 10 seconds Shelly use correct LM IP for broker device. The MQTT communication works fine, I tested it whit MQTT.fx software. Simplifing: I want that an "ON" knx telegram became ad an "ON" request through mqtt, and viceversa. Thanks RE: Shelly - WiFi IoT-Devices - admin - 28.12.2020 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. RE: Shelly - WiFi IoT-Devices - a455115 - 20.06.2022 Hello, I also have a problem with the shelly connection and I don't know what I'm doing wrong. Please if anyone can help. LM Mqtt broker MQTT explorer Code: if not broker then LM log LM Objects RE: Shelly - WiFi IoT-Devices - admin - 22.06.2022 Add logging to ON_MESSAGE to check that you are getting the data. Also do a full script restart the script via disable/enable. Code: mclient.ON_MESSAGE = function(mid, topic, payload) RE: Shelly - WiFi IoT-Devices - a455115 - 24.06.2022 (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.nothing different is logged.. Code: * arg: 1 RE: Shelly - WiFi IoT-Devices - admin - 27.06.2022 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: Code: mclient = require('mosquitto').new() RE: Shelly - WiFi IoT-Devices - a455115 - 29.06.2022 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 RE: Shelly - WiFi IoT-Devices - a455115 - 30.06.2022 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? RE: Shelly - WiFi IoT-Devices - admin - 30.06.2022 You can write a custom conversion function and add it to mqtt_to_object_conv table. What kind of string value is it? RE: Shelly - WiFi IoT-Devices - admin - 01.07.2022 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. Code: broker = '127.0.0.1' RE: Shelly - WiFi IoT-Devices - a455115 - 05.07.2022 (30.06.2022, 15:19)admin Wrote: You can write a custom conversion function and add it to mqtt_to_object_conv table. What kind of string value is it? It returns me an On / Off value but as a string. RE: Shelly - WiFi IoT-Devices - admin - 05.07.2022 Add before multiply function: Code: function onofftobool(payload) Then modify mqtt_to_object_conv table: Code: mqtt_to_object_conv = { |