A new age for Smart Homes?

A trend that seems to have taken a while to take off, but is now becoming more popular with the rapid expansion of Raspberry Pi based gadgets, is that of Smart Homes through home automation. The rising cost of electricity is likely to get more people thinking about optimising the use of lights and other devices around the house too.

More and more standard home appliances, including televisions, fridges, audio systems, door bells, right down to light bulbs (and those multi-coloured LED light strips in particular!) are becoming available for integration with home assistants like Amazon’s Alexa, and Google Home, or a plethora of custom apps where you can’t remember which one you need, let alone remember the log-in details.

But there’s something unnerving about the fact that to turn on my LED lights in the kitchen, probably some server in another country has to be told that this is something I really want to do, and since it already knows everything about me, will hopefully decide to grant my wish.

Smart Home Automation

Hence, the ready availability of all sorts of sensors, actuators and user input/output devices for the Raspberry Pi and similar range of computers, often with easy to use Python programming support, is driving a rapid expansion of hobbyists looking to make their own smart home gadgets instead of being locked into a particular brand and their cloud systems, privacy consent or indeed subscription models. And this has encouraged the open source community to create some excellent smart home servers that don’t require external cloud systems, giving you full local control. But they can still easily integrate with cloud services from Google, Amazon and Apple, whilst supporting a great number of Smart Home devices. Examples include OpenHAB and Home Assistant. And these 2 run on pretty much anything, from Windows, Linux and MacOS to NAS servers, Raspberry Pi’s or indeed an old PC you’ve probably got lying around somewhere!

For a simple setup you would need:

  1. A device with your sensor(s) and/or actuators
  2. An MQTT Broker that manages topic subscriptions and published messages between devices
  3. A (Smart Home) service like OpenHAB through which you can monitor the system, and create rules to take actions on events

For 1), you may already have a set of topics through which your sensors and/or actuators send (publish) and receive (subscribe) data. By adding the Red Reactor to your Pi you will simply create an extra set of topics carrying battery information and commands.

For 2), we have tested with the Eclipse Mosquitto MQTT Broker, a free and simple to install tool that can also be run on a wide range of different platforms.

RR_MQTT : The Red Reactor MQTT Client

We are just starting to get to know these tools, and we will continue to look for way to simplify the integration of our Red Reactor into your Smart Home projects. But we’re very excited to have made our first release of RR_MQTT, a client that can simply be installed to start running automatically at boot time, continuously monitors your battery and takes care of the connection to the MQTT broker, setting up 3 topics through which you can communicate with the Red Reactor.

The RR_MQTT client functions include:

  • A background application that continuously monitors the battery status for safe shutdown
  • The config.yaml file can be used to set / override device specific configurations
    • Here you would specify the MQTT Broker IP address amongst other things
  • Connects to an MQTT Broker for Service Status, Data and Command Topics
  • Published data includes:
    • Voltage, Current, Battery Charge, External Power status, CPU Temp, CPU Status
  • The Command channel enables control and parameter modification for:
    • Immediate shutdown, Immediate Reboot, Battery Warning level, Target Shutdown voltage
  • Easily scheduled to automatically start at boot

Note that even if the broker connection is lost, the RR_MQTT application will continue to check the battery status to ensure a safe shutdown is executed when necessary. When the connection is re-established, publication of data will resume.

If the SHUTDOWN or REBOOT state is triggered, the application will set the Service topic to OFF (offline) first, then execute the OS shutdown/reboot system command. On shutdown completion the Red Reactor will automatically turn off its voltage regulator for ultra-low power stand-by.

The service status topic provides a text string to show whether the device is ON (online), OFF (offline), or there is an Error.

All the published data is combined into a simple JSON string structure, and will need unpacking in the Smart Home server. We will continue to look at providing more Add-on functions to extend the Smart Home server integration, and we’d love to hear from you if there any particular elements you’d like to be able to use.

For more information on our RR_MQTT Client, and to install the code, head over to our GitHub site!

With the addition of the Red Reactor to your Smart Home gadgets, you now have the ability to make your gadgets go portable, and ensure that they don’t die in the event of a power cut.

We’re are convinced that your fantastic gadgets are the new age of the Smart Home!

Don’t forget we are live on Kickstarter, see our page here, and please check out our campaign updates and press articles too!

3 thoughts on “MQTT Client for Home Automation

  1. Pascal says:

    Please take a look at https://github.com/Scally-H/RedReactor/issues/10 for links to a fully configured HomeAssistant Add-on for the Red Reactor! Thanks to mreditor97 !

Leave a Reply

Your email address will not be published. Required fields are marked *

4 − 2 =