MQTT – setup and use
-
Just what I needed to see, thanks, I’ll work on it.
-
Can can give v21.5.2 from the testing branch a go?
-
disabled MQTT on the Shelly socket
I deleted on OpenLuup- the Shelly device in NoRoom
- the Shellies piece
I did a Reload
I installed version 2021.05.02
I did a Reload
Enabled MQTT on the Shelly socket
I did a Reload
Creation of the Shelly Bridge (88) in NoRoom
Creation of the piece Shelly
I still have the same problem
2021-05-02 17:51:56.712 openLuup.io.server:: MQTT:1883 connection from 192.168.1.149 tcp{client}: 0x184b970 2021-05-02 17:51:56.745 luup.create_device:: [88] D_ShellyBridge.xml / I_ShellyBridge.xml / D_ShellyBridge.json (ShellyBridge) 2021-05-02 17:51:56.746 openLuup.context_switch:: ERROR: [dev #0] ./L_ShellyBridge.lua:343: attempt to index field 'hadevice' (a nil value) 2021-05-02 17:51:56.746 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 17:51:56.747 openLuup.scheduler:: [88] Shelly device startup 2021-05-02 17:51:56.747 luup.set_failure:: status = 0 2021-05-02 17:51:56.747 luup.variable_set:: 88.urn:micasaverde-com:serviceId:HaDevice1.CommFailure was: EMPTY now: 0 #hooks:0 2021-05-02 17:51:56.748 luup.variable_set:: 88.urn:micasaverde-com:serviceId:HaDevice1.CommFailureTime was: EMPTY now: 0 #hooks:0 2021-05-02 17:51:56.748 openLuup.scheduler:: [88] Shelly device startup completed: status=true, msg=OK, name=ShellyBridge 2021-05-02 17:51:56.749 luup.shelly:0: New Shelly announced: shellyplug-s-20E453 2021-05-02 17:51:56.749 openLuup.luup:: creating room [10] Shellies 2021-05-02 17:51:56.750 openLuup.context_switch:: ERROR: [dev #0] ./L_ShellyBridge.lua:226: attempt to index field '?' (a nil value) 2021-05-02 17:51:56.750 openLuup.mqtt:: ERROR publishing application message for mqtt:shellies/announce : ./L_ShellyBridge.lua:226: attempt to index field '?' (a nil value) 2021-05-02 17:51:56.751 openLuup.context_switch:: ERROR: [dev #0] ./L_ShellyBridge.lua:343: attempt to index field 'hadevice' (a nil value) 2021-05-02 17:51:56.751 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 17:51:56.752 openLuup.context_switch:: ERROR: [dev #0] ./L_ShellyBridge.lua:343: attempt to index field 'hadevice' (a nil value) 2021-05-02 17:51:56.752 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 17:51:56.753 openLuup.context_switch:: ERROR: [dev #0] ./L_ShellyBridge.lua:343: attempt to index field 'hadevice' (a nil value) 2021-05-02 17:51:56.754 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 17:51:56.789 openLuup.context_switch:: ERROR: [dev #0] ./L_ShellyBridge.lua:343: attempt to index field 'hadevice' (a nil value) 2021-05-02 17:51:56.790 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 17:51:56.791 openLuup.context_switch:: ERROR: [dev #0] ./L_ShellyBridge.lua:343: attempt to index field 'hadevice' (a nil value) 2021-05-02 17:51:56.791 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 17:51:56.792 openLuup.context_switch:: ERROR: [dev #0] ./L_ShellyBridge.lua:343: attempt to index field 'hadevice' (a nil value) 2021-05-02 17:51:56.792 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 17:51:56.793 openLuup.context_switch:: ERROR: [dev #0] ./L_ShellyBridge.lua:343: attempt to index field 'hadevice' (a nil value) 2021-05-02 17:51:56.793 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 17:51:56.795 openLuup.mqtt:: shellyplug-s-20E453 SUBSCRIBE to shellies/command tcp{client}: 0x184b970 2021-05-02 17:51:56.796 openLuup.mqtt:: shellyplug-s-20E453 SUBSCRIBE to shellies/shellyplug-s-20E453/command tcp{client}: 0x184b970 2021-05-02 17:51:56.797 openLuup.mqtt:: shellyplug-s-20E453 SUBSCRIBE to shellies/shellyplug-s-20E453/relay/0/command tcp{client}: 0x184b970 2021-05-02 17:51:57.208 openLuup.server:: request completed (1033 bytes, 1 chunks, 3858 ms) tcp{client}: 0x197dd68 2021-05-02 17:51:57.209 openLuup.io.server:: HTTP:3480 connection closed openLuup.server.receive closed tcp{client}: 0x197dd68
-
I’m speechless. No explanation.
-
ok thanks for trying to solve my problem.
in the near future i will try to reinstall OpenLuup on my Raspbery, maybe this will fix this problem.
Sorry for taking your precious time -
I haven’t given up. I can only think that, somehow, we are not running the same version of the code. You did confirm that your last install was, in fact, v21.5.2?
-
Is @christian_fabre bridged to mosquitto? As when I reload OpenLuup I have to restart mosquitto to get them talking again.
-
-
@akbooer I will probably add more log, to see the exact payload sent. Sometimes those things are generating strange telemetry data, so maybe that's the case. I'll probably log what's going on around hadevice property as well. I was unable to re-produce it in my own install, so it should be something related to this particular model and its messages.
-
If you are still interested, testing v21.5.3 is available. I have made considerable changes.
-
-
@christian_fabre said in MQTT – setup and use:
Merci bien
Je vous en pris.
Believe me... I'm happy. So sorry for all the mis-steps, but I learned a few things along the way, so it was a worthwhile exercise!
-
Now that you got that figured out, one awesome thing which could be done would be integrate this:
By creating a bridge supporting it on openLuup. It would enable me to move zigbee from home assistant to run directly to openLuup and I would likely take advantage of it to get rid of my hue hub as well, running a single zigbee network through mqtt...
-
@buxton said in MQTT – setup and use:
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.
OK, I’m ready to take a look at this. However the above statement makes no sense to me, since the server never connects to anything (because it’s a server – clients connect to it.)
-
@akbooer Yes, that was poorly worded as it makes it sound like openLuup initiates the connection to Mosquitto.
The symptoms of the problem are that:
- if luup reloads, an occasional message that is sent to openLuup from Mosquitto causes a receive error in openLuup. It is unknown what that/those message(s) are.
- if mosquitto reloads, the openLuup error messages stop, so something changes in the way that openLuup sees the mosquitto data.
- this behavior does not occur with IOT devices.
A possible way to trouble shoot this is to place debug code at the incoming interface that will trap and display packets headed to the MQTT port. By comparing incoming timestamps with the error message timestamp, I should be able to tell what message is causing the receive error message--even though the message variable is empty at the time it causes the luup error. What is odd to me is that there is a lot of error trapping for bad messages in your code, but this message(s) seems to bypass all of that and arrives at the incoming routine empty.....
-
I think we are being misled by your error messages. These tables are not empty...
local x = {a = 1, b = 2} local y = table.concat (x) print (y == '')
yields the expected result
true
. -
Ah! Yes that explains the empty variable, though I'm going to have to dig into my lua book to understand why! I was assuming that the concat function returned a series of string values from a table, and therefore, the output could be sent to the log for display.
-
It works only for a contiguous array of numbers and/or strings...
local x = {"a ", 1, " b ", 2} local y = table.concat (x) print(y)
gives
a 1 b 2
-
@akbooer Ok, so the variable "message " contains more than just a value array.
I've never been able to get zerobrane as a debugger working with openLuup, though the instructions on how to do so have been written about previously. I just couldn't get the debugger working on a target remote PC, so it's difficult to watch what's going on within the myriad method code in the object model you've created. I don't write code for a living--never have-- though I use SQL, VBA and Python in my day to day job. The debuggers for those languages are a breeze compared to setting up zerobrane and Vera.....
91/107