Hue Outdoor Motion Sensor with Node-RED

If you already own the Hue Outdoor Motion Sensor and you can’t wait for Athom’s Hue app update and you have Node-RED running. Try this node-red-contrib-huemagic

You have a couple of options in order to get your data in Homey:

use an MQTT client to capture the data in Homey

using a javascript function block in Node-RED you can parse the data from the Hue motion node. The data looks like this:

payload:{
	"active":true,
	"motion":true,
	"updated":"2019-02-13T19:10:13+00:00"
},
info:{
	"id":"11",
	"uniqueId":"00:17:88:01:06:44:04:25-02-0406",
	"name":"Hue outdoor motion sensor 1",
	"type":"ZLLPresence",
	"softwareVersion":"6.1.0.25261",
	"battery":100,
	"model": {
		"id":null,
		"manufacturer":null,
		"name":null,
		"type":null
	}
}

using some javascript you need to declare a topic variable which will be handed over later to the mqtt output node.

var newmsg = {};
newmsg.topic = "home/sensors/hue/motion/" + msg.payload.motion;
node.status({text: "topic: " + newmsg.topic});

return newmsg;

The mqtt output node points to your MQTT broker. If you installed a broker on your Homey device then the ip-address of your Homey with your configured credentials. An external broker would also work in this case.

Now create a flow and add the MQTT Client card and set the topic to the topic variable created in node-red: home/sensors/hue/motion/true or use a wildcard home/sensors/hue/motion/#
The rest is up to you.

another option could be using a HTTP request flow card

For this option to work you will have to uncheck the require authorizaton on api setting of the HTTP request flow card. While you could add headers to the call from node-red this is out of the scope of this simple example.

Make sure the ip-address of node-red is whitelisted.
Just as the previous example. First you need to parse the Hue motion node in a function block. The ip-address is your Homey ip-address.

var newmsg = {};
newmsg.url = '192.168.1.61/api/app/com.internet/whitelist/hue_motion/'+ msg.payload.motion;
node.status({text: 'url: ' +  newmsg.url});

return newmsg;

Next add a http request node. No need to set anything. The url is passed from the javascript function block to the http request node.

Now go to Homey and create a flow and add a HTTP request flow card and set the event name to hue_motion.

Just as before you can now complete the flow by using the value tag containing either true or false.

These examples are some very basic examples of how you can leverage node-red to help you automate.

1 Like

A few days back I also bought two of the new HUE outdoor sensors. They work great after installing in the HUE app, but it’s not possible to ad them into Homey V.1.15.13 Will Athom ad them to Homey in th near future or do I need to send a request to Athom?

I guess Athom will eventually add the outdoor sensor. But just to be sure you should send a request.