Fistbump and versionbump; Novus Component goodness

Note: This post was originally published in October 2015

I have to admit; it's been way too long since I worked on my component for home automation. The last update for version 0.x.x was last summer! That requires a substantial rewrite, and I finally found the time and the drive to do it.

Therefore I am proud to announce; version 2.0.x! I started completely from scratch, and it payed off. The new version is now available on npm for use by all you home automation enthusiasts!

But... what is it?

Novus, as I call it, is my 'home automation system'. Well, 'system'... currently it's little more than an MQTT broker connected to an Arduino microcontroller (covered with sensors), which in turn is connected to my computer, relaying sensor information over serial to an instance of the Component, and then over MQTT for display in the web browser.

But novus-component is now much more. Loosely modeled on some web server packages out there, my goal is to provide anyone who uses MQTT with a rich set of powerful tools on top of the regular MQTT protocol.

TL;DL; show me an example

As you wish!

import { Component } from 'novus-component';

const component = new Component('my-component-id', {  
    url: 'mqtt://...'

        route: 'sys/{$componentId}/+key',
        handler: function(packet) {
            // Store a setting in the component's internal store
            let key = packet.params.key;
            let value = packet.payload.toString();
            component.set(key, value);
        route: 'sensors/+sensor',
        handler: function(packet) {
            let sensor = packet.params.sensor;
            let value = packet.payload.toString();
            console.log('Sensor %s has value %d', sensor, value);

// Start the component
    .then(() => {
        console.log('Component started');
    .catch((err) => {
        console.error('Error while starting component:');

As you can see, it uses the concept of 'routes' - regular MQTT topic with some syntactic sugar added in for flavor.

I want more info

I understand! You can find everything you need on these pages:

If you try it out, let me know what you think, so I (or you) can improve the component.

comments powered by Disqus