Tag Archives: nodejs

I have, for a number of years, tried a number of different home automation solutions but I’ve not been completely satisfied with any of them due to either lack of features, too difficult to oversee or too proprietary…For years I used SwitchKing and I’ve also tried Domoticz and looked into other options such as OpenHAB but I’ve been frustrated with either the UI, only running on Windows or too much and too complex.. So I decided to base my own Home Automation-setup on Node-Red instead as it very simple to use and extend if necessary and there is a vast amount of additional nodes one can use in your own setup.

However, Node-Red is, by default, a non-stateful event engine which means that if I was to implement my turning on/off lights rules it would have to include a large amount of message flows and I would have to be using complex custom coding to share information between the flows. E.g. I would like to implement the following rules:

Turn on the light switch if:

It is dark outside and the time of day < 23:00

It is dark outside and the TV is on (i.e. even if the time is above 23:00)

It is dark outside and there is movement in the house (e.g. someone wants to go to the bathroom during the night)

Otherwise turn it off

To implement all of the above is quite complex if just using the standard nodes in Node-Red as it does not keep the state – e.g. turn off only if there is no valid rule. So I decided to implement e number of nodes to ease the process of defining these rules and to take action (turn off/on).

Example of a few rules and filters

I’ve been running it now for a number of months and I am happy with the result. It is simple to add new datasources/sensors and to create new rules and flows if necessary.

I’m running it on a Raspberry Pi 2 with a rfxtrx433 transceiver but can also be used with a Tellstick (but I haven’t tested it though)