Some updates.
I’ve finally stabilized my system, and it pretty much runs itself now with little to no interaction required from me.
The first stability/reliability issue I had was that the nature of my house’s currently rather bad wifi (that just stops working randomly, especially on the extenders’ sides. This would cause my Xiaomi Gateways to lose connection, and subsequently all of the sensors connected to them also loses connection. Because most of my sensors are linked to the Gateways, this severely affects the reliability of my system.
Router Wifi Issue
The worst issue with this was often my router (Which is small, and old), that can’t assign static leases to devices, reassigns new IP addresses to the Gateways. This, of course, creates issues because the Gateways binding on OpenHAB uses the IP specifically to connect.
The same happens to my wifi Xiaomi light bulbs, but the Mi Io binding apparently auto-corrects their IP addresses by itself, so no fixes were needed there.
Solution
As for the gateways, I needed a way to fix the IPs automatically. And I found a way!
Its a rather crude rule that runs every 10 minutes.
The rule uses the “ExecuteCommand” command to run a arp on network after a broadcast. Then, in that output I search for the mac addresses of each of my gateways, and then use the nifty REST API of OpenHAB to update the IP’s based on their mac addresses.
This process is surprisingly effective. I’ve not yet even noticed a disconnect issue, because even if the ip’s are reassigned, it fixes it within 10 minutes. If I see this happening I can just increase the frequency.
This, in addition to the new Pi I bought, has pretty much guarenteed me almost 100% uptime for all my systems. Which is great.
OpenHAB Notification Issue
Another issue that I had is with a somewhat recent update of Android, the OpenHAB app notifications seem to have become delayed. Instead of getting instant notifications on my gate or garage opening, or doors being open, the notifications are held until I unlock my phone.
This made the functionality pointless, as I didn’t have real time notifications on any entrances being accessed.
After many hours of searching, I couldn’t find a solution to fixing the OpenHAB notifications.
So, I went a different route.
Fixing Notifications
I switched to using Telegram. If you didn’t know, Telegram is basically a Whatsapp clone app with the added benefit of allowing you to write bots that can interact with you or other users on Telegram, which is the key functionality I needed.
Using the Telegram Action binding for OpenHAB, I was able to create a bot that can send me message notifications, with immediate result.
This works great, I created a group with everyone in my household, as well as the bot, so that I can ‘broadcast’ messages to everyone or just have the bot direct message me if there is technical notifications.
Other stuff I did
- I started reading off the illumination lux values from my Xiaomi smart motion sensors, and using it to determine whether I should turn on certain lights. Although they only update the lux when they detect movement, it still allows me to turn on lights when its darker outside in the day.
So instead of having to worry about detecting a specific weather element, I simply check on motion whether the illumination is low (in the event of a thunderstorm for example), and then turn on the lights until such a time as the illumination is higher again.
It works pretty good in most cases. - I fixed my garage door’s open sensor triggering twice all the time, by turning the magnet sensor upside down, lol
- I now have the mySQL binding that writes all of my sensor data to a database, and also displays in my weather to show the temp graphs for the last 24 hours. I actually put the backup on a USB drive attached to the Pi, to prevent reducing my SD cards lifetime too quickly.
Previously I just used mapdb to save the states, but now I do both, for saving the states and to save all my data for historic reference purposes. - I’ve started playing around with sensors and stuff connected to an Arduino, in preparation of my weather station project that I’ll start soon. I have a temp sensor just running off a breadboard, that gives me the room temp, and sends it via the REST API to my openHAB system. Works great.
Planned Stuff
- Update my gate-open notifications to display a camera photo of the gate in the notification (because telegram allows sending images, yay!). Having issues reading the Motion stream from my pi in a single image in openHAB rules though, so still no dice.
- I am planning on building a Pi-zero-powered Weather station, with wind direction, speed, temp, humidity, rainfall detection and rainfall gauge. I will report all of this information to my OpenHAB. I might also make a online single page readout of this information for my community to get the most accurate readings close to their homes.
- I want to mount a lcd screen on my wall in the hallway, and use it to display a custom HUD I’m writing in html/javascript/css to display various sensors’ information from openHAB (again using the useful REST API to draw data directly from openHAB).
- Future future plans include: A sensor to detect mail in our mailbox, a camera mounted in cement or maybe high up at our gate to read number plates of cars that stop there and notify me who stopped in front of my gate, and more!
Anyway that’s it for now. I’m kind having some financial woes right now (had to fix our roof for a hefty price), so I can’t do all the stuff I want to right now, but hopefully later in the year I can buy some more sensors and cool stuff and get back to it.