Anyone here doing home automation?

I am not sure what MVC is but Node-red is designed for controlling with events and devices etc. It’s nearly all drag and drop. As an example, this is my Amazon Echo tab within Node-red that handles the incoming commands from voice control. The green nodes on the right are Wemo lamps and the purple ones are my custom WiFi based modules. This can also accept HTTP requests in the same format from any device. I have an app on my Pebble watch that sends HTTP requests so I can control the lights etc from that too. All using the same HTTP input.

By the way, Node-red has a Modbus module and Azure so you could set this up to read and control that device from Azure with very little in the way of programming or writing scripts. There is a tutorial on YourTube about this from a guy monitoring an oil well site. I was impressed by how easy it was and without much work software wise to get it going.

3 Likes

Dave i’m curious how you split the mqtt topic into the switches. Do you use the standard node-red switch default or create a custom function to break up the topic and payload?

GitHub - node-red/node-red-dashboard: A dashboard UI for Node-RED node-red dashboard i’m using…pretty simple stuff!

@ Terrence - MVS is alot more work than using node-red…i know MVC very well and node-red just works in minutes compared to trying to setup a MVC website.

@ Dave McLaughlin - @ anthonys

Dave and Anthony thanks for the info on NodeRed, I just might have to get up to speed on this tech.

I’ve redone a lot of the one I posted and removed the ON and OFF function and do it in the preceding one instead with 2 outputs. I could output via 1 output but I like 2 as this allows me to delay on or off etc

This is the code in the function for the Wemo devices and it has 2 outputs


var state = msg.payload.value;
if(state == "1")
{
    msg.payload = "on";
    return [msg, null];
}
msg.payload = "off";
return [null, msg];

And for the MQTT device this it the code (it also now has 2 outputs)


var state = msg.payload.value;
if(state == "1")
{
    msg.payload = "{out16:1}";
    return [msg, null];
}
msg.payload = "{out16:0}";
return [null, msg];

The payload depends on the device. My WiFi nodes are based on code from Peter Scargill so uses his control messages.

@ Dave McLaughlin - the button is supposed to last 1000 activations. so if 5 presses a day that’s about 200 days. Not suitable as a door bell if you want it to last more than an year. Also the battery is welded into the unit, and is not easily replaced. I purchased a few of them a while back, but only now do I have something very useful to do with it.

People are working on hacking the button via the programming header on it, but I haven’s seen anyone do it as yet. It does not broadcast any http request that I can easily intercept (not without wireshark and other hardware). All it broadcasts is a DHCP request that I intercept and use to active the button.

I will put another plug in for Node-Red. I am finding many uses for Node-Red when customers need customized dashboards and other odds and ends.
I spin up $5/month linux servers to host it in the cloud. You can easily spin up web services, dashboards, data collection and other functions. Because it is based on javascript and node.js there is a lot of example code out there.

Locally I use it on my local PC, Raspberry Pi’s and Beagle Bones. Unless the code is tied to the hardware it is seamless to move things between platforms.

I did have an issue last night trying to read a USB postage scale the appeared as a HID device. Windows 10 wouldn’t share the driver so I had to move the project to a Beagle Bone. Once I figured that out it took all of about 30 minutes to get the USB postage scale to read into Node-Red.

2 Likes