Adding Home Automation to KDE

About

Home Automation is mostly, as the name implies, about automation.

The machine you're in front of all work-day has an awful lot of useful information that can be useful in your home management.

I have a script lower my blinds if I turn on the camera during the afternoon as otherwise there's an annoying glare. My office lights and monitor both have a redder hue at night, but disabling night-mode on my PC automatically disables the main light performing redshift too. I want my screen to turn off not 10 minutes after activity, which is simultaneously both annoyingly too long and too short, but the moment the motion sensor in my room says I've left.

Home Assistant, the best open source home automation tool out there supports all of this, but it needs some hooks for the PC to tell it about the current state and invoke actions on the PC.

None of the existing solutions worked well for what I wanted. I wrote something for personal use a few years ago that worked great for me, I ran it in the background and didn't plan to take it further.
During the KDE Goals sprint another user suggested creating something very similar (https://phabricator.kde.org/T17435). That goal may not have been chosen, but it did motivate me to tidy up and document what I had and turn it into a more fleshed out project.

The App

I made a small daemon, named Kiot (derived from "KDE Internet of Things") that exposes this information to your Home Automation software.

This is pre-alpha software, there's no GUI configuration it relies on manually setting up a configuration file to point to your Home Automation server. If there's enough traction I might make it more packagable, and create a UI config over the Christmas break.

There's a bunch of sensors and actions shipped, but it contains a faux plugin system to make extension easy along with hooks for user supplied scripts.

  • User activity
  • Locked state
  • Suspend/Power actions
  • Camera in use
  • Accent Colour
  • Arbitrary Scripts
  • Shortcuts
  • Nightmode Inhibition

Using this from Home Assistant is then as straightforward as possible.

Checking it out

The repository can be found at https://github.com/davidedmundson/kiot which has setup instructions along with developer documentation (https://github.com/davidedmundson/kiot/blob/master/DEVELOPMENT.md) if you want to make any additional plugins.

I measured KDE’s commit stats and the results surprised me!

Whilst commit numbers aren't a perfect measure of anything whatsoever, they do still provide a good indication of whether a project is healthy or faltering. It's useful to keep an eye on them, and the start of the year is a good time to do that.

I like graphs, everyone likes graphs, they need no further introduction.

Frameworks

Plasma

KWin

Conclusions

My main reason for sharing is before I gathered some data I had a negative feeling about the community health, but none of the data backs it up and it was unfounded, it's hard to get a sense of the state of how the year has gone when you're busy living in it.

There was a bit of a boon last year with KF6/ Plasma 6.0 and this year did see a drop relative to that, but it's merely returning to the former average rather than being anything to worry about. The most important graph is how many new authors and contributors we're getting on a year-by-year basis. The number of total and new contributors is relatively consistent.

Things being unchanged and boring doesn't make for a good post title (hence the Youtube-level embellishing) but is a good place for such a large project.

The 3rd graph included is a measure of how many make up the bulk of commits. If this is 1, it means a sole dev is running the project and that's an unhealthy place to be if they ever leave. If it's too high it means there isn't a core team maintaining it. There's no "right" number, but I feel it's a really interesting metric, especially seeing what happened in Kwin.

About the stats

Graphs were generated from the same scripts used by Curl's dashboard (https://curl.se/dashboard.html). It doesn't have all the stats Curl has as each needed some manual poking to make it more generic.

Frameworks and Plasma stats were made by locally git filterbranching all repos into a mega-repo and using that as a base.