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
Migrating Zwave & ZigBee stuff to MQTT - guidance needed.
-
@a-lurker said in Migrating Zwave & ZigBee stuff to MQTT - guidance needed.:
time will tell how reliable the system as whole would be
Is there some symptomatic problem I should know about?
@a-lurker said in Migrating Zwave & ZigBee stuff to MQTT - guidance needed.:
"D_GenericZigbeeDevice.xml", of which the actual file doesn't seem to exist
It does, in openLuup's virtual world. If you try
http://openLuupIP:3480/D_GenericZigbeeDevice.xml
you should see this in the browser:<?xml version="1.0"?> <root xmlns="urn:schemas-upnp-org:device-1-0"> <specVersion> <major>1</major> <minor>0</minor> <minimus>auto-generated</minimus></specVersion> <device> <staticJson>D_GenericZigbeeDevice.json</staticJson> <deviceType>GenericZigbeeDevice</deviceType></device></root>
I'll fix the error and review the infer_device_type() function. It was always going to evolve anyway as different device needs arise.
I have tended to represent any sort of multi-action switch as a scene controller. There will always be difficult cases (sometimes resolved by using vendor/manufacturer) but I have shied away from an extensive configuration database. Plausible, I suppose, to pull this from the web...?
I rely on Philips Hue for the few Zigbee devices that I have, so probably won't get to road test this for myself. You're going to want to do the whole thing again for Zwave JS ?
-
@akbooer said in Migrating Zwave & ZigBee stuff to MQTT - guidance needed.:
Is there some symptomatic problem I should know about?
I don't think so but who wants to set up heaps of devices in a new set up when everything has been going well for years with just openLuup and an old Vera war horse!
Plausible, I suppose, to pull this from the web...?
Don't need to get to complicated too soon, as you just about have it all covered but I'm still thinking of one of these Hue Smart plugs. It's just a switch, as opposed to a scene controller.
I rely on Philips Hue for the few Zigbee devices that I have
Arrhh you know you want to ditch that hub.
You're going to want to do the whole thing again for Zwave JS ?
Maybe after a cup of tea and good lie down. And yourself?
-
@a-lurker said in Migrating Zwave & ZigBee stuff to MQTT - guidance needed.:
Maybe after a cup of tea and good lie down. And yourself?
Definitely the tea. Possibly the lie down.
You'll have to educate me about the protocol, yet again, but it should almost be a dead-ringer for the Zigbee ??
-
@akbooer said in Migrating Zwave & ZigBee stuff to MQTT - guidance needed.:
Release development v22.12.6 separating switch and controller devices, and fixing nil function pointer
Thanks for that - looks OK now.
Have now got all my Hue stuff running with no Hue hub - that's good. A few complications here and there.
Main complication:
Conditions:
z2m is running and openLuup is running.
Then pair new device: in this case this Philips light bulb with z2m.
z2m logs this to the terminal. I've prettied the json section so you can read it:Zigbee2MQTT:info 2022-12-10 10:40:28: Device '0x001788010363fcbf' joined Zigbee2MQTT:info 2022-12-10 10:40:28: MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"friendly_name":"0x001788010363fcbf","ieee_address":"0x001788010363fcbf"},"type":"device_joined"}' Zigbee2MQTT:info 2022-12-10 10:40:28: Starting interview of '0x001788010363fcbf' Zigbee2MQTT:info 2022-12-10 10:40:28: MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"friendly_name":"0x001788010363fcbf","ieee_address":"0x001788010363fcbf","status":"started"},"type":"device_interview"}' Zigbee2MQTT:info 2022-12-10 10:40:29: Successfully interviewed '0x001788010363fcbf', device has successfully been paired Zigbee2MQTT:info 2022-12-10 10:40:29: Device '0x001788010363fcbf' is supported, identified as: Philips Hue White A60 Single bulb E27/B22 (8718696449691) Zigbee2MQTT:info 2022-12-10 10:40:29: MQTT publish: topic 'zigbee2mqtt/bridge/event', payload ' { "data": { "definition": { "description": "Hue White A60 Single bulb E27/B22", "exposes": [{ "features": [{ "access": 7, "description": "On/off state of this light", "name": "state", "property": "state", "type": "binary", "value_off": "OFF", "value_on": "ON", "value_toggle": "TOGGLE" }, { "access": 7, "description": "Brightness of this light", "name": "brightness", "property": "brightness", "type": "numeric", "value_max": 254, "value_min": 0 }], "type": "light" }, { "access": 2, "description": "Triggers an effect on the light (e.g. make light blink for a few seconds)", "name": "effect", "property": "effect", "type": "enum", "values": ["blink", "breathe", "okay", "channel_change", "finish_effect", "stop_effect"] }, { "access": 1, "description": "Link quality (signal strength)", "name": "linkquality", "property": "linkquality", "type": "numeric", "unit": "lqi", "value_max": 255, "value_min": 0 }], "model": "8718696449691", "options": [{ "access": 2, "description": "Controls the transition time (in seconds) of on/off, brightness, color temperature (if applicable) and color (if applicable) changes. Defaults to `0` (no transition).", "name": "transition", "property": "transition", "type": "numeric", "value_min": 0 }], "supports_ota": true, "vendor": "Philips" }, "friendly_name": "0x001788010363fcbf", "ieee_address": "0x001788010363fcbf", "status": "successful", "supported": true }, "type": "device_interview" } ' Zigbee2MQTT:info 2022-12-10 10:40:29: Configuring '0x001788010363fcbf' Zigbee2MQTT:info 2022-12-10 10:40:29: Successfully configured '0x001788010363fcbf'
Looks like openLuup then responds to the topic zigbee2mqtt/bridge/event ?? and creates a Generic device. The openLuup log doesn't make it clear what topic it's responding to when it creates a device but you can see in the log that it has found a new device:
2022-12-10 10:40:28.568 openLuup.mqtt:: PUBLISH tcp{client}: 0x3a7b670 2022-12-10 10:40:28.571 luup.zigbee2mqtt:0: Topic ignored : zigbee2mqtt : / : bridge/logging 2022-12-10 10:40:28.574 openLuup.mqtt:: PUBLISH tcp{client}: 0x3a7b670 2022-12-10 10:40:28.591 luup.zigbee2mqtt:0: New Zigbee detected: 0x001788010363fcbf 2022-12-10 10:40:28.594 luup.create_device:: [20010] D_GenericZigbeeDevice.xml / / D_GenericZigbeeDevice.json (GenericZigbeeDevice) 2022-12-10 10:40:28.602 openLuup.mqtt:: PUBLISH tcp{client}: 0x3a7b670 2022-12-10 10:40:28.603 luup.zigbee2mqtt:0: Topic ignored : zigbee2mqtt : / : bridge/logging 2022-12-10 10:40:28.605 openLuup.mqtt:: PUBLISH tcp{client}: 0x3a7b670 2022-12-10 10:40:28.605 luup.zigbee2mqtt:0: Topic ignored : zigbee2mqtt : / : bridge/event 2022-12-10 10:40:28.607 openLuup.mqtt:: PUBLISH tcp{client}: 0x3a7b670 2022-12-10 10:40:28.607 luup.zigbee2mqtt:0: Topic ignored : zigbee2mqtt : / : bridge/logging 2022-12-10 10:40:28.609 openLuup.mqtt:: PUBLISH tcp{client}: 0x3a7b670 2022-12-10 10:40:28.626 openLuup.mqtt:: PUBLISH tcp{client}: 0x3a7b670 2022-12-10 10:40:28.626 luup.zigbee2mqtt:0: Topic ignored : zigbee2mqtt : / : bridge/logging 2022-12-10 10:40:28.628 openLuup.mqtt:: PUBLISH tcp{client}: 0x3a7b670 2022-12-10 10:40:28.628 luup.zigbee2mqtt:0: Topic ignored : zigbee2mqtt : / : bridge/event 2022-12-10 10:40:28.754 openLuup.server:: request completed (11333 bytes, 1 chunks, 2261 ms) tcp{client}: 0x43d0070 2022-12-10 10:40:28.766 openLuup.server:: GET /data_request?id=user_data&output_format=json&DataVersion=564556066&_=1670559272961 HTTP/1.1 tcp{client}: 0x43d0070 2022-12-10 10:40:29.987 openLuup.server:: request completed (1723523 bytes, 108 chunks, 1220 ms) tcp{client}: 0x43d0070 2022-12-10 10:40:30.017 openLuup.mqtt:: PUBLISH tcp{client}: 0x3a7b670 2022-12-10 10:40:30.017 luup.zigbee2mqtt:0: Topic ignored : zigbee2mqtt : / : bridge/logging 2022-12-10 10:40:30.018 openLuup.mqtt:: PUBLISH tcp{client}: 0x3a7b670 2022-12-10 10:40:30.018 luup.zigbee2mqtt:0: Topic ignored : zigbee2mqtt : / : bridge/logging 2022-12-10 10:40:30.020 openLuup.mqtt:: PUBLISH tcp{client}: 0x3a7b670 2022-12-10 10:40:30.032 openLuup.mqtt:: PUBLISH tcp{client}: 0x3a7b670 2022-12-10 10:40:30.033 luup.zigbee2mqtt:0: Topic ignored : zigbee2mqtt : / : bridge/logging 2022-12-10 10:40:30.034 openLuup.mqtt:: PUBLISH tcp{client}: 0x3a7b670 2022-12-10 10:40:30.035 luup.zigbee2mqtt:0: Topic ignored : zigbee2mqtt : / : bridge/event 2022-12-10 10:40:30.036 openLuup.mqtt:: PUBLISH tcp{client}: 0x3a7b670 2022-12-10 10:40:30.036 luup.zigbee2mqtt:0: Topic ignored : zigbee2mqtt : / : bridge/logging 2022-12-10 10:40:30.037 openLuup.mqtt:: PUBLISH tcp{client}: 0x3a7b670 2022-12-10 10:40:30.037 luup.zigbee2mqtt:0: Topic ignored : zigbee2mqtt : / : bridge/logging 2022-12-10 10:40:30.039 openLuup.mqtt:: PUBLISH tcp{client}: 0x3a7b670 2022-12-10 10:40:30.048 openLuup.mqtt:: PUBLISH tcp{client}: 0x3a7b670 2022-12-10 10:40:30.052 luup.zigbee2mqtt:0: Topic ignored : zigbee2mqtt : / : bridge/info
So it looks as the event returns the same data as "zigbee2mqtt/bridge/devices" does, as each new device is paired but it's parent json is a little different. The device definition is below "data" in the json:
"data":
With type set as follows:
type="device_interview",
and this must indicate success:
data.status ="successful"
Hope that's clear - bit hard to explain.
Suffice to say I added a pile of stuff and ended up with a whole pile of generic devices, which I had to remove one by one with a openLuup restart for each. Got a bit ambitious!
However; it looks like the ability to handle the addition of new devices on the fly without having to restart thez2m server each time to get the device definitions, would certainly be possible and a welcome addition.
Looks like you just look for the event topic with {"type":"device_interview" and {"data": status":"successful".
The json contains definition.expose.type = light so the function infer_device_type() should still do its work OK as it currently does.
I can't test any new code on this as I have now added all my devices. Although I could unpair just a light bulb and repair it and see what happens.
-
A slight in convenience:
Conditions:
Having just added a scene controller to z2m and restarted the z2m server and openLuup has dutifully added it in and here it is:Great; so first thing to do next, is to link the scene controller to a scene: So create a new scene, dial up the scene controller and put a watch on to create a trigger:
LastSceneTime (new~=old)
Problem is LastSceneTime is nowhere to be found - bit disconcerting at this point. In order to proceed, you have to push a button on the scene controller to get the variable to be created. Suggest the variable is created when the scene controller is first added to openLuup and set its time to Unix year zero.
-
This vibration detection device and other similar devices should be "inferred" as a motion sensor. They expose "contact".
Perhaps infer_device_type() could use some look up table or look at json string that could perhaps be later saved to a file that the user could fiddle with? eg some vague pesudo code. Whatever you figure would work.
local deviceType = nil if (lookup.exposes.contact) then deviceType = lookup.exposes.contact end
-
@a-lurker said in Migrating Zwave & ZigBee stuff to MQTT - guidance needed.:
Looks like openLuup then responds to the topic zigbee2mqtt/bridge/event ?? and creates a Generic device.
Can't see how that would happen. The bridge code is clear that anything other than bridge/devices is ignored:
local function handle_bridge_topics (topic, message) local subtopic = topic: match "^bridge/(.+)" if subtopic: match "^devices" then create_devices (message) else ignore_topic (topic) end end
and it should write Topic ignored... in the log. If it creates a device, it must be receiving the actual /devices topics. I take it that your "info" log messages are your own additions to the code. I could certainly make it respond to a /event topic. The Shelly and Tasmota bridges already create new devices on the fly, because they send their own configurations when they connect to MQTT.
-
@a-lurker said in Migrating Zwave & ZigBee stuff to MQTT - guidance needed.:
Problem is LastSceneTime is nowhere to be found - bit disconcerting at this point. In order to proceed, you have to push a button on the scene controller to get the variable to be created.
Yes, that's true. The root cause is actually that the service file for a scene controller S_SceneController1.xml does not contain a definition of that variable, or a default vaule for it. I could force this at device creation, but you have found a work-around alreay.
-
@a-lurker said in Migrating Zwave & ZigBee stuff to MQTT - guidance needed.:
A slight in convenience: no way to set color on the light bulbs. X,Y color space seems better than RGB as it allows you to specify white color temperature.
Some investigation required here. The existing Color service definition defines three actions of interest:
- setColor
- setColorRGB
- setColorTemperature
It's not clear from the service file definition what the possible value/syntax is for any of these commands, so that would mean delving into the UPnP documentation, which, previously, I've found to be an absolute nightmare (as are most international standard definitions.) Perhaps csomeone here can aleady tell us the answer?
-
@a-lurker said in Migrating Zwave & ZigBee stuff to MQTT - guidance needed.:
This vibration detection device and other similar devices should be "inferred" as a motion sensor. They expose "contact".
Do you have the bridge/devices JSON for that device?
-
@akbooer said in Migrating Zwave & ZigBee stuff to MQTT - guidance needed.:
The root cause is actually that the service file for a scene controller S_SceneController1.xml does not contain a definition of that variable, or a default vaule for it. I could force this at device creation
...and I have just done so in development v22.12.11.
-
@akbooer said in Migrating Zwave & ZigBee stuff to MQTT - guidance needed.:
I take it that your "info" log messages are your own additions to the code.
The two logs are directly as they were spat out, except for uncollapsing of the json as mentioned above. I made no changes.
Yes - this is very odd - I can't see how the code would respond to anything else but the bridges/devices topic either. But certainly it appears to have done same; but unsuccessfully as all devices ended up being considered Generic. I may have to try repairing a bulb with more debug code.
Moving forward - responding to an /event topic would be good.
-
These messages:
Zigbee2MQTT:info 2022-12-10 10:40:28: MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"friendly_name":"0x001788010363fcbf","ieee_address":"0x001788010363fcbf"},"type":"device_joined"}' Zigbee2MQTT:info 2022-12-10 10:40:28: Starting interview of '0x001788010363fcbf' Zigbee2MQTT:info 2022-12-10 10:40:28: MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"friendly_name":"0x001788010363fcbf","ieee_address":"0x001788010363fcbf","status":"started"},"type":"device_interview"}' Zigbee2MQTT:info 2022-12-10 10:40:29: Successfully interviewed '0x001788010363fcbf', device has successfully been paired Zigbee2MQTT:info 2022-12-10 10:40:29: Device '0x001788010363fcbf' is supported, identified as: Philips Hue White A60 Single bulb E27/B22 (8718696449691)
…don’t come from my code. You mentioned that this was printed out to the console… something else must be doing this too.
-
@akbooer said in Migrating Zwave & ZigBee stuff to MQTT - guidance needed.:
Some investigation required here. The existing Color service definition defines three actions of interest:
setColor
setColorRGB
setColorTemperatureIt's not clear from the service file definition what the possible value/syntax is for any of these commands, so that would mean delving into the UPnP documentation, which, previously, I've found to be an absolute nightmare (as are most international standard definitions.) Perhaps csomeone here can aleady tell us the answer?
I've done a lot of work on the color side of thing in the Vera, and my code used to work on openluup as well. Feel free to take inspiration from https://github.com/dbochicchio/vera-VirtualDevices/blob/master/L_VirtualRGBW1.lua
From line 134 you'll find all the formats that luup is supporting, at least on Vera's side. There's also W/D, for warn and cool white.
-
@akbooer said in Migrating Zwave & ZigBee stuff to MQTT - guidance needed.:
don’t come from my code. You mentioned that this was printed out to the console… something else must be doing this too.
Yes - this is the output from z2m to its terminal, which I am monitoring. ie from the z2m server. Not from openLuup.
So the z2m server is interviewing the newly detected device and recognises it; next it ends up being created in openLuup!
-
@a-lurker said in Migrating Zwave & ZigBee stuff to MQTT - guidance needed.:
So the z2m server is interviewing the newly detected device and recognises it; next it ends up being created in openLuup!
Mystery solved (partially.) From the docs:
zigbee2mqtt/bridge/devices
”Contains the devices connected to the bridge, this message is published as retained. Whenever a device joins or leaves this is republished.”
…but this doesn’t explain why the devices are not identified correctly.
-
zigbee2mqtt/bridge/devices
”Contains the devices connected to the bridge, this message is published as retained. Whenever a device joins or leaves this is republished.”Well this turns out to be the case. Neither openLuup or z2m logged this, as you can see in the logs provided above. However I added logging some code to openLuup and yes and as expected the zigbee2mqtt/bridge/devices topic is published each time you add & remove a zigbee device, which is great. Would be good to see openLuup log the json info when any topic is RX'ed and when MQTT is in debug mode. mqttExplorer would have picked this up but it wasn't running at the time.
Here is the definition json for the dual general purpose outlet (GPO):
{ "date_code": "", "definition": { "description": "Ikuü double power point with USB", "exposes": [{ "endpoint": "left", "features": [{ "access": 7, "description": "On/off state of the switch", "endpoint": "left", "name": "state", "property": "state_left", "type": "binary", "value_off": "OFF", "value_on": "ON", "value_toggle": "TOGGLE" }], "type": "switch" }, { "endpoint": "right", "features": [{ "access": 7, "description": "On/off state of the switch", "endpoint": "right", "name": "state", "property": "state_right", "type": "binary", "value_off": "OFF", "value_on": "ON", "value_toggle": "TOGGLE" }], "type": "switch" }, { "access": 1, "description": "Instantaneous measured power", "endpoint": "left", "name": "power", "property": "power_left", "type": "numeric", "unit": "W" }, { "access": 1, "description": "Instantaneous measured electrical current", "endpoint": "left", "name": "current", "property": "current_left", "type": "numeric", "unit": "A" }, { "access": 1, "description": "Measured electrical potential value", "endpoint": "left", "name": "voltage", "property": "voltage_left", "type": "numeric", "unit": "V" }, { "access": 1, "description": "Sum of consumed energy", "name": "energy", "property": "energy", "type": "numeric", "unit": "kWh" }, { "access": 1, "description": "Link quality (signal strength)", "name": "linkquality", "property": "linkquality", "type": "numeric", "unit": "lqi", "value_max": 255, "value_min": 0 }], "model": "SPPUSB02", "options": [{ "access": 2, "description": "Calibrates the power value (percentual offset), takes into effect on next report of device.", "name": "power_calibration", "property": "power_calibration", "type": "numeric" }, { "access": 2, "description": "Calibrates the current value (percentual offset), takes into effect on next report of device.", "name": "current_calibration", "property": "current_calibration", "type": "numeric" }, { "access": 2, "description": "Calibrates the voltage value (percentual offset), takes into effect on next report of device.", "name": "voltage_calibration", "property": "voltage_calibration", "type": "numeric" }], "supports_ota": false, "vendor": "Mercator" }, "endpoints": { "1": { "bindings": [{ "cluster": "genBasic", "target": { "endpoint": 1, "ieee_address": "0x84b4dbfffecc0c6f", "type": "endpoint" } }, { "cluster": "genOnOff", "target": { "endpoint": 1, "ieee_address": "0x84b4dbfffecc0c6f", "type": "endpoint" } }, { "cluster": "haElectricalMeasurement", "target": { "endpoint": 1, "ieee_address": "0x84b4dbfffecc0c6f", "type": "endpoint" } }, { "cluster": "seMetering", "target": { "endpoint": 1, "ieee_address": "0x84b4dbfffecc0c6f", "type": "endpoint" } }], "clusters": { "input": ["genBasic", "genGroups", "genScenes", "genOnOff", "seMetering", "haElectricalMeasurement", "manuSpecificTuya", "genIdentify"], "output": ["genOta", "genTime"] }, "configured_reportings": [{ "attribute": "rmsVoltage", "cluster": "haElectricalMeasurement", "maximum_report_interval": 3600, "minimum_report_interval": 5, "reportable_change": 5 }, { "attribute": "rmsCurrent", "cluster": "haElectricalMeasurement", "maximum_report_interval": 3600, "minimum_report_interval": 5, "reportable_change": 50 }, { "attribute": "activePower", "cluster": "haElectricalMeasurement", "maximum_report_interval": 3600, "minimum_report_interval": 5, "reportable_change": 1 }, { "attribute": "onOff", "cluster": "genOnOff", "maximum_report_interval": 3600, "minimum_report_interval": 0, "reportable_change": 0 }], "scenes": [] }, "2": { "bindings": [{ "cluster": "genOnOff", "target": { "endpoint": 1, "ieee_address": "0x84b4dbfffecc0c6f", "type": "endpoint" } }], "clusters": { "input": ["genGroups", "genScenes", "genOnOff", "manuSpecificTuya", "genIdentify"], "output": [] }, "configured_reportings": [{ "attribute": "onOff", "cluster": "genOnOff", "maximum_report_interval": 3600, "minimum_report_interval": 0, "reportable_change": 0 }], "scenes": [] }, "242": { "bindings": [], "clusters": { "input": [], "output": ["greenPower"] }, "configured_reportings": [], "scenes": [] } }, "friendly_name": "0x842e14fffe13d0d5", "ieee_address": "0x842e14fffe13d0d5", "interview_completed": true, "interviewing": false, "manufacturer": "_TZ3210_pfbzs1an", "model_id": "TS011F", "network_address": 64390, "power_source": "Mains (single phase)", "supported": true, "type": "Router" }
To recognise this GPO, the function infer_device_type() needs to have a minor change:
--elseif exp.switch then elseif exp.type == "switch" then
That's not going to help very much as the device has two outlets and hence two independently controllable relays. It also has Voltage, current & power measurement but to make everything more difficult the power measurement is the addition of the power consumed by both outlets. This implies the device needs to be represented as a single parent with two children. Gets a bit messy.
The json defines two "Endpoint"s: "Endpoint: left" & "Endpoint: right". I note that ZWave JS UI takes the same sort of approach of making use of endpoints for compound devices.
Looking through the zigbee devices database you see identifiers such as follows - for compound devices:
state state_left, state_right state_left, state_center, state_right state_top, state_center, state_bottom state_l1, state_l2, state_l3, state_l4 --> state_lX state_top_left, state_center_left, state_bottom_left, state_top_right, state_center_right, state_bottom_right,
The dual GPO under discussion returns this payload regularly:
{ "current_left": 0, "energy": 0, "linkquality": 252, "power_left": 0, "state_left": "OFF", "state_right": "OFF", "voltage_left": 245 }
In fact, straight after purchase, it was returning this about every two seconds but fortunately in the z2m web page, you can change the reporting interval.