Home automation lists

Posted on | ~4mins

This is an ongoing list of some projects I have found useful in our hacky home automation projects.

Last updated October 2020.

Connect to HomeKit/Alexa

For connecting some custom hardware into HomeKit or Alexa for controlling along with our existing store bought hardware, I have found HomeBridge incredibly useful. In particular, since we use Alexa devices to control most of our home, combined with homebridge-alexa.

I have an IR blaster from broadlink, to control a fan in the bedroom, which someone published a homebridge plugin. I also found an existing plugin for controlling the volume of my marantz receiver as if it were a light bulb, which is neat, but rarely used.

npm install -g homebridge
#(install plugins)
npm install -g homebridge-alexa
npm install -g homebridge-broadlink-rm-pro
npm install -g homebridge-denon
npm install -g homebridge-marantz-volume


# Set config
cat > ~/.homebridge/config.json <<EOF
{
    "bridge": {
        "name": "Homebridge",
        "username": "$HOMEBR_UN",
        "port": $HOMEBR_PORT,
        "pin": "$HOMEBR_PIN"
    },
    "accessories": [
      {
        "accessory":      "marantz-volume",
        "name":           "Stereo Volume",
        "maxVolume":      70,
        "mapMaxVolumeTo100":true,
        "host":           "$RECEIVER_IP"
      }
    ],
    "platforms": [
        {
            "platform": "BroadlinkRM",
            "name": "Broadlink RM",
            "hideScanFrequencyButton": true,
            "hideLearnButton": true,
            "hideWelcomeMessage": true,
            "accessories": [
                {
                    "name": "Fan",
                    "type": "fan",
                    "data": {
                        "on": "$FAN_POWER_CODE",
                        "off": "$FAN_POWER_CODE",
                        "swingToggle": "$FAN_SWING_CODE",
                        "fanSpeed": "$FAN_SPEED_CODE"
                    }
                }
            ]
        },
        {
            "platform": "Alexa",
            "name": "Alexa",
            "username": "$ALEXA_UN",
            "password": "$ALEXA_PW",
            "pin": "$ALEXA_PIN"
        },
        {
          "platform": "DenonMarantzAVR",
          "name": "LivingRoom  Stereo",
          "host": "$RECEIVER_IP",
          "maxVolume": 70,
          "secondZone": false
        }
    ]
}
EOF

# Start the server
homebridge -I # -I (Insecure) needed for alexa plugin

One project that keeps popping up on hackaday is Home Assist. I have not researched this enough to recommend, but would suggest at least a cursory look into it before committing to something else.

Log sensor data / Control HW

MQTT seems to be the settled standard for sending around sensor data on the local network. There are some good projects already built around working with it that I found useful.

From an Arduino/ESP{32,8266} device there are ready built libraries tutorial

For MQTT you need a broker on your network, I used mosquitto as a mqtt broker.

For our use case we wanted a dashboard that would display the published data from my embedded devices, for this two projects fit the bill, first I quickly spun up node-red and build a quick dashboard, this was incredibly simple go get going, but was not as powerful as desired and configuring any retention or exporting the data was unclear. So despite recommending that for a quick start, we moved to a combination of grafana for the dashboard and influxdb for retention of my data. Note, influxdb doesn’t itself connect directly to mosquitto to log data, so I hacked a quick bridge from this example found from this writeup.

So far I have only been pushing data from HW to my mosquitto server, but you can subscribe to topic on the device as well for remotely controlling.

On the list of projects to look into in the future, it looks like homebridge sevreal mqtt plugins so any of this data should be able to connect to HomeKit/Alexa as well.

Hardware

For any hardware project my go to has been an ESP32 or ESP8266 w/ the Arduino IDE. The ESP32 and ESP8266 dev boards are really cheap for what they provide including WiFi connectivity. I have been using the Arduino IDE to program them, though I am not entirely satisfied with that environment, it does come with a lot of libraries (of sometimes questionable quality) for a lot of peripherals. For now would recommend that as a starting point to any HW project in need of connectivity.

Other

Currently all these services are configured on my Linux “box” (virtual machine now), and a bit precarious, would like to look into moving them onto a raspi or something smaller. Would also be great to look into deploying them in containers, docker or whatever the new hip thing is.

Was something in here useful? Anything I should be conisdering? Hit me up on twitter and let me know.