Sorry if this has been covered before, just curious why triggers in openluup are not consistent..
I looked at a scene i’d created a while back via ALTUI using the Console view and noticed it didn’t show any Triggers, which was strange as it was my main front door event 🙂 . So I added the door tripped trigger again, but I’ve just noticed I now how two tiggers using this view.
25bfe00a-d63e-4dc1-a501-23e779c64379-image.png
In ALTUI it shows this.
AK. Was doing an openLuup install and the installer errored with:
openLuup_install 2019.02.15 @akbooer getting openLuup version tar file from GitHub branch master... un-zipping download files... getting dkjson.lua... lua5.1: openLuup_install.lua:45: GitHub download failed with code 500 stack traceback: [C]: in function 'assert' openLuup_install.lua:45: in main chunk [C]: ?The installer code was executing this URL:
http://dkolf.de/src/dkjson-lua.fsl/raw/dkjson.lua?name=16cbc26080996d9da827df42cb0844a25518eeb3Running it manually gives:
dkolf.de The script could not be run error-free. Please check your error log file for the exact error message. You can find this in the KIS under "Product Management > *YOUR PRODUCT* > *CONFYGUAR* > Logfiles". Further information can be found in our FAQ. The script could not be executed correctly. Please refer to your error log for details about this error. You find it in your KIS under item "Product Admin > *YOUR PRODUCT* > *CONFIGURE* > Logfiles". Further information can also be found in our FAQ.I'm thinking the dkjson code URL has been changed. On dkolf.de there is a download link:
http://dkolf.de/dkjson-lua/dkjson-2.8.luaand dkjson code also seems to be in GitHub (I presume this is the same code?):
https://github.com/LuaDist/dkjson/blob/master/dkjson.luaI'm don't know what dkolf.de looked like previously but I do see the dkjson code has been updated as of 2024-06-17. Hope this helps.
Oh - and by the way the dkjson.lua file seems to have been downloaded OK by the installer - error or no error, so go figure.
It’s been a while since I looked at openLuup as it had been running nicely and quietly in the background doing some basic tasks. With my VeraPlus looking like it’s finally succumbing to old age, I want to shift a number of the global module I have over to openLuup.
To do this, I have added the files (example would be xxpushover.lua to the cmh-ludl folder and the following to the startup
require “xxpushover”
The xxpushover.lua file itself starts with the following..
module("xxpushover", package.seeall)
And I always have a line in these files to allow me to check it’s been read in the start up related logs, which in this case it is..
The challenge I’m having is that when I try to call any of the functions within the module, it returns the following error..
"[string "ALTUI - LuaRunHandler"]:1: attempt to index global 'xxpushover' (a nil value)”
I’m no doubt missing something obvious, can anyone help me find out what it is ? Many thanks
Currently I have some Whisper files used by DataYours that been working well for ages and do what I want.
One of the files is called Watts_L1.d.wsp and uses this retention from "storage_schemas_conf" in openLuup file virtualfilesystem.lua:
[day] pattern = \.d$ retentions = 1m:1dInside the actual "Watts_L1.d.wsp" file is a header like so:
1, 86400, 0, 1 84, 60, 1440The 1, 86400 is one minute & one day (in minutes) as per the retention listed above. As a side issue I would like to know what the other header values mean ie what's the syntax here?
New challenge: I now have three Shelly variables named:
em1/0/act_power
em1/1/act_power
em1/2/act_power
with a device ID of "10006" and a SID of "shellypro3em"
And I would like to plot them using the Historian, just like I do with Watts_L1.d.wsp in DataYours. So I need a file in the history directory for the data. So I looked at doing this:
local whisper = require "openLuup.whisper" -- Syntax: history/0.deviceNumber.shortServiceId.variableName local filename = "history/0.10006.shellypro3em.em1/0/act_power.wsp" local archives = "1m:1d" whisper.create (filename,archives,0)Problem is that the variable names contains forward slashes, which are invalid filename characters. What to do?
Also should the retentions now be (to suit the latest openLuup software)?:
local archives = "1m:1d,10m:7d,1h:30d,3h:1y,1d:10y"Also "shellypro3em" is not a "shortServiceID" as per those listed in "servertables.lua". So can "shellypro3em" be used instead? ie can both short and long service IDs be used in the above call to whisper.create?
To try and minimized the frequency of writing to the SD card I want to move these log files to a RAM drive, like I already do with /var/log. Is there an 'official' way of doing this?
_John.
A list of openLuup releases including the latest developments…
master – stable, and infrequently updated, development – latest updates and bug fixes, testing – use only when advised!A long while ago (May, 2015) I wrote my 2000-th post on another forum: openLuup - running unmodified plugins on any machine.
Now rehosted at https://community.ezlo.com/t/openluup-running-unmodified-plugins-on-any-machine/187412
Here’s the gist of it:
...I want to work in a more open and stable [Vera] environment...
...All would be solved if Luup was open source and could be run on the plethora of cheap and reliable hardware available today. But it’s not. But we could get something like that effect if we engineered a sufficient subset of Luup to run on such a platform. Could it be done? What would we need?
1. UI
2. scheduler
3. web server
4. Luup compatible API
5. Device and Implementation xml file reader
6. Zwave bridge to Vera
7. runs most plugins without modification
What we wouldn’t need is UPnP.
What have we (nearly) got already?
We have, courtesy of @amg0, the most excellent AltUI: Alternate UI to UI7, and that, I think, is probably the hardest one to do in the above list. Items 2 - 5, and 7, I’ve prototyped, in pure Lua, and posted elsewhere: DataYours on Raspberry Pi, running selected plugins unmodified, including: DataYours, EventWatcher, Netatmo, RBLuaTest, altUI. See screenshot attached.Is it worth the effort? Probably not. Will I pursue this quest? Yes.
openLuup was the result.
Hoping you could tell us a bit about your experiences with ZWaveJS and MQTT.
Akbooer: it would be good if openLuup was added to the awesome mqtt resources list.
How to contribute is described here.
Looks like the GetSolarCoords() doesn't return the correct results. Right Ascension (RA) and
Declination (DEC) look OK. They presumably must be, as I have a light that goes on at sunset at the correct time for years.
Altitude and Azimuth look incorrect. They both have the hour angle in common, so I'm wondering if it's incorrect and hence the sidereal time. Should be able to convert the angle to hours and check it against this clock:
The formula used looks like Compute sidereal time on this page. Might be some mix up between JD2000 that has a 12 hour offset. Could also be some issue with the hour angle.
I'm assuming all Right Ascension (RA) and
Declination (DEC) are degrees plus & minus from north.
Likewise Altitude (ALT) and Azimuth (AZ) are in degrees?
Bit of caution: I haven't looked at this too closely, so may be barking up the wrong tree. It probably doesn't help living near Greenwich.
This site may also be helpful.
PS did you have a look at the link in my last PM?
Set up:
a) Many many many many kms from home: laptop connected to modem router. Router running wireguard client to create a virtual network.
b) Home: modem router running wireguard server. openLuup pi4 connect to router and also a PC and other stuff, etc.
The problem: When accessing charts, AltUI or the openLupp console the web pages are returned OK up to the point where they are truncated and therefore fail to display anything useful.
Note this all works fine over short distances eg around a major city (I tested it) but not seemingly at world wide distances. ie network delays seem to be the issue here? Windows TeamViewer works fine overy the exact same network/wireguard set up. That's how I was able to get the openLuup logs shown below.
Here is any example of openLuup trying to return a chart:
2023-09-04 21:31:20.463 openLuup.io.server:: HTTP:3480 connection from 10.0.0.2 tcp{client}: 0x55aed35038 2023-09-04 21:31:20.464 openLuup.server:: GET /data_request?id=lu_status2&output_format=json&DataVersion=316885191&Timeout=60&MinimumDelay=1500&_=1692128389970 HTTP/1.1 tcp{client}: 0x55ae538348 2023-09-04 21:31:20.465 openLuup.server:: GET /data_request?id=lu_status2&output_format=json&DataVersion=316885191&Timeout=60&MinimumDelay=1500&_=1692129024374 HTTP/1.1 tcp{client}: 0x55addbe1e8 2023-09-04 21:31:20.477 openLuup.server:: GET /data_request?id=lr_render&target={temp_first_floor.w,temp_ground_floor.w,temp_back_wall_of_office.w,temp_inside_roof.w,temp_jps_bedrm_north.w,temp_outside.w}&title=Temperatures&height=750&from=-y&yMin=0&yMax=40 HTTP/1.1 tcp{client}: 0x55aed35038 2023-09-04 21:31:20.478 luup_log:6: DataGraph: drawing mode: connected, draw nulls as: null 2023-09-04 21:31:20.502 luup_log:6: DataGraph: Whisper query: CPU = 23.122 mS for 2016 points 2023-09-04 21:31:20.532 luup_log:6: DataGraph: Whisper query: CPU = 22.952 mS for 2016 points 2023-09-04 21:31:20.561 luup_log:6: DataGraph: Whisper query: CPU = 22.738 mS for 2016 points 2023-09-04 21:31:20.575 luup_log:6: DataGraph: Whisper query: CPU = 9.547 mS for 2016 points 2023-09-04 21:31:20.587 luup_log:6: DataGraph: Whisper query: CPU = 9.569 mS for 2016 points 2023-09-04 21:31:20.598 luup_log:6: DataGraph: Whisper query: CPU = 9.299 mS for 2016 points 2023-09-04 21:31:20.654 luup_log:6: visualization: LineChart(2016x7) 196kB in 51mS 2023-09-04 21:31:20.655 luup_log:6: DataGraph: render: CPU = 51.219 mS for 6x2016=12096 points 2023-09-04 21:31:20.755 openLuup.server:: error 'socket.select() not ready to send tcp{client}: 0x55aed35038' sending 2 bytes to tcp{client}: 0x55aed35038 2023-09-04 21:31:20.855 openLuup.server:: error 'socket.select() not ready to send tcp{client}: 0x55aed35038' sending 6 bytes to tcp{client}: 0x55aed35038 2023-09-04 21:31:21.037 openLuup.server:: error 'socket.select() not ready to send tcp{client}: 0x55aed35038' sending 2 bytes to tcp{client}: 0x55aed35038 2023-09-04 21:31:21.138 openLuup.server:: error 'socket.select() not ready to send tcp{client}: 0x55aed35038' sending 6 bytes to tcp{client}: 0x55aed35038 2023-09-04 21:31:21.332 openLuup.server:: error 'socket.select() not ready to send tcp{client}: 0x55aed35038' sending 2 bytes to tcp{client}: 0x55aed35038 2023-09-04 21:31:21.432 openLuup.server:: error 'socket.select() not ready to send tcp{client}: 0x55aed35038' sending 6 bytes to tcp{client}: 0x55aed35038 2023-09-04 21:31:21.507 openLuup.server:: error 'closed' sending 196367 bytes to tcp{client}: 0x55aed35038 2023-09-04 21:31:21.507 openLuup.server:: ...only 144000 bytes sent 2023-09-04 21:31:21.507 openLuup.server:: error 'closed' sending 2 bytes to tcp{client}: 0x55aed35038 2023-09-04 21:31:21.507 openLuup.server:: ...only 0 bytes sent 2023-09-04 21:31:21.507 openLuup.server:: error 'closed' sending 5 bytes to tcp{client}: 0x55aed35038 2023-09-04 21:31:21.507 openLuup.server:: ...only 0 bytes sent 2023-09-04 21:31:21.507 openLuup.server:: request completed (196367 bytes, 10 chunks, 1030 ms) tcp{client}: 0x55aed35038 2023-09-04 21:31:21.517 openLuup.io.server:: HTTP:3480 connection closed openLuup.server.receive closed tcp{client}: 0x55aed35038 2023-09-04 21:31:22.824 openLuup.io.server:: HTTP:3480 connection from 10.0.0.2 tcp{client}: 0x55aea22c88Re: socket.select() not ready to send
Is there some sort of timeout I change; to see if this can make this work?
Note that openLuup is still running everything flawlessly for ages now, including the more recent addtions of ZigBee stuff. Much appreciated.
Hi @akbooer
Just bringing this over as suggested..
I’ve started to use the console view a lot more, mainly for it’s look and simplicity , but I noticed it does not do any live updates compared to ALTUI, you have to do a full browser reload. Is that by design, or is mine not working?
Also if I want to go strait to the console view, rather than into ALTUI, I recall seeing something abut altering that in the guide by for the life of me I can’t find it. Is it possible to do, if so how would I do that..
You suggested this was something you were looking at ? Also you said You don't need a "full browser reload", just click on the display menu item to refresh the screen. - what do you mean by `display menu?
Very minor issue: was messing about renaming a few rooms and ended up with a room being listed twice. One with the room's contents and the other with no room contents.
It simply turns out one room name had a trailing space. It is possible in both AltUI and the openLuup console to create a room name with a trailing space. Once having done so chaos then ensues, as the rooms are not necessarily treated as different and become difficult to manipulate.
Just need to trim white space off room names. Haven't tested if it's possible to add in leading spaces. That may also be possible.
Hey guys...
Long time... 😉
Since my first day with Vera, I'm using RulesEngine from @vosmont to handle complex rules that will do something based on multiple condition base on "true/false" and also based on time.
Do you think I will be able to do that directly with LUA in openLuup ?
For example..
IF bedroom-motion1 is not detecting motion for 15 minutes
AND
IF bedroom-motion2 is not detecting motion for 15 minutes
AND
IF current-time is between 6am and 11pm
AND
IF binary-light1 is OFF
AND
IF binary-light2 is OFF
THEN
execute LUA code
WAIT 2 minute
execute LUA code
BUT IF any "conditions" failed while in the "THEN" , It need to stop...
I currently have around 60 rules like that 😞
Currently I have a Vera and Hue hub all reliably controlled by openLuup with AltUI, plus any number of plugins. Been working really well for a few years now. However would like to head for a more MQTT based set up. Eliminate the Hue hub and hopefully eliminate Vera by using ZWAVE JS UI. Noting that Zwavejs2mqtt has been renamed to Z-Wave JS UI. Probably also run the stuff using Docker. Just because. Everything would end up on the one computer for easier management. Erhhh that's the hope.
Some of the new Zigbee Aqara stuff is very good and inexpensive plus it fits in with HomeKit. Also the Aqara battery powered stuff looks to have a good battery lifetime: ie suggested up to five years. The battery operated Hue buttons I have; have lasted for ages. Would like to use zigbee2mqtt with a SonOff dongle, which would allow access to the over two and half thousand devices zigbee2mqtt now supports:
Zigbee2MQTTAK has the MQTT stuff working in openLuup. Have played around with it and it works well, as one would expect. Love the UDP to MQTT code.
Shellys are great and also very inexpensive and they spit out & accept MQTT but I would prefer to stay away from WiFi. Not meshed and higher power consumption. Horses for courses.
Now here's the query:
Got about forty or more ZWave twin light switches, plus a few other ZWave bits & pieces such as blind controllers. Then there are the Hue devices on top of that. That's a lot of virtual devices to set up in openLuup. What's an appropriate way to do this?
It seems there is no "auto magic bridge set up". Do I need to use say @therealdb's Virtual Devices plugin that supports MQTT or is there some other approach?
I have to confess I still don't understand the master child approach in that plugin. Seems one light switch would have all the other light switches hanging off it? Helps Vera but not a problem with openLuup - why is that? Suspect AK's good coding beats Vera's?
GitHub - dbochicchio/vera-VirtualDevices: Virtual HTTP Devices plug-in for Vera and openLuup GitHub - dbochicchio/vera-VirtualDevices: Virtual HTTP Devices plug-in for Vera and openLuupVirtual HTTP Devices plug-in for Vera and openLuup - dbochicchio/vera-VirtualDevices
Setting up manually say 100 virtual devices is a bit much to ask. I had a look at hacking the user_data.json file. Good approach till you see all the UIDs and the individually numbered ControlURL and EventURLs that need to be set up.
I need some way of say of creating about 80 light switches in "No room" or in say the "ZWave upgrade" room. Or say some sort of code that could go through all my existing bridged ZWAVE devices in openLuup and create virtual devices for each one. I caould then use the openLuup console to name them and place them in their rooms:
openLuup_IP_address:3480/console?page=devices_table
At that point I could hack the user_data.json file to insert the MQTT topics fairly easily for each? Plus any other fine tuning needed.
Then the old ZWave stuff could be swapped over to ZWAVE JS UI and all the virtual MQTT devices would be ready to go or am I dreaming? Then delete all the old Vera bridged stuff. I'm not too fussed about scene code and the like, as a I have all my code in one block, that is set up in the openLuup start up.
It seems that with ZWay you can create all the ZWave device by doing some sort of interrogation of ZWay's API? Seems also to be the case with the Shelleys?
So any ideas, suggestions or code snippets are welcome on how to move towards MQTT and in particular ZWAVE JS UI and zigbee2mqtt.
I'm in no hurry as openLuup is performing nicely, with the old Vera handling all my ZWave devices.
Hi
Just wondering if it’s possible when writing plugins to set if the text shown via DisplayLine1/2 can be left, right or centre aligned ?
Bit of an odd one this:
Bare metal install on Debian Bullseye (Intel NUC)
I've noticed when travelling, I connect to my L2TP VPN and I cannot get AltUI to update. I just get 'Waiting Initial Data'
Specifically this is in Chrome:
Version 108.0.5359.94 (Official Build) (x86_64)
In Chrome I can access and control everything via the Openluup console.
In Chrome I can also access and control everything via the Z-Wave expert UI and Z-Wave UI
In Safari I get a more complete view of AltUI but loads of errors along the lines of:
the module or function ALTUI_PluginDisplays.drawBinaryLight does not exist, check your configuration
Homewave on my iOS devices is fine across the same VPN config,
I can ssh into all my servers
Not a huge issue, just curious if anyone has any thoughts of what I might tweak to resolve it?
(FWIW I also access my IMAP and SMTP servers across the same VPN with no issues, as well as remote desktop. Also MS Reactor on the same host as Openluup)
TIA for any thoughts
C
Hi Ak,
Not sure when it started as it took me a while to notice.
I have a function on a luup.call_timer to turn on a switch and then use a luup.call_delay to turn it off a minute later. This is done by the same global function, but on the luup.call_delay i get a message in the log : "luup.call_delay:: unknown global function name: HouseDevice1_PumpCommand"
This is in the init function:
luup.call_timer("HouseDevice1_PumpCommand", 2, "2:15:00", hm_Heating.PumpHealthRunDay, hm_Heating.PumpCMD.HEALTH.."1", true)This is in the function to schedule to off command giving the global function name not found:
luup.call_delay("HouseDevice1_PumpCommand", hm_Heating.PumpHealthOnDuration, hm_Heating.PumpCMD.HEALTH.."0")Is it because I use the "TRUE" parameter that is openLuup specific so the timer does not fire just once?
Running v21.7.25, may be time to update?
Cheers Rene
Hi, I have been trying to install OpenLuup on MacOS but I am failing, so far.
Is there a step-by-step instruction (for MacOS) to follow?
After installing LuaRocks, luasec, luafilesystem and luasocket I then try to run lua5.1 openLuup_install.lua and then get the messages below.
Any ideas and proposals are appreciated.
Regards
Jan
openLuup_install 2019.02.15 @akbooer
lua5.1: openLuup_install.lua:18: module ‘socket.http’ not found:
no field package.preload[‘socket.http’]
no file ‘./socket/http.lua’
no file ‘/usr/local/share/lua/5.1/socket/http.lua’
no file ‘/usr/local/share/lua/5.1/socket/http/init.lua’
no file ‘/usr/local/lib/lua/5.1/socket/http.lua’
no file ‘/usr/local/lib/lua/5.1/socket/http/init.lua’
no file ‘./socket/http.so’
no file ‘/usr/local/lib/lua/5.1/socket/http.so’
no file ‘/usr/local/lib/lua/5.1/loadall.so’
no file ‘./socket.so’
no file ‘/usr/local/lib/lua/5.1/socket.so’
no file ‘/usr/local/lib/lua/5.1/loadall.so’
stack traceback:
[C]: in function ‘require’
openLuup_install.lua:18: in main chunk
openLuup: MQTT server
-
After I updated OpenLuup I have not seen the TopicName nil error. Good progress in other words. This could mean that the correction takes care of that kind of problem in mqtt messages.
I have however had a few errors in the log after the update:
2021-08-16 22:38:21.187 openLuup.io.server:: MQTT:1883 connection closed tcp{client}: 0x1ea35e0 2021-08-16 22:38:21.187 openLuup.mqtt:: socket.select() not ready to send tcp{client}: 0x1ea35e0 tcp{client}: 0x1ea35e0 2021-08-16 22:38:21.187 openLuup.mqtt:: mqtt-explorer-bc5a61ca UNSUBSCRIBE from # tcp{client}: 0x1ea35e0 2021-08-16 22:38:21.188 openLuup.mqtt:: mqtt-explorer-bc5a61ca UNSUBSCRIBE from $SYS/# tcp{client}: 0x1ea35e0 2021-08-16 22:38:21.188 openLuup.mqtt:: ERROR publishing application message for mqtt:openLuup/update/97/ReactorGroup/GroupStatus_grp174eydz3 : socket.select() not ready to send tcp{client}: 0x1ea35e0 2021-08-16 22:38:21.188 luup.variable_set:: 97.urn:toggledbits-com:serviceId:ReactorGroup.GroupStatus_grp174eydz3 was: 1 now: 0 #hooks:0 2021-08-16 22:38:21.188 luup.variable_set:: 97.urn:toggledbits-com:serviceId:ReactorSensor.Message was: Not tripped now: Not tripped #hooks:0 2021-08-16 22:38:21.191 luup.variable_set:: 88.urn:micasaverde-com:serviceId:GenericSensor1.CurrentLevel was: 2692 now: 2664 #hooks:0 2021-08-16 22:38:21.195 luup.variable_set:: 89.urn:micasaverde-com:serviceId:GenericSensor1.CurrentLevel was: 466 now: 466 #hooks:0 2021-08-16 22:38:21.198 luup.variable_set:: 90.urn:micasaverde-com:serviceId:GenericSensor1.CurrentLevel was: 760 now: 729 #hooks:0 2021-08-16 22:38:21.201 luup.variable_set:: 91.urn:micasaverde-com:serviceId:GenericSensor1.CurrentLevel was: 1465 now: 1468 #hooks:0 2021-08-16 22:38:21.251 luup.variable_set:: 92.urn:micasaverde-com:serviceId:GenericSensor1.CurrentLevel was: 1.9 now: 2 #hooks:0 2021-08-16 22:38:21.263 luup.variable_set:: 93.urn:micasaverde-com:serviceId:GenericSensor1.CurrentLevel was: 3.5 now: 3.3 #hooks:0 2021-08-16 22:38:21.267 luup.variable_set:: 94.urn:micasaverde-com:serviceId:GenericSensor1.CurrentLevel was: 6.4 now: 6.4 #hooks:0 2021-08-16 22:38:26.910 openLuup.io.server:: HTTP:3480 connection closed EXPIRED tcp{client}: 0xb16a38
These errors are similar to what I have seen on and off since setting up mqtt.
This morning OpenLuup crashed. Everything seemed fine in the evening, responsive, ok cpu load and no errors for quite some time. When checking the log the last entries are 06:53 and look normal. At 06:16 I had some errors, but after that it looks ok from what I can see.
2021-08-19 06:16:00.105 luup_log:0: 35Mb, 3.3%cpu, 2.4days 2021-08-19 06:16:16.644 openLuup.io.server:: MQTT:1883 connection closed tcp{client}: 0x187ca48 2021-08-19 06:16:16.645 openLuup.mqtt:: RECEIVE ERROR: closed tcp{client}: 0x187ca48 2021-08-19 06:16:17.753 openLuup.io.server:: MQTT:1883 connection from 192.168.1.191 tcp{client}: 0x19f3790
At the moment I have not got a clue why OpenLuup crashes, back to square zero as it feels. I have restarted and we will see what will happen.
After the restart this morning I have had no errors, the server is responsive and normal load (approx 4%). I have also checked the obvious like the temperature and Pi cpu on the Pi and it is ok. Lots of disk space available also. -
I'm wonder if the first error messages you shown are simply the fact that you have MQTT Inspector running on an, essentially, unattended machine, and it just goes to sleep for a while... I know that this is exactly what mine does.
I've become fairly convinced that these errors are something deep within the LuaSocket library. I've always have something like this from time to time, be it the HTTP server, or MQTT now, or other things. I doubt that this is directly related to your 'crash' (freeze?) but I wouldn't rule out a network issue.
I've just reloaded my main openLuup instance (running on Synology Docker) for a system updata, and that's been rock solid for the last 50 days, which is not unusual for all the openLuup systems I used to run.
-
@akbooer said in openLuup: MQTT server:
I'm wonder if the first error messages you shown are simply the fact that you have MQTT Inspector running on an, essentially, unattended machine, and it just goes to sleep for a while... I know that this is exactly what mine does.
I think you are correct, I have seen similar error messages before and as you said I had Mqtt Explorer running on my PC over night.
I've become fairly convinced that these errors are something deep within the LuaSocket library. I've always have something like this from time to time, be it the HTTP server, or MQTT now, or other things. I doubt that this is directly related to your 'crash' (freeze?) but I wouldn't rule out a network issue.
I've just reloaded my main openLuup instance (running on Synology Docker) for a system updata, and that's been rock solid for the last 50 days, which is not unusual for all the openLuup systems I used to run.It sounds reasonable that it could be something socket related, it looks like it on the errors. I wonder if the fact that I have my Zway server on another server could be the reason for these socket errors and the crashing/freezing. I assume that there is a lot of communication between the bridge and the zway server. My old server was rock solid before I set up Mqtt, perhaps the added load on the sockets gets too high at times.
-
@akbooer said in openLuup: MQTT server:
If you don't have to run MQTT Inspector, then don't! It subscribes to all messages and that certainly increases traffic
@akbooer I have now been running my Pi server for 26 days without any crashes. So far, so good!
Version 21.8.16 seems to give less errors in the log (almost none in fact) and also to be more stable.
I also have taken note not to have MqttExplorer up and running to lessen the load.Yesterday just for fun I set up Home Assistant Supervised. I managed to get it up and running of an old Athom PC with Ubuntu and Docker on.
Something new to learn.
I will also test MSR of course when I have got the grip of HA.A related topic to the Mqtt load above is that in HA there is a Mqtt Integration that I thought could be interesting to test together with OpenLuup.
The question is if anyone is using this together with OpenLuup as broker and if this would have the same risk of (over)loading the traffic on the OpenLuup server?
In other words not to use Mosquitto but instead the OpenLuup broker to get some of the published info into HA.
Or if there is a better way of doing this? -
@akbooer yes that makes sense of course!
If I have understood it right you do it in two steps in HA, step one is to point it to the broker and step two is then to add Mqtt devices.
In other words I hope that the first step does not then subscribe to "everything" as MqttExplorer perhaps does. -
I was seeing similar network issues and also came to the conclusion that the socket library was most likely at fault. My solution is to use Mosquitto as my main broker, which accepts all MQTT traffic (topic # in 0) with all my MQTT devices pointing to it, and then Mosquitto filters push traffic to openLuup. Below is my config file that displays the filters:
allow_anonymous true password_file /mosquitto/data/PW.txt listener 1883 connection openLuup address 127.0.0.1:1882 topic tele/# out topic stat/# out topic BlueIris/# out topic # in 0 cleansession false notifications true username ***** password ******* bridge_protocol_version mqttv311 try_private false log_timestamp true log_timestamp_format %Y-%m-%d--T_%H:%M:%S
As you can see, Mosquitto runs on the same server as openLuup. It is started by a docker compose file. The config filters eliminated the network errors on openLuup and my openLuup install now runs for days on end without any errors at all. I also have HA running on the same server via docker compose, though I only use it for its Hacs Alexa integration. I pipe my Alexa calls to HA using an HA token and a crude plugin that I wrote. I have not found a use for HA outside of openLuup yet, though there are some interesting integrations I will eventually try out.
As regards MQTT I don't think you need to worry about network traffic so much as mqtt is an extremely light protocol, at least in so far as compared to cameras and hi-def wireless etc ( I have a bunch of these high bandwidth devices on my network in their own subnets). I have found that the thing that tends to bog down is the lua socket function and as long as you limit its connections, you will probably alleviate most of the network problems.
Nginx is one of the best web servers available, specializing in load balancing millions of connections, and from what I've read, it is written in Lua. Which suggests that the lua socket module itself is causing the network issues as Nginx most likely rolled their own network library.
-
@buxton said in openLuup: MQTT server:
from what I've read, it is written in Lua.
It's written in C. And the BSD socket library that underpins the Unix/Linux versions is time-tested and battle-hardened. It could never be Lua, IMO, as the true multithreading/multitasking required is not a feature Lua possesses (and thus places a limit on Lua's socket handling).
-
luasocket definitely has limitations... I have investigated replacements in the past and never found one with sufficient maturity. There are many projects on the side attempting to improve on it. At the end I just updated the library to the latest on github.
Here is one example:
-
@toggledbits ah OK. Then I'm confusing the dev with lua scripts used within nginx.
-
@buxton said in openLuup: MQTT server:
I was seeing similar network issues and also came to the conclusion that the socket library was most likely at fault. My solution is to use Mosquitto as my main broker, which accepts all MQTT traffic (topic # in 0) with all my MQTT devices pointing to it, and then Mosquitto filters push traffic to openLuup. Below is my config file that displays the filters:
@Buxton thank you for the good advice!
I tried to set up the Mqtt integration in HA by directing it to the Mqtt address (mqtt://ipadress, port, user and passwd) on my OpenLuup, but it does not work. It just says "failed to connect" every time. Perhaps it only works with Mosquitto? Makes it a bit more complicated all by a sudden. I will see if I can try something in the direction of what you have set up later.I have not found a use for HA outside of openLuup yet, though there are some interesting integrations I will eventually try out.
I am in the same situation, no use at the moment, just a bit interested to see how it works. As you say there seem to be some interesting integrations there. Also there are more possibilities to present various information on the HA dashboard that could be nice for some use cases maybe. ESPHome also looks a bit interesting as a complement to Tasmota.
One use case that could be of interest to get into HA (in combination with ESPHome) is the energy metering of the house.As a sidenote my Shelly devices integrated really nicely into HA without affecting the Mqtt integration to OpenLuup.
-
I got the setup in HA to work so that it uses the OpenLuup Mqtt broker.
Instead of using the "Configuration->Integrations->Add Integrations->Mqtt" way that just gave an error message every time, I added it manually in the configuration.yaml file by simply adding:
mqtt: broker: ipadress port: 1883 username: user password: passwd
After a restart it works. I have tested both to send a test message from HA to OpenLuup and also creating a few sensors in HA that subscribe to a topic from a Tasmota device on the broker in OpenLuup.
I still have no use case for it at the moment, but at least I learnt something on the way.
-
Trying to look at @Crille 's report, updated my openLuup to the latest (development branch), started up, MQTT server doesn't appear to be running... can't connect and netstat reports nothing open on 1883. What do I need to do to get it running? Is there a configuration guide?
-
MQTT server doesn't appear to be running...
Have you assigned it a port?
local attr = luup.attr_set do -- enable MQTT attr ("openLuup.MQTT.Port", 1883) attr ("openLuup.MQTT.Bridge_UDP", 2883) -- UDP bridge attr ("openLuup.MQTT.PublishVariableUpdates", true) -- publish every variable update attr ("openLuup.MQTT.PublishDeviceStatus", 2) -- publish a single device status every N seconds (0 = never) end
-
…documentation was in this release note…
2020 Release 10.2
-
Excellent, thanks! On first blush, it looks like the service isn't closing connections completely on restart/shutdown; they stay open for a minute or so and then time out. Not sure if that's related, but may need a look.
Also I can't connect my Home Assistant 2021.11.5 to the broker. This in the logs:
2021-11-24 09:59:41.248 openLuup.io.server:: MQTT:1883 connection from 192.168.0.10 tcp{client}: 0x561b1d43bdb8 2021-11-24 09:59:41.249 openLuup.io.server:: MQTT:1883 connection closed tcp{client}: 0x561b1d43bdb8 2021-11-24 09:59:41.249 openLuup.mqtt:: CONNECT: Unknown protocol name: 'MQIsdp' tcp{client}: 0x561b1d43bdb8 2021-11-24 09:59:42.255 openLuup.io.server:: MQTT:1883 connection from 192.168.0.10 tcp{client}: 0x561b1d4499a8 2021-11-24 09:59:42.256 openLuup.io.server:: MQTT:1883 connection closed tcp{client}: 0x561b1d4499a8 2021-11-24 09:59:42.256 openLuup.mqtt:: CONNECT: Unknown protocol name: 'MQIsdp' tcp{client}: 0x561b1d4499a8 2021-11-24 09:59:44.262 openLuup.io.server:: MQTT:1883 connection from 192.168.0.10 tcp{client}: 0x561b1d4630c8 2021-11-24 09:59:44.263 openLuup.io.server:: MQTT:1883 connection closed tcp{client}: 0x561b1d4630c8 2021-11-24 09:59:44.263 openLuup.mqtt:: CONNECT: Unknown protocol name: 'MQIsdp' tcp{client}: 0x561b1d4630c8 2021-11-24 09:59:57.907 openLuup.io.server:: MQTT:1883 connection from 192.168.0.10 tcp{client}: 0x561b1d501108 2021-11-24 09:59:57.907 openLuup.io.server:: MQTT:1883 connection closed tcp{client}: 0x561b1d501108 2021-11-24 09:59:57.908 openLuup.mqtt:: CONNECT: Unknown protocol name: 'MQIsdp' tcp{client}: 0x561b1d501108 2021-11-24 09:59:58.913 openLuup.io.server:: MQTT:1883 connection from 192.168.0.10 tcp{client}: 0x561b1d50e638 2021-11-24 09:59:58.914 openLuup.io.server:: MQTT:1883 connection closed tcp{client}: 0x561b1d50e638 2021-11-24 09:59:58.914 openLuup.mqtt:: CONNECT: Unknown protocol name: 'MQIsdp' tcp{client}: 0x561b1d50e638
-
@toggledbits said in openLuup: MQTT server:
Also I can't connect my Home Assistant 2021.11.5 to the broker. This in the logs:
Looks like it is using a modified protocol name MQIsdp rather than the default MQTT.
At the moment, it's not configurable on the openLuup side (but, of course, it could be.) Can you change this in HA?
-
@akbooer doesn't appear to have an option to change it:
On the other issue, my MQTT library is attempting to reconnect, but this is the only thing logged:
2021-11-24 10:05:18.394 openLuup.io.server:: MQTT:1883 connection from 192.168.0.66 tcp{client}: 0x55e743b50ef8
There are no other messages with that ID. Can I get some more debug out of the server somehow? The library on my end is the latest version of the MQTT library commonly used in NodeJS; it's been around for a long time, and works perfectly with Mosquitto and other brokers I've tried. Initial connection always works, it's just reconnects that fail, so clearly there is something between the two that's keeping some history and maybe altering connect behavior, but I have no idea what and no visibility into it (at the moment).