Domoticz Bridge
-
While i wait for MSR to arrive, i'm trying to get better control over my zigbee devices. Looked over the fence to Domoticz, and they have a really good plugin for Zigate, and as there was a domoticz bridge here, i thought i'd use that instead..
This plugin have bben abandoned for some years though, and when I installed it, it won't start properly.. looking at the startup log, it looks like OpenLuup might have had some changes that needs to be handled in the plugin? (@akbooer ?)
2021-01-26 22:31:37.457 luup.create_device:: [833] D_DomoticzBridge.xml / I_DomoticzBridge.xml / D_DomoticzBridge.json (DomoticzBridge) 2021-01-26 22:31:37.457 openLuup.chdev:: [string "L_DomoticzBridge.lua"]:59: module 'openLuup.rooms' not found: no field package.preload['openLuup.rooms'] no file './openLuup/rooms.lua' no file '/usr/local/share/lua/5.1/openLuup/rooms.lua' no file '/usr/local/share/lua/5.1/openLuup/rooms/init.lua' no file '/usr/local/lib/lua/5.1/openLuup/rooms.lua' no file '/usr/local/lib/lua/5.1/openLuup/rooms/init.lua' no file '/usr/share/lua/5.1/openLuup/rooms.lua' no file '/usr/share/lua/5.1/openLuup/rooms/init.lua' no file '../cmh-lu/openLuup/rooms.lua' no file 'files/openLuup/rooms.lua' no file 'openLuup/openLuup/rooms.lua' no file './openLuup/rooms.so' no file '/usr/local/lib/lua/5.1/openLuup/rooms.so' no file '/usr/lib/x86_64-linux-gnu/lua/5.1/openLuup/rooms.so' no file '/usr/lib/lua/5.1/openLuup/rooms.so' no file '/usr/local/lib/lua/5.1/loadall.so' no file './openLuup.so' no file '/usr/local/lib/lua/5.1/openLuup.so' no file '/usr/lib/x86_64-linux-gnu/lua/5.1/openLuup.so' no file '/usr/lib/lua/5.1/openLuup.so' no file '/usr/local/lib/lua/5.1/loadall.so'
-
Indeed, there is no openLuup.rooms module, and has not been for a long while. It’s an old internal architecture which should never have been required by a plugin.
-
Does all this, which is no longer usable:
local chdev = require "openLuup.chdev" local json = require "openLuup.json" local rooms = require "openLuup.rooms" local userdata = require "openLuup.userdata" local loader = require "openLuup.loader" -- thank @akbooer for the hint about device file info
-
I'll probably start from scratch ans just save the communication part, if I was you. Take a look at how the current vera/Ezlo/uzb bridges are done. this is the way to go.
-
Yes. I took a quick look, and I see that it’s based on an old VeraBridge version and has loads of stuff which is really not relevant or useful.
-
Ok. Seems like a good place to learn some plugin programming for me then.
-
Bridges are tricky.
-
A quick solution could be to install my own Virtual Devices plug-in and just map some HTTP calls. I'm using it to map MQTT-based things, my own virtual devices and to group them (ie: to sync dimmers or blinds). If my memory is till working, domoticz has a simple HTTP api and you could update variables very easily.
-
Allready dug my feet in.
One thing i'm struggling with is - Isn't usually (coming from VB and C++) interfaces to GUI and core more pronounced in the code layup? I.e the "variables" table for devices - this would in my head be defined as a set of variables defined one place in the code with a notation that that is where they get input/can be read/manipulated?
The panels underneath the "Control panel" tab are defined in the I_...xml, but again i don't se an overview of the variables used there in the .Lua?
I'm by no means a professional programmer, but this makes the learning curve a bit steep.
-
Bizarrely, the variables don’t appear in the .lua file and aren’t directly accessible by the plugin itself. You have to resort to using the same luup.variable_get() function as any other code would to access the device. This is something I fixed when writing openLuup.
-
Ok, but where is the list of variables (variable tab on device in GUI) defined then?
-
Partly in the service files which the device/implementation .xml files use, and partly dynamically. Anything, anywhere , can create a new serviceId/variable on any device. That's why the 'documentation' here:
http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#function:_device_supports_service
says:
"Setting UPnP variables is unrestricted and free form, and the engine doesn't really know if a device actually uses it or does anything with it."
-
I started with the latest VeraBridge and rebuild that to an EzloBridge (with some help from ak). VeraBridge has only a .lua file and all other files are sort of build in the openLuup virtual file system. You will have to make your own copies just as for a normal plugin. You can look at EzloBridge for some ideas https://github.com/reneboer/EzloBridge/tree/master/src
I can tell you it is tricky to do, but doable.
Cheers Rene
-
I got the domoticz bridge up and running, though still with many flaws to iron out..
@akbooer: Is x_BarometerSensor1.x definition a part of Openluup installation?
I got it with the Zigate plugin I think.. If not, mabye add it?
I can push it with the domoticz update as well, but it might as well be with OpenLuup? -
@perh said in Domoticz Bridge:
BarometerSensor1
No, it’s not. For the Netatmo weather station, I chose to use the GenericSensor1 serviceId.
It barely matters, since apps wouldn’t recognise it anyway?
-
Don't remember where it mattered, so your'e probably right.. But it opens for a nice icon at least? and an identifier for future apps?
Not a big thing, but as the files are made..
-
I actually created one such device class with a specific icon based on the generic sensor. I probably posted here somewhere as I used it to bridge zigbee devices from home-assistant....
-
It's getting ready now, and I uploaded a "release" to github in a fork from the original. Do I have to upload to the original repository to make it available in AppStore?
@akbooer: This plugin has a script that is run in domoticz to get async updates. How is that done in zway/vera bridge? (in short, and laymans terms please)
-
About Zerobrane: Sometimes the output shows "The syntax of the command is incorrect", how do i find where precisely that is?
-
@perh said in Domoticz Bridge:
This plugin has a script that is run in domoticz to get async updates. How is that done in zway/vera bridge? (in short, and laymans terms please)
Sorry, not quite clear what you're asking here. Can you expand on this?
10/41