Archives

All posts for the month July, 2020

ABSTRACT

Just soon after moving into our new home in Northbridge MA, I have begin rolling out home automation technologies that are designed from scratch and uniquely custom.   Doing it this way, I’ve more control over the quality and versatility of my deployment and design.  The trade-off is a higher learning curve to achieve this supreme result – but I LOVE learning!  In our old home, many of my automation made use of VMs running various applications to perform tasks and provide actionable data.  In my new design, I want to achieve the following goals:

  • lowest power footprint as possible – do more with less.
  • learn and utilize docker container technology to replace fatter VMs with slimmer deployment of applications on power efficient computing (such as the Intel Celeron J4115)
  • maintain the highest levels of system security by using a local PubSub broker so message payloads never leave the firewall
  • utilize my investment in Ubiquiti Unifi wireless APs (5 of them throughout the house) over a dedicated SSID for home automation
  • be easy to manage
  • wife accepted!   (WAF Score)     Note: for those who don’t know, WAF score is a value I assign to project that achieve high acceptance rating from my wife  (Wife Acceptance Factor)

THE SOLUTION

First thing I did is research and select a hardware platform to run my containers.  The following applications will be containerized in this new design:

  • Domoticz – the home automation hub software I use – essentially the cornerstone of the entire system
  • Pi-Hole – DNS ad blocking and management application (also part of our DNS jail)
  • MySQL – Yeah, I need a database for some of these apps
  • PHP MyAdmin – a nice MySQL web based database workbench
  • WordPress – for hosting local information that guests will land on when they visit and join the guest wifi
  • Cacti – a robust SNMP NMS system for monitoring application/system performance over time
  • habridge – a java based Phillips Hue emulator that allows us to connect Alexa (Amazon Echo) to selected controlled endpoints on the Domoticz dashboard
  • A minimal ubuntu container for launching various scripts

In the past, I had run these on VMs and while it worked well, it isn’t as efficient as a containerized deployment.   The hardware I used for the Intel box was this.   It is a Celeron J4115 with 8GB Ram and a decent sized M2 SSD.  I use an NFS mount to store container configs and logs on the Synology NAS for safe keeping.

When I built the weather tube, I re-used a marquee scroller project I had done previously and wrote a couple scripts to push data to it and display weather stats in the kitchen in real time.  I first use a Darksky API account to get the data for my town onto my Domoticz container.  Domoticz periodically polls my Darksky account every 5 minutes or so and displays the weather info through widgets on the Domoticz dashboard.   This is great and all, but if you’re not looking at the dash you won’t have the latest info.  Luckily, Domoticz has a rich json API and it’s easy to get data out of Domoticz for various uses.   Every “device” or sensor object in Domoticz has an IDX address which is easy to use via the json API to poll data from Domoticz.   The advantage here is that I only have to poll Darksky once from Domoticz, but I can poll Domoticz as many times, and from as many local devices as I want, which helps me stay within the free limits on my Darksky account.  The json feed for devices looks something like this (click for larger view):

So how do I leverage this bounty of information and display it on my LED Scrolling Marquee tube?  A little smear of Bash and Python scripting to the rescue!  I first create a python script (fetchwx.py) that will pull the data elements that I want.  This script will then build a string output to scroll to the tube at it’s IP address on the network.   The string is cached to a file wx/conditions  and the contents of this file is then pushed to the tube every 15 minutes by another script that is called by chron. (wxpush.sh)  A snapshot of these scripts appear below for your reference.  Click on any of them for a larger view:

 

This is a quick and dirty way to push this data to the tube, but I am currently working on an MQTT version that will subscribe to a topic and pickup the data feed via a published topic.  I’ll update this article once that’s ready for prime time so check back often.

Here’s a video of the tube in action in the kitchen: