Updating Kodi Repository with Ansible

I’m not an Ansible guru but I do use it to automate some tasks in my home lab. It is a real time saver to issue commands from a single interface and not rely on a bunch of hacked together Bash scripts all over the place. Recently I was doing some updates to a custom Kodi repository that I use for testing addons in development. The process was pretty cumbersome and after a while I decided it was time to convert the whole process to an Ansible Playbook.

Below I’ll go through the process of modifying a few scripts and setting up the Ansible playbook. This process can be used as a template for other system automations where a legacy script is being adapted for Ansible.

5 min read

Automate Brewing With Tilt

As I hobby I like to homebrew beer. Nothing too crazy but just a few cases a couple of times a year. It’s fun to do and makes for a nice gift option for friends and family as well. Recently I starting thinking more about gathering data during the brewing process. Mostly I was interested in temperature as different stages of the brew process require specific temperature ranges. These vary depending on the type of beer but it’s important so you don’t kill the yeast during fermentation. In the past I’ve used a manual thermometer but wanted something more hands off.

I didn’t want to build something myself as there is a great consumer market and DIY space for this type of stuff already. My only real requirement was that I get the information into Home Assistant since that is where I try and keep all my dashboards and data for ease of use. As I spiraled down the rabbit hole of possible options I ended up having to do some on-the-fly thinking to get it all working.

9 min read

Parsing Nagios Performance Data

Recently I was adding features to Trash Panda, a local monitoring system project I probably never should have started. I thought it might be interesting to do something with the performance data many Nagios plugins send back as part of service check results. Performance data is additional data about the service that can be useful as history for how the service is performing. Stuff like disk space metrics, TCP return times, and other types of numeric values. The format is standardized and could then be easily piped into a database or other storage area for later use. This post documents my efforts from loops within loops to something bordering on efficient.

I do want to note I did try and find a tool for this before building something from scratch. There are some command line tools but nothing in a library format. Since the Trash Panda project is written in Python that’s really what I needed.

7 min read

Dynamic Pandas Data Slicing

Recently I wanted to modify a Python data analysis script I use regularly at work into more of a general purpose tool. The script uses the Pandas Python library to slice up data in CSV files based on some specific time periods. The issue I had is that these time periods changed often, and I was sick of mucking about in the script to constantly tweak them. I needed a way to specify the time periods at runtime instead of hard coding them.

This turned out to be more complicated than I envisioned so I figured I’d document it all for anyone interested (most likely myself in a year when I forget). Note: this post is not a primer on Pandas, or data slicing, if you want more info on that check the Pandas documentation.

8 min read

Automatic Cat Feeder

We recently got a second cat. It’s been a lot of fun but one thing I didn’t realize is how much more two cats were going to eat. With one cat a bowl of food lasted 2-3 days before needing refilling, with two it seems to be running low every day. To make matters worse we keep our cat food bowl in the laundry room so the food doesn’t get stolen by the dog. The phrase “out of sight, out of mind” definitely applies here and I’ll be honest they’ve run out of food enough times that something had to change.

I had two options. The first was the easy option - just get a bigger bowl. The second was the fun option - buy or build an automatic cat feeder. Obviously I went with the fun option.

13 min read

QR Code Media Player

We were recently trying to organize some of the clutter in our home and I started in on the video game and Blue Ray/DVD collection. For Blue Ray/DVDs (henceforth referred to as just DVDs) we’re in the same boat as a lot of households, we just don’t use them. Streaming is a good amount of our media consumption but I take movies we’ve purchased and rip them to our NAS so we can play them back via Kodi. Since the entire collection is digitized what often happens is we look at the DVD rack, select a movie we want, and then find it via Kodi and play it there.

Inspired by many Home Assistant related NFC “jukebox” type projects I thought it would be fun to combine the physical with the digital. I wanted to use the physical disc to trigger the playback of the digital file. Since Kodi has a JSON-RPC API being able to trigger playback based on a tag or code seemed doable.

QR Code

9 min read

Monitoring SNMP Traps

In my profession life I recently purchased an Infrasensing Base Unit along with a door contact sensor. These are pretty interesting IoT devices that accept a wide variety of sensors. My intention was to connect this to our network monitoring system, Icinga, to monitor the status of a network cabinet door.

Upon playing around with the device I decided the best way to get timely alerts from the sensor was to utilize SNMP traps instead of polling for the status. While I have a lot of experience polling SNMP systems I’d never dug into traps before. Going down the rabbit hole of getting this going turned in to a pretty neat little project that can be utilized to translate SNMP trap payloads into something Icinga can accept for service checks.

sensor page

8 min read

Home Assistant Voice Custom Intents

In 2023 Home Assistant is dedicated to making their smart home platform more capable of text and voice interaction through the Year of the Voice. Essentially this is expanding on the capabilities of Home Assistant to interpret human text and speech into smart home actions. This provides more possibilities for existing voice assistants like Alexa and Google Home; while also providing an alternative through Home Assistant’s own Assist platform.

While a number of built-in intent phrases have been added, I’ve been experimenting with adding my own trigger phrases and intents. For the most part this was just following the documentation however there were a few things that weren’t clear, or just didn’t work as expected. I’m documenting these here for future reference, and for anyone else struggling through the same thing. Hopefully as this part of Home Assistant matures adding these custom actions will become more clear.

Assist Chat

9 min read

Portable Face Finder

As a side project I’ve been working on a portable Python program to find if specific people, using facial recognition, are in a collection of images. The idea for this grew out of a joke but the more I thought about it I realized it had some real applications.

A co-worker of mine was having trouble finding images of specific individuals within a large folder of images. Over the years this folder had gotten overgrown and photos were in random sub-folders sorted by date, location, or event. It was hard to find photos of specific people without digging through a lot of images to see if they were in them. I jokingly suggested we use some facial recognition software to comb through the folder and just flag all instances of the person they were looking for. I held on to the idea over the next few days thinking about how something like this would function.

The idea itself is pretty boilerplate stuff for any image tool, like Google Photos or on Facebook. These will recognize the faces and do all the heavy lifting for you. My real interest lay in situations where having an offline solution to this problem would be useful. Family pictures on a parent’s computer or in this case employee photos not part of a unified imaging solution. I imagined there was some utility being able to throw in a USB drive, launch a script, and identify photos of interest based on looking for specific faces.

deepface image detector example

8 min read

Crowd Sourced Quote Generator

I have an LED Sign in my office that displays information like the weather, currently playing music, and other stuff. One day I added a random movie quote to the rotating text just for fun. A few days later I swapped it out for another one. As you can imagine, an idea hit. What if I could randomly add a new quote every few days? There must be a web service to pull quotes from, right?

Hence began my search for an existing service to pull movie and TV show quotes from. I found a few options, but I came up short of what I wanted. Many sites cataloged movies, but not quotes. Others had quotes but no method to pull them programmatically. The IMDB in particular looked the best but their “quotes” were often several lines of dialog from the film. Plus I just didn’t want to mess around with integrating with them since it’s a proprietary site.

At this point I figured I could either a) drop this idea or b) try and build something. Something as simple as text file with a bunch of favorite quotes in it would have worked but I didn’t want to have to generate all the content myself. I thought it might be fun to build something my friends and family could add quotes to as well. It would have the added bonus of making the quotes more diverse than just things I thought up.

Landing Page

10 min read