In one of my earlier blog posts I reported that occasionally the HABpanel will disconnect from the server. Turns out it's not HABpanel, but it's the Pi itself which is causing the trouble. Part of the problem why it took me so long to investigate is that the display is in the kitchen, and someone had to have a look and spot the small red error message. To work around that problem, I hooked the device up in the network monitoring, and had an alarm triggered when the device is not reachable. Sure enough, that happens occasionally.
Because I moved /var/log to a small RAM disk to avoid wearing out the SDcard, all logs are lost once the device is rebooted. Had to bring keyboard and mouse to the kitchen in order to save the logfiles once the device was no longer reachable over the network.
Continue reading "Reboot the Raspberry Pi on network failures (brcmfmac: brcmf_cfg80211_scan: scan error -110)"
The new Raspberry display works nice, but the screen is too bright. At night in the kitchen it enlightens the entire room - unnecessarily. Since I'm using the original Raspberry Pi 7" touch display, the brightness can be controlled in /sys/class/backlight/rpi_backlight/brightness. This "file" can hold a value from 0 (display off) to 255 (full bright).
Continue reading "Dim the Raspberry Pi screen"
For a number of services, I need a system/service which can receive web hooks, and act when such a trigger is received.
Just a few examples:
- GitHub can send web hooks when something changes in a repo (in any repository you administer, go to "Settings" -> "Webhooks", and add your own hook)
- Tasker for Android can send HTTP(s) requests
- JIRA can send web hooks when certain events occur
- openHAB can send messages to other services
Now it would be useful to have your own receiver for web hooks, and run any task you want. There are a number of tools out there, which can solve this problem. I settled with "webhook". In addition, I deploy everything using Ansible, therefore I had to write a bit of code in order to automate this process.
Continue reading "webhook service with TLS and Let's Encrypt certificate"
You might know that problem: the brand new SSD in your system is super fast, but after a good time using it, the card is dead. Unlike spinning disks, which usually fail over time, and show I/O errors by blocks, SSD cards are prone to a problem called "Wear leveling". Blocks which are written more often will "wear out", and become unresponsible. More writes increase this risk. And a typical openHAB system does a number of writes all the time: every time an external status changes, it's written to the event log. By default the syslog is written to disk as well, and then there is a myriad of systemd services, writing status information into files.
Continue reading "Avoid "wear out" of SSD-cards in an openHAB system"
Everybody likes systemd, right? Well, not everybody. Who thought it might be a good idea to replace existing init systems with something which is big, monolithic, and not even feature complete?
A simple task: execute a script when an interface comes up, or goes down.
In the old days, on Debian or Ubuntu, one just added pre-up and post-down scripts in /etc/network/interfaces. But now, that file is gone, or empty. Ubuntu comes with netplan, which nobody else seems to use - luckily. NetworkManager is not used all the time, so one can't depend on that either. And systemd does not have an option to do something simple like taking care of interfaces coming up and down. You can write yourself a target, but that only fires for the first time, not every time.
In the end, you have to listen to D-Bus messages. And suddenly the simple task of running a simple script turns into developing a full-featured daemon with D-Bus capabilities.
Someone else already took the stab, and developed networkd-dispatcher.
Continue reading "if-up and if-down scripts with systemd"
The openHAB Raspberry image, by default, listens on port 8080. After using the image for a while, it became quite boring to always add the port to the URL. Quickly I decided to redirect port 80 to port 8080, and make my life easier.
Not sure how much work that is in the openHAB settings, I settled with redirecting or forwarding the port 80 to port 8080.
Continue reading "openHAB: redirect port 8080 to port 80"