Another transition from Vera to OpenLuup And now to HASS - PerH
-
@therealdb: Yes, it would definately require some writing on the plugin, but then it would also open for more users.. we'll see!
There is some really good plugins and features in Domoticz as well, so its OK even if the plugin stays attached to it, as long as the performance stays good. Next plugin for me to install now is the Xiaomi Vacuum.
-
Finally starting to get the docker thing here, and currently i've got z-way 3.1.3, domoticz and miio-server (for the vacuum) running in dockers. Nice to se that there's no performance reduction with this either. I'd also like to get grafana and influxdb into dockers.
Plan now is to have some daily backup routine. I was thinking mabye just to have Reactor do
os.execute cp -rf <docker volume folder> <backup folder on SSD>
sometime at night. Any thoughts? -
Per, how are you planning to handle daemonizing? I've been playing with docker-compose, which seems a good way to remove the need to have a command line with a lot of error-prone parameters that users must type.
-
Yes, i've made a docker-compose file that brings up all the dockers and set them up on the same internal bridge network with static IP's. Then all intercom is done with the same IP's on any hardware, so theres not much to set up other than copying in the volume backups.
Daemonizing was a new word for me, in this context you were referring to automating the install, right?
-
By "daemonizing" I mean starting them as a daemon, which is in Unix parlance a console-less process that runs in the background (a service, if you will).
-
The closest I have come to this has been running them as systemctl services. My single VM actually runs everything that way. I did so for MSR as well but no docker for me. You can put all of these command within the service file? I am actually autostarting all of my services in a sequence with dependencies: example: Do a socat reload before starting z-way. Then when z-way is up start openluup then start habridge then start homekitbridge... etc...
-
Well, as long as you state restart policy "restart: always" or "restart: unless stopped" in the docker-compose file, it will start that container on reboot as long as the docker daemon itself starts.. docker installed itself as a service, so i haven't thought about it really.
Just to have it said; the docker-compose is just a script to rig up the containers with the correct settings. This is done once, after that the restart policy you set for the containers decides how they will live from there. you can set up as many containers as you like in one compose file.
-
@rafale77
Haven't thought about dependencies, all the stuff i'm linking together handles if one is missing.. you can set up Startup and shutdown order in the compose file, so i guess that is the docker way to handle it? -
I finally reached the finishline for the move-to-docker project!
All applications are now inside dockers, communicating on the internal docker network.This makes updates easy - just update to a newer docker image. (or update in the app, in the openLuup case)
Backup is done by copying the docker volumes to an SSD along with the indluxDB.
Restore to any machine running docker is in principle just attaching the USB devices - install ser2net, and running one docker-compose file. Everything is set up and ready to go. Tested on an Ubuntu installed machine, and it works!
This will offcourse take a bit more disk-space, havent summed it up yet.. But i have no plans on running this on machines with tiny storage anyway.
One thing i'd like to improve is to get the UZB into Ser2net as well, with the advantage of accessing it from my test-system as well. Z-Way unfortunately can't take IP-serial without Socat? mabye in later updates.
I made this sketch to keep track of the system in progress, it might be usefull to others?
-
Really enlightening.
BTW, Where do I go to find out more about “the internal Docker network”. I’m having no end of problems with openLuup not identifying incoming IPs correctly.
-
I found my info here, and lookung at other docker-compose files. I've only set up a standard "bridge" network, theres more advanced methods available as well. I found that giving the containers static IP worked for me.
You can do that in a run command, in compose or manually in portainer (but that will be gone in a reset of the setup). I'd recommend docker-compose! -
But Z-Way needs an address to a device right? haven't looked into it.. tried to put in ip:port, didnt work..
-
Ohh I see what you mean... if using z-way then yeah I don't think it has direct socket access so you will need socat to move back from IP to a serial port.
-
I left the system completely alone for a few weeks now, and as mentioned here, my disk filled up. A lot of strange things happens when there is no disk space, so i was suprised that it actually ran for the most part at all.
MSR started doing some - but not all tasks, seemed like it was when the que of actions was longer than a certain number, things got ignored. It may offcourse have been domoticz, openluup or z-way that didn't do its job, can't say for sure..One lesson is - don't try to set up a container if there's not space for it! I tried installing the latest MSR while the disk was full, and ended up with corrupt files in persistent storage. I fortunately had a backup, so i'm up and running again.
One thing I'd like to have is a message if available disk space is under a certain level, any tips on how i can get MSR/openLuup to detect and alert me ? If there's a way to use the response from "df -h", mabye i could send a telegram msg from reactor?
-
You can get a piped response from any process you launch. I used to use df to check for mounted volumes.
See: https://www.lua.org/manual/5.1/manual.html#pdf-io.popen
-
@perh this is the code I'm using to check for space on my Vera. Feel free to change it
local function getDiskSpace(path) local function df() local format = "(%S+)%s+(%d+)%s+(%d+)%s+(%d+)[^/]+(/%S+)" local d = {} local p = io.popen "df" if p then local df = p:read "*a" p:close() local n = tonumber for f, b, u, a, m in df:gmatch(format) do d[#d + 1] = {file = f, blocks = n(b), used = n(u), available = n(a), mounted = m} end end return d end local dfinfo = {} for _, d in ipairs(df()) do dfinfo[d.mounted] = d end local x = dfinfo[path] return { total = x.available + x.used, available = x.available, percentage = (x.available /(x.available + x.used) * 100) } end local disk = getDiskSpace('/overlay') -- customize with what you want to monitor luup.log("Total: " .. tostring(disk.total)) luup.log("Available: " .. tostring(disk.available)) luup.log("Percentage: " .. tostring(disk.percentage)) if (disk.percentage < 30) then -- alert under 30% sendAlert("Overlay Partition at " .. tostring(round(d, 2)) .. "%") end
-
Nice, thanks.
What would be the fastest way to get that percentage value into a reactor that sends me a text?
I think i can wrap it into a plugin, mabye even hack it into the existing system monitor plugin?
If there's an even faster way to do it, chime in! -
@perh said in Another transition from Vera to OpenLuup - PerH:
I think i can wrap it into a plugin, mabye even hack it into the existing system monitor plugin?
I've already done it in my own fork. The license around this plug-in is obscure, so I didn't wanted to mess with it publicly.
-
Just updated Z-Way to 3.2.1 today.
I had to build a new docker image for this, and pull down the container and replace it with the new image. All was done in about 10 minutes, and works well.System-Down time was about 10 seconds..
Setting up the docker system was a little work, but it is really easy to maintain once its up.Here's the docker image, there is a docker compose example in the description.
There is some interesting updates in this version, MQTT client is one that may be interesting for openLuup users?
Several fixes to z-wave communications as well, so it may be even more responsive now. we'll see!