Skip to content

openHAB: Turn display on and off for a Video ChromeCast

After figuring out if a ChromeCast is currently used, it was time to fix a long-standing problem. At home we don't have TVs, just "dumb" displays, and stream content using ChromeCasts. However a video ChromeCast never really turns off, but keeps the display running, using a "Backdrop" app. This app keeps showing pictures on the display when the ChromeCast is not used otherwise, effectively preventing any powersafe mode.

That's both annoying (who wants to have pictures shown in the living room or working room all night), and consumes energy. It's also intentional by Google. So far we had to turn the display on and off manually, which is inconvenient.

 

Continue reading "openHAB: Turn display on and off for a Video ChromeCast"

openHAB: detect if a ChromeCast is currently used or idle

We have a couple of Audio and Video ChromeCasts in use. For an upcoming project I need to figure out if any of them is currently used. That is different for the Audio and the Video devices: the Audio just goes idle=ON, the Video devices however load the "Backdrop" app and show pictures when idling. Google for whatever reason does not want the attached monitor to go in powersafe mode. So much for saving energy ...

All of the action needs between a few milliseconds and 2-3 seconds once you start/stop using the ChromeCast.

A previous blog post explains how I add the ChromeCast devices. And I have monitoring in place.

 

Continue reading "openHAB: detect if a ChromeCast is currently used or idle"

Deutscher Wetterdienst notifications in openHAB and Telegram

The "Deutscher Wetterdienst" DWD (German Weather Service) provices a service which sends out alarms for upcoming events, like heavy rain, storm, blizzard, strong winds ect. This service is only available for Germany. And it has a binding for openHAB. Time to integrate this, activate a number of regions I'm interested in, and send notifications to our mobile phones.

At this point I'm really happy that I deploy my openHAB with Ansible, I can use the Template module and loop over the Items, Things and Rules.

The Binding can "track" multiple regions, so called Cell IDs. I'm interested in 4 different Cells (the list is available here), your mileage might vary. For each reagion there can be multiple messages - and although every single example I found only assumes there is only one message (warningCount=1), I already had a situation where a Cell had two warnings. That information likely goes missing if you set warningCount to 1. Given how much configuration overhead it is when you add more channels, I can understand why most examples stay at "1" for warningCount. Doubling the number doubles the number of Items (12 -> 24). However since I deploy everything in a template, that's not a problem here.

I started this with a generous warningCount=5 - and in my templates I just loop from 1 to 5, and over every Cell, and generate all the necessary Things and Rules for every channel.

Ok, the details:

 

Continue reading "Deutscher Wetterdienst notifications in openHAB and Telegram"

openHAB and Tankerkönig gas prices + Telegram integration

In Germany, every gas station must report gas prices online, to the "Markttransparenzstelle für Kraftstoffe". Businesses and users can then fetch this data and provide services. One of these companies is Tankerkönig, and there's also a Binding for openHAB.

If you are interested in gas prices for certain gas stations, you need to sign up for a (free) API key, and figure out the IDs of the gas stations. For that go to this website, Position the blue marker on the location you are interested in, and then click on all the gas stations you want to include. Finally click on "Tankstellen übernehmen" - this will open a JSON with the data, from there extract the "id" (and possibly the other data as well).

 

Continue reading "openHAB and Tankerkönig gas prices + Telegram integration"

Monitor additional details in Telegraf with the "Exec" input filter

After installing Telegraf and hooking up everything into InfluxDB, I was missing the status of my backups. Every system here creates encrypted backups every night, and stores them on a central NAS, and off-site. But I want to know statistics about the backups, and see if something is not working.

I'm using Restic for the backups (will blog about this another time). However Telegraf does not support Restic directly, I need a few workarounds. This blog post however is not directly about monitoring the backups, but about how to write your own plugin for Telegraf.

 

Continue reading "Monitor additional details in Telegraf with the "Exec" input filter"

Install Telegraf using Ansible

I have an InfluxDB up and running in my network, and decided to monitor all (well, all possible - the QNAP seems to be a problem) devices. That's quite easy to do by installing Telegraf as a server agent, and add some configuration. Everything is deployed using Ansible, so I can re-use the same Playbook for many devices.

 

Continue reading "Install Telegraf using Ansible"

Add InfluxDB settings in Telegraf using Ansible: [WARNING]: The value [...] (type list) in a string field was converted to "[...]" (type string)

I'm in the process of updating my entire home setup, and integrate everything properly. Part of this process is to automate everything, and use Ansible Playbooks to deploy devices and configurations.

Today: install Telegraf and send data to InfluxDB

Along the way something broke, and Ansible doesn't really like me anymore. But let's start at the beginning.

In the Telegraf configuration in "/etc/telegraf/telegraf.conf" one can specify output plugins. One of them (probably the most used one) is "InfluxDB". The InfluxDB instance(s) are specified as a [...] list. In Ansible I somehow need to have this list as a string, and write it into the configuration file. This happens:

TASK [Update telegraf.conf InfluxDB settings] ***************************************************
changed: [localhost] => (item={'section': '[outputs.influxdb]', 'option': 'urls', 'value': ['http://192.168.xxx.xxx:8086'], 'state': 'present'})
[WARNING]: The value ['http://192.168.xxx.xxx:8086'] (type list) in a string field was converted to "['http://192.168.xxx.xxx:8086']" (type string). If this does not look like what you expect, quote the entire value to ensure it does not change.

Looks nasty ...

 

Continue reading "Add InfluxDB settings in Telegraf using Ansible: [WARNING]: The value [...] (type list) in a string field was converted to "[...]" (type string)"

openHAB and Telegram Bot

openHAB 2 comes with a Telegram binding which allows to run a Telgram Bot. This bot can both send messages to users and groups, and can receive commands and respond to them. That's useful: your home automation system can send all kind of details to your mobile phone.

For this to make it work it needs a couple things:

First of all a mobile phone with the Telegram app on it. You can either have the bot message you directly, but this only works for one person. Or you create a group, and have the bot send the messages to the group instead. Find out about the group ID here.

Then you need to create a Telegram Bot. Instructions are available here.

And everything needs to be hooked up in openHAB.

 

Continue reading "openHAB and Telegram Bot"

Move InfluxDB data directory to a SDcard

For my openHAB system I installed InfluxDB (on a separate) Raspberry Pi. The Pi has a 32 GB SDcard, but that is not enough for storing all the data, and that Pi has additional work to do as well. For that reason I also attached a 1 TB disk to the Pi, and mounted it on /data. Now all I have to do is move the InfluxDB data directory to /data.

 

Continue reading "Move InfluxDB data directory to a SDcard"

Monitor ChromeCast status in openHAB

I really like to monitor things, to catch issues early on. In our home we have a couple ChromeCasts, both Audio and Video. They are all connected to the openHAB system, Once in a while they stop working, and need to be restarted (unplugged and plugged in again). Unfortunately you usually only find that out when you want to stream something, and wonder why either the ChromeCast does not show up in the device list, or does show up but does not accept the media.

Therefore I decided to monitor the devices in openHAB.

 

Continue reading "Monitor ChromeCast status in openHAB"

openHAB and HP printer

Recent openHAB versions come with a new HP Printer Binding, which is a big improvement over the more general IPP Binding for printers.

The new binding reads the data from two files which are provided by the printer:

  • http://<printer>/DevMgmt/ProductUsageDyn.xml
  • http://<printer>/DevMgmt/ProductStatusDyn.xml

Let's install that ...

 

Continue reading "openHAB and HP printer"

raspi-config automated

While I installed the Raspberry Pi with the Raspbee board on it, I had to modify the settings for the serial device. That's done using the raspi-config tool on Raspbian.

However since I'm into automation, I don't want to start "raspi-config" manually, but had to figure out how to do that in an automated way.

 

 

Continue reading "raspi-config automated"

New OpenWeatherMap channels missing after openHAB upgrade from 2.4 to 2.5

A while ago I upgraded openHAB from version 2.4 to 2.5. That comes with the usual share of problems, but eventually I got it working.

For an unrelated project I wanted to use the OpenWeatherMap setup I have to improve the daily weather forecast with icons.

The binding provices ids for the current weather condition and the current weather icon. That can be used to load the icon from the OWM website. Went to my setup and added two new Items:

String	homeCurrentConditionID	"Current condition ID [%s]"	{ channel="openweathermap:weather-and-forecast:home:current#condition-id" }
String	homeCurrentIconID	"Current icon ID [%s]"		{ channel="openweathermap:weather-and-forecast:home:current#icon-id" }

Used Ansible to deploy everything to the Raspberry running openHAB. And then wondered because only the "homeCurrentConditionID" item came online, not the "homeCurrentIconID". After searching around and browsing the community forum, it turns out that the "icon-id" channel is new in 2.5, and will not automatically installed if the OpenWeatherMap binding was already used in 2.4. WT* ...

One has to remove all the OWM things ("openweathermap:weather-api:home" and "openweathermap:weather-and-forecast:home") and reinstall everything, in order to get the new channels working. That is really unexpected, and not user friendly.

After mumbling a while over my options I went ahead, created a new backup, and then removed the two items. One did get stuck along the way, a long Java trace appeared in the logfile, and I had to force remove it. Then - for good measueres - I also uninstalled the binding, and restarted openHAB.

Afterwards I re-deployed my Ansible Playbook, which installs the binding, takes care of the binding configuration, and adds the Things again. After everything came online, the homeCurrentIconID Item is also populated. Why is everything in openHAB so complicated?

Install a Raspbee II on a Raspberry Pi

A while ago I got a recommendation to look into a Raspbee (from dresden elektronik) as Zigbee gateway. That looked like fun, therefore I ordered one of the devices. The first step is the installation of the Pi itself and then the software for the Raspbee. 

For various reasons I decided to use a dedicated Pi for this, and don't install this on the openHAB Pi already running here:

  • The Raspbee needs software from a closed repository
  • During installation and configuration I don't have to reboot my openHAB system all the time
  • The headless install runs a webserver, this conflicts with the redirect I have on port 80 on the openHAB system
  • I still have a couple Raspberry Pi B+ here, which I don't need for other projects

 

Continue reading "Install a Raspbee II on a Raspberry Pi"

Raspberry Pi watchdog for openHAB

The openHAB display in the kitchen is still the problem child. Occasionally it just stops, other times it does not refresh the HABpanel, even though it has a connection to the openHAB server. Then there is the problem with the network card in the Pi. And - ok, that's a server-side problem - occasionally the weather stops updating. All in all that's a lot of trouble for a display which is just supposed to run standalone.

In the latest iteration I looked into activating the integrated hardware watchdog in the Raspberry Pi. Checking the temperature it never goes above ~55°C celcius, even though the display is in an almost closed frame and can't exchange much heat with the environment. But nevertheless occasionally the Pi just halts, and stops operating.

 

Continue reading "Raspberry Pi watchdog for openHAB"