MQTT – setup and use
-
-
Try this: delete the Shelly bridge and restart openLuup.
-
ok i just did it.
After starting OpenLuup, the Shelly Bridge is created ...
I attach the log
2021-05-01 10:40:39.029 openLuup.mqtt:: mqtt-explorer-8cd8e0cf SUBSCRIBE to # tcp{client}: 0x1a575f0
2021-05-01 10:40:39.032 luup.create_device:: [82] D_ShellyBridge.xml / I_ShellyBridge.xml / D_ShellyBridge.json (ShellyBridge)
2021-05-01 10:40:39.033 openLuup.context_switch:: ERROR: [dev #0] ./L_ShellyBridge.lua:343: attempt to index field 'hadevice' (a nil value)
2021-05-01 10:40:39.033 openLuup.mqtt:: ERROR publishing application message for mqtt:shellies/shellyplug-s-20E453/online : ./L_ShellyBridge.lua:343: attempt to index field 'hadevice' (a nil value)
2021-05-01 10:40:39.277 openLuup.server:: request completed (509175 bytes, 32 chunks, 994 ms) tcp{client}: 0x1a51f78
2021-05-01 10:40:39.277 openLuup.scheduler:: [82] Shelly device startup
2021-05-01 10:40:39.277 luup.set_failure:: status = 0
2021-05-01 10:40:39.277 luup.variable_set:: 82.urn:micasaverde-com:serviceId:HaDevice1.CommFailure was: EMPTY now: 0 #hooks:0
2021-05-01 10:40:39.278 luup.variable_set:: 82.urn:micasaverde-com:serviceId:HaDevice1.CommFailureTime was: EMPTY now: 0 #hooks:0
2021-05-01 10:40:39.278 openLuup.scheduler:: [82] Shelly device startup completed: status=true, msg=OK, name=ShellyBridge
2021-05-01 10:40:39.279 luup.shelly:0: New Shelly announced: shellyplug-s-20E453
2021-05-01 10:40:39.279 openLuup.context_switch:: ERROR: [dev #0] ./L_ShellyBridge.lua:226: attempt to index field '?' (a nil value)
2021-05-01 10:40:39.279 openLuup.mqtt:: ERROR publishing application message for mqtt:shellies/announce : ./L_ShellyBridge.lua:226: attempt to index field '?' (a nil value)
2021-05-01 10:40:39.280 openLuup.mqtt:: mqtt-explorer-8cd8e0cf SUBSCRIBE to $SYS/# tcp{client}: 0x1a575f0
....................... -
@christian_fabre my Plug (not the S version) looks like this in Mqtt Explorer:
For some reason there is no announce message from your plug when comparing with my plug.
-
-
@christian_fabre that is good news, then it looks as the Shelly works as it should in respect of the Mqtt settings.
Just to rule out the obvious; the Shelly devices and Tasmota devices should show up in OpenLuup in the two rooms "Shellies" and "Tasmota" and not in "No room".
Maybe deleting the Shelly bridge and reloading as @akbooer suggests now that you have the announce message.
-
I have removed several of the Shelly and Tasmota bridges. But after the Reload, they are created in NoRoom.
The last thing I did was reload the OpenLuup files from GitHub OpenLuup Development, but I still have the same problem -
-
@christian_fabre said in MQTT – setup and use:
I have removed several of the Shelly and Tasmota bridges. But after the Reload, they are created in NoRoom.
Yes, the bridges are created in "No room", but the child devices should be created in the two rooms "Shellies" and "Tasmota" respectively.
-
The "Shellies" room is well created but it remains empty.
On the other hand, I have the Tasmota bridge in Noroom, but I do not have a "Tasmota" room![0_1619878068306_Capture d’écran 2021-05-01 160702.png](Uploading 100%!
-
-
@christian_fabre said in MQTT – setup and use:
more
I notice that the variable OffSet is missing in the variables of the Shelly bridgeYes, that’s undoubtedly the problem... have not been able to work on this today. Sorry.
-
Have you tried the latest release in the testing branch?
-
I just tried the testing version.
same problem2021-05-01 21:05:13.495 openLuup.io.server:: MQTT:1883 connection from 192.168.1.149 tcp{client}: 0x23a2148
2021-05-01 21:05:13.530 luup.create_device:: [87] D_ShellyBridge.xml / I_ShellyBridge.xml / D_ShellyBridge.json (ShellyBridge)
2021-05-01 21:05:13.531 openLuup.context_switch:: ERROR: [dev #0] ./L_ShellyBridge.lua:343: attempt to index field 'hadevice' (a nil value)
2021-05-01 21:05:13.531 openLuup.mqtt:: ERROR publishing application message for mqtt:shellies/shellyplug-s-20E453/online : ./L_ShellyBridge.lua:343: attempt to index field 'hadevice' (a nil value)
2021-05-01 21:05:13.533 openLuup.scheduler:: [87] Shelly device startup
2021-05-01 21:05:13.533 luup.set_failure:: status = 0
2021-05-01 21:05:13.533 luup.variable_set:: 87.urn:micasaverde-com:serviceId:HaDevice1.CommFailure was: EMPTY now: 0 #hooks:0
2021-05-01 21:05:13.534 luup.variable_set:: 87.urn:micasaverde-com:serviceId:HaDevice1.CommFailureTime was: EMPTY now: 0 #hooks:0
2021-05-01 21:05:13.534 openLuup.scheduler:: [87] Shelly device startup completed: status=true, msg=OK, name=ShellyBridge
2021-05-01 21:05:13.535 luup.shelly:0: New Shelly announced: shellyplug-s-20E453
2021-05-01 21:05:13.535 openLuup.luup:: creating room [10] Shellies
2021-05-01 21:05:13.536 openLuup.context_switch:: ERROR: [dev #0] ./L_ShellyBridge.lua:226: attempt to index field '?' (a nil value)
2021-05-01 21:05:13.536 openLuup.mqtt:: ERROR publishing application message for mqtt:shellies/announce : ./L_ShellyBridge.lua:226: attempt to index field '?' (a nil value)
2021-05-01 21:05:13.541 openLuup.server:: request completed (1033 bytes, 1 chunks, 609 ms) tcp{client}: 0x2222010
2021-05-01 21:05:13.542 openLuup.context_switch:: ERROR: [dev #0] ./L_ShellyBridge.lua:343: attempt to index field 'hadevice' (a nil value) -
I should have time to address this tomorrow. Sorry for all the false leads (and the problem in the first place.)
-
@akbooer I hate to add more to the pile... but I'm still seeing a receive error for the connection to mosquitto. openLuup 2021.04.29b
Here's the log error:
2021-05-01 14:22:38.815 openLuup.io.server:: MQTT:1882 connection closed tcp{client}: 0x5579919e9c58 2021-05-01 14:22:38.816 openLuup.mqtt:: RECEIVE ERROR: closed tcp{client}: 0x5579919e9c58 2021-05-01 14:22:43.935 luup.io.incoming:: bytes received: 51, status: OK tcp{client}: 0x557990e7f528 2021-05-01 14:22:48.435 luup.io.incoming:: bytes received: 51, status: OK tcp{client}: 0x557990e7f528 2021-05-01 14:22:49.763 luup.variable_set:: 10181.urn:micasaverde-com:serviceId:EnergyMetering1.KWHReading was: 1619904116 now: 1619904168 #hooks:0 2021-05-01 14:22:50.158 openLuup.io.server:: HTTP:3480 connection closed openLuup.server.receive closed tcp{client}: 0x557991971ff8 2021-05-01 14:22:53.834 openLuup.io.server:: MQTT:1882 connection from 127.0.0.1 tcp{client}: 0x5579920dc0b8 2021-05-01 14:22:53.834 openLuup.mqtt:: client is in ERROR empty 2021-05-01 14:22:53.834 openLuup.mqtt:: credentials is in ERROR empty 2021-05-01 14:22:53.834 openLuup.mqtt:: subscriptions is in ERROR empty
using the below error trapping in function "MQTTservlet"
local function MQTTservlet (client) if client == nil then _log ("client is in ERROR nil") else if table.concat(client) == "" then _log ("client is in ERROR empty") else _log (table.concat {"MQTT ERROR: ", table.concat(client)}) end end if credentials == nil then _log ("credentials is in ERROR nil") else if table.concat(credentials) == "" then _log ("credentials is in ERROR empty") else _log (table.concat {"MQTT ERROR: ", table.concat(credentials)}) end end if subscriptions == nil then _log ("subscriptions is in ERROR nil") else if table.concat(subscriptions) == "" then _log ("subscriptions is in ERROR empty") else _log (table.concat {"MQTT ERROR: ", table.concat(subscriptions)}) end end return function () incoming (client, credentials, subscriptions) end end
I can't find a deeper layer in the stack where I can trap for the incoming message to see what's in the message that is throwing the error. As near as I can tell, if openLuup tries to connect to a running mosquitto instance, then it fails to see the topics and messages, and passes empty--but not nil--strings when the servlet interface sees incoming bytes.
If I restart mosquitto, openLuup then sees the topics and messages and the error messages stop--and the connection to mosquitto remains stable.
This behavior does not occur when I aim an IOT device directly at openLuup--in that the connection to the device always resumes when openLuup reloads--in other words, I don't need to restart the IOT device to enable the connection.
-
I simply cannot reproduce this error, so can I ask you to try it again after having added this line to openLuup Startup (which enables debog logging for the MQTT server):
luup.attr_set ("openLuup.MQTT.DEBUG", true)
That may give a little more to go on.
I've have tried everything I can think of, deleting the Shelly plugin, and reproducing the announce message from your device. It all works just fine.
-
I added "luup.attr_set (" openLuup.MQTT.DEBUG ", true)"
and I did a RELOAD
here is the log2021-05-02 14:03:57.914 openLuup.io.server:: MQTT:1883 connection from 192.168.1.149 tcp{client}: 0x11320b0 2021-05-02 14:03:57.941 openLuup.context_switch:: ERROR: [dev #87] ./L_ShellyBridge.lua:343: attempt to index field 'hadevice' (a nil value) 2021-05-02 14:03:57.941 openLuup.mqtt:: ERROR publishing application message for mqtt:shellies/shellyplug-s-20E453/online : ./L_ShellyBridge.lua:343: attempt to index field 'hadevice' (a nil value) 2021-05-02 14:03:57.943 luup.shelly:87: New Shelly announced: shellyplug-s-20E453 2021-05-02 14:03:57.944 openLuup.context_switch:: ERROR: [dev #87] ./L_ShellyBridge.lua:226: attempt to index field '?' (a nil value) 2021-05-02 14:03:57.944 openLuup.mqtt:: ERROR publishing application message for mqtt:shellies/announce : ./L_ShellyBridge.lua:226: attempt to index field '?' (a nil value) 2021-05-02 14:03:57.945 openLuup.context_switch:: ERROR: [dev #87] ./L_ShellyBridge.lua:343: attempt to index field 'hadevice' (a nil value) 2021-05-02 14:03:57.946 openLuup.mqtt:: ERROR publishing application message for mqtt:shellies/shellyplug-s-20E453/announce : ./L_ShellyBridge.lua:343: attempt to index field 'hadevice' (a nil value) 2021-05-02 14:03:57.947 openLuup.context_switch:: ERROR: [dev #87] ./L_ShellyBridge.lua:343: attempt to index field 'hadevice' (a nil value) 2021-05-02 14:03:57.947 openLuup.mqtt:: ERROR publishing application message for mqtt:shellies/shellyplug-s-20E453/relay/0/power : ./L_ShellyBridge.lua:343: attempt to index field 'hadevice' (a nil value) 2021-05-02 14:03:57.949 openLuup.context_switch:: ERROR: [dev #87] ./L_ShellyBridge.lua:343: attempt to index field 'hadevice' (a nil value) 2021-05-02 14:03:57.949 openLuup.mqtt:: ERROR publishing application message for mqtt:shellies/shellyplug-s-20E453/relay/0/energy : ./L_ShellyBridge.lua:343: attempt to index field 'hadevice' (a nil value) 2021-05-02 14:03:57.989 openLuup.context_switch:: ERROR: [dev #87] ./L_ShellyBridge.lua:343: attempt to index field 'hadevice' (a nil value) 2021-05-02 14:03:57.989 openLuup.mqtt:: ERROR publishing application message for mqtt:shellies/shellyplug-s-20E453/relay/0 : ./L_ShellyBridge.lua:343: attempt to index field 'hadevice' (a nil value) 2021-05-02 14:03:57.994 openLuup.server:: request completed (664 bytes, 1 chunks, 1140 ms) tcp{client}: 0x1403478 2021-05-02 14:03:57.995 openLuup.context_switch:: ERROR: [dev #87] ./L_ShellyBridge.lua:343: attempt to index field 'hadevice' (a nil value) 2021-05-02 14:03:57.995 openLuup.mqtt:: ERROR publishing application message for mqtt:shellies/shellyplug-s-20E453/temperature : ./L_ShellyBridge.lua:343: attempt to index field 'hadevice' (a nil value) 2021-05-02 14:03:57.997 openLuup.context_switch:: ERROR: [dev #87] ./L_ShellyBridge.lua:343: attempt to index field 'hadevice' (a nil value) 2021-05-02 14:03:57.997 openLuup.mqtt:: ERROR publishing application message for mqtt:shellies/shellyplug-s-20E453/temperature_f : ./L_ShellyBridge.lua:343: attempt to index field 'hadevice' (a nil value) 2021-05-02 14:03:57.998 openLuup.context_switch:: ERROR: [dev #87] ./L_ShellyBridge.lua:343: attempt to index field 'hadevice' (a nil value) 2021-05-02 14:03:57.999 openLuup.mqtt:: ERROR publishing application message for mqtt:shellies/shellyplug-s-20E453/overtemperature : ./L_ShellyBridge.lua:343: attempt to index field 'hadevice' (a nil value) 2021-05-02 14:03:58.000 openLuup.mqtt:: shellyplug-s-20E453 SUBSCRIBE to shellies/command tcp{client}: 0x11320b0 2021-05-02 14:03:58.002 openLuup.mqtt:: shellyplug-s-20E453 SUBSCRIBE to shellies/shellyplug-s-20E453/command tcp{client}: 0x11320b0 2021-05-02 14:03:58.003 openLuup.mqtt:: shellyplug-s-20E453 SUBSCRIBE to shellies/shellyplug-s-20E453/relay/0/command tcp{client}: 0x11320b0
-
Just what I needed to see, thanks, I’ll work on it.
-
Can can give v21.5.2 from the testing branch a go?
73/107