Taking care of your loved ones with Grafana and other open source solutions
Amon Reich is the founder of SmartLiving.Rocks based out of Schweinfurt, Germany, an IoT solutions provider for smart homes and small businesses. Amon maintains the open source SeniorenSmarthome project, which enables Ambient Assisted Living through Grafana dashboards and other open source technologies.
I’ve been working in the field of smart technology for over 10 years. My company has partnered on government-funded research projects, and I’ve also cooperated with the Fraunhofer Institute (a German research organization) on projects as well.
One of the projects I worked on with the government had to do with senior citizens and Ambient Assisted Living (AAL). They wanted to find out how seniors can remain in their own homes for a longer period of time before having to move into assisted living, and what effect telemedicine and smart home technology has on that.
A lot of the solutions we researched rarely or never made it to the end-customer. But when my professional life and personal life converged — I needed to find a way to keep an eye on my elderly father’s health and activity — I decided to solve the problem myself.
SeniorenSmarthome (Senioren means seniors) is smart home technology that can be used as a tool to support and monitor elderly loved ones so they can continue to live independently at home. To create it, all I needed to do was modify my father’s existing Smart Home device (which was mainly used for controlling the lights) and connect it to a Grafana dashboard.
If you have a beloved elderly person in your life, there’s a good chance you also often wonder about how they’re doing, what they’re doing, and if they’re generally as active as usual. Frequent concerns might be:
- Did they get up this morning?
- Have they made coffee?
- Are they home? Where are they?
- What are they doing? (Watching TV, listening to radio, cooking, gardening etc.)
The SeniorenSmarthome system keeps me informed about activity in my father’s house. Using sensors and Grafana, getting the answers to the above questions is easy, and the possibilities of trackable actions are nearly endless. For example, I can keep track of when a motion sensor detects movement; when the energy consumption goes up because the coffee machine is in use; when lights are switched on or off; if a media player is in use; or if the humidity rises in the bathroom, which means my father is showering.
That information — which lets me know he’s going about his usual day — not only gives me peace of mind, but it’s also a lot less costly than hiring an aide or moving my father out of his home. It’s also very simple to use.
Since I know so many people are caring for elderly relatives, I wanted to share some basic information about AAL in hopes that it can help other families, too. (Maybe you’d like to help with the open source project as well!)
From Sensor to Dashboard
For my AAL project, I use an Intel NUC (nuc7pjyh). I chose Proxmox as an operating system because I also run some other virtual machines, like an Ubuntu Server. (The good thing about using virtual machines with Proxmox is that if you screw up something by writing code or installing packages, you just restore the backup of a virtual machine.)
On this NUC, there is also a VM with the Home Assistant Operating System (a Linux based operating system optimized to host Home Assistant and its Add-ons). Their add-on store is a very easy-to-handle docker environment, which makes installing a docker container like InfluxDB and Grafana really simple.
You’re probably wondering about the sensor hardware I use. Well, it’s not that important because Home Assistant can handle the information of any motion sensor out there. It will create a sensor entity that can be used. However, the one thing you need to do is make sure the “time to next detection” is adjustable so you can ensure every motion — including re-entering a room in a very short time period — will be detected.
Getting the most out of Grafana
With Grafana, it’s super simple to create dashboards — even for non-programmers like me. You can literally play around with the different settings until the graph suits your needs. They are (in my opinion) very beautiful and meaningful at the same time.
Here’s what an AAL activity dashboard looks like:
Let me break down some of the highlights and features of what you can observe and how you can get the most out of the dashboard.
Interval and query options
The first feature that blew my mind was interval functionality. With a motion sensor, you only get binary data — 0 or 1 and a timestamp. In a graph, that information does not look very sexy, so you have to summarize the events by combining them into a time frame, e.g. 15 minutes. That will allow you to visualize each motion detected (1) in that specific time interval (15 min). For example, I can look at my father’s dashboard and see that there have been 30 movements in the Living Room from 10:00 until 10:15.
Detected motion in different areas of the home
Alternative grouping method: Group by time
In Grafana, you can also use the Group By function (pictured below) in order to get results for a specific time period. Personally, I find the Interval function more useful, because if you begin to copy graphs to display different time periods (such as a weekly and monthly overview), you only have to change the time interval once for the whole graph. If you use Group By, only one query is affected.
Stacking
Another feature I really like is that you can stack the bar graphs together. Using this method, the bars are added on top of each other so that you get a nice overview of the total movement in all rooms during a specific interval.
Time shift and query options
One of my favorite functions is Time Labs, which provides you with an overview about the past. When it comes to my father, I’m able to look at what his condition was during the week, and if, for example, a new sleeping pill had a visible effect on the pattern of his “normal” activity.
Of course, human interaction is still important — this isn’t about leaving everything up to AI. We still have regular phone or video calls and talk about everything, which helps me understand how he’s feeling, what he’s doing, and why there might be deviations from the norm.
Dashboard sharing
My father liked his dashboard so much that he asked me to present it to his doctor as a way to visualize his sleeping pattern. Grafana made it easy. I simply used the share button, copied the provided link, and forwarded it along. I really like this feature because it gives me a chance to work together with my father and his medical team and it benefits us all.
The power of open source
I have never seen a more powerful and stable home automation system than Home Assistant and IObroker, which both use open source software. Back in 2010, when I first heard about open source projects at a conference, I was confused by them. As a recent business school graduate I wondered, How do these people pay their bills? The person telling me about the concept explained that getting people to work together on a specific topic is the only way we can create solutions. It took me some time, but now I know that he was right.
My goal for the future is to provide solutions for the aging society, and I need the power of the collective in order to make that happen. I want to connect with other people who are caring for the elderly so we can tackle issues together. So I have some questions:
- If you’re a relative and/or caretaker, what information would you find helpful to monitor?
- When you look at your local community, what would you need in order to keep elderly people in their own homes longer, and at the same time offer them more service — including security?
- Are you a senior citizen who wants to keep living in your home and be looked over from afar? What is your biggest concern?
We can work together to improve the AAL dashboard, make the algorithms more efficient, and create a useful product everybody can use for free.
If you’d like to join my project, the best place to start contributing is here.