Foddy / node-red-contrib-huemagic

Philips Hue node to control bridges, lights, groups, motion sensors, temperature sensors and Lux sensors using Node-RED.
https://flows.nodered.org/node/node-red-contrib-huemagic
Apache License 2.0
201 stars 67 forks source link

Hue Motion node constantly fires false motion events #298

Closed rvanbaalen closed 2 years ago

rvanbaalen commented 2 years ago

My motion-triggered flows are tripping. As it turns out, there are constantly false motion events incoming.

I hook up a Hue Motion node to a debug node and I see msg.payload.motion = true incoming even though there's no one in that particular room.

The flow:

[
    {
        "id": "b9cea60187d58e71",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "26088d90f106b0fc",
        "type": "group",
        "z": "b9cea60187d58e71",
        "style": {
            "stroke": "#999999",
            "stroke-opacity": "1",
            "fill": "none",
            "fill-opacity": "1",
            "label": true,
            "label-position": "nw",
            "color": "#a4a4a4"
        },
        "nodes": [
            "bc52e96f6c0e6ecf",
            "93be8893539982c9",
            "baab760ff1b1a6bf",
            "070623e1bf7dcfae",
            "d9d54249a3e93863",
            "c226798561904aed",
            "94b5215c15394eb3",
            "50cf48dbdf9367f6",
            "f9b7dc45736edc58",
            "a6d26651cb3fae8a"
        ],
        "x": 114,
        "y": 239,
        "w": 1382,
        "h": 162
    },
    {
        "id": "bc52e96f6c0e6ecf",
        "type": "hue-brightness",
        "z": "b9cea60187d58e71",
        "g": "26088d90f106b0fc",
        "name": "Master bedroom walk-in sensor",
        "bridge": "1e6641c8035ed506",
        "sensorid": "739eaed8-7a1c-4518-9eec-c1ef331d77fe",
        "skipevents": false,
        "initevents": false,
        "x": 950,
        "y": 280,
        "wires": [
            [
                "baab760ff1b1a6bf"
            ]
        ]
    },
    {
        "id": "93be8893539982c9",
        "type": "switch",
        "z": "b9cea60187d58e71",
        "g": "26088d90f106b0fc",
        "name": "is motion",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "true"
            },
            {
                "t": "false"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 700,
        "y": 300,
        "wires": [
            [
                "bc52e96f6c0e6ecf",
                "d9d54249a3e93863"
            ],
            [
                "d9d54249a3e93863"
            ]
        ]
    },
    {
        "id": "baab760ff1b1a6bf",
        "type": "switch",
        "z": "b9cea60187d58e71",
        "g": "26088d90f106b0fc",
        "name": "is dark",
        "property": "payload.dark",
        "propertyType": "msg",
        "rules": [
            {
                "t": "true"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 1150,
        "y": 280,
        "wires": [
            [
                "50cf48dbdf9367f6"
            ]
        ]
    },
    {
        "id": "070623e1bf7dcfae",
        "type": "link out",
        "z": "b9cea60187d58e71",
        "g": "26088d90f106b0fc",
        "name": "",
        "mode": "link",
        "links": [
            "76637f690c20bdb9"
        ],
        "x": 1455,
        "y": 300,
        "wires": []
    },
    {
        "id": "d9d54249a3e93863",
        "type": "trigger",
        "z": "b9cea60187d58e71",
        "g": "26088d90f106b0fc",
        "name": "if there is no motion 2m",
        "op1": "",
        "op2": "false",
        "op1type": "nul",
        "op2type": "bool",
        "duration": "2",
        "extend": false,
        "overrideDelay": false,
        "units": "min",
        "reset": "true",
        "bytopic": "all",
        "topic": "topic",
        "outputs": 1,
        "x": 970,
        "y": 340,
        "wires": [
            [
                "94b5215c15394eb3"
            ]
        ]
    },
    {
        "id": "c226798561904aed",
        "type": "change",
        "z": "b9cea60187d58e71",
        "g": "26088d90f106b0fc",
        "name": "set payload",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.motion",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 530,
        "y": 300,
        "wires": [
            [
                "93be8893539982c9"
            ]
        ]
    },
    {
        "id": "94b5215c15394eb3",
        "type": "function",
        "z": "b9cea60187d58e71",
        "g": "26088d90f106b0fc",
        "name": "turn off kasa",
        "func": "msg = { payload: \"off\", topic: \"\" }\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1330,
        "y": 340,
        "wires": [
            [
                "070623e1bf7dcfae"
            ]
        ]
    },
    {
        "id": "50cf48dbdf9367f6",
        "type": "function",
        "z": "b9cea60187d58e71",
        "g": "26088d90f106b0fc",
        "name": "turn on kasa",
        "func": "msg = { payload: \"on\", topic: \"\" }\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1330,
        "y": 280,
        "wires": [
            [
                "070623e1bf7dcfae"
            ]
        ]
    },
    {
        "id": "f9b7dc45736edc58",
        "type": "hue-motion",
        "z": "b9cea60187d58e71",
        "g": "26088d90f106b0fc",
        "name": "Master bedroom walk-in sensor",
        "bridge": "1e6641c8035ed506",
        "sensorid": "739eaed8-7a1c-4518-9eec-c1ef331d77fe",
        "skipevents": false,
        "initevents": false,
        "x": 290,
        "y": 300,
        "wires": [
            [
                "c226798561904aed",
                "a6d26651cb3fae8a"
            ]
        ]
    },
    {
        "id": "a6d26651cb3fae8a",
        "type": "debug",
        "z": "b9cea60187d58e71",
        "g": "26088d90f106b0fc",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 510,
        "y": 360,
        "wires": []
    },
    {
        "id": "1e6641c8035ed506",
        "type": "hue-bridge",
        "name": "Philips hue",
        "bridge": "xx.xx.xx.xx",
        "key": "xxx",
        "worker": "1",
        "autoupdates": true,
        "disableupdates": false
    }
]
rvanbaalen commented 2 years ago

This is driving me nuts. I set a debug node on the motion sensor and it's not giving me any data. But the flow is triggered and my light is turned on.

I've deleted everything in NodeRED and it stopped. I added the motion flow again and the lights turn on again at random moments without registering any events from the motion sensor node to the debug node.

rvanbaalen commented 2 years ago

Okay @Foddy I think I've found the issue. In another flow, I was pushing messages to the Hue Bridge node. Each time the Hue Bridge node received a message, it also pushed out status updates for the connected devices, resulting in my motion sensors to trigger false detections.

Long story short, this seems to be a user error on my part and not a bug, I'll close this ticket.

dongennl commented 2 years ago

I'm having the same, 3 times woken up with my bathroom lights on in the middle of the night; but I'm not sending anything to the Hubs. Can't work it out.