Updating nodes from True to False when no movement detected

Hi,

Newbie here and trying to set up a Vacation mode. The task I'm trying to do is check if people haven't been around for a while, so both of us away --> start video recording. If we're away and motion detected by any of the internal motion sensors, send an alert. Feels like it should be straightforward and I'm using an AND boolean for both away and an OR for motion detected.

The issue I get is while we're not away doesn't matter whether there is motion or not - my flow correctly goes from FALSE to TRUE, once the motion is over (or if none detected for 5 minutes) it should go back to FALSE, but I can't seem to get it to do that. I understand how to get it to push 'TRUE' but not a 'FALSE' when no motion is detected. I've tried using an Inject node or Trigger node, but just not getting it to work.

Thank you for reading this and even more thanks if you can help. I have tried searching for some ideas but Updating just tends to come back with how to update the version of NR.

Colin

[
    {
        "id": "2ae95c0d6fee596e",
        "type": "tab",
        "label": "Vacation",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "d36a80cd2e6745ff",
        "type": "and-gate",
        "z": "2ae95c0d6fee596e",
        "name": "Both Away",
        "rules": [
            {
                "t": "true",
                "propertyType": "msg",
                "property": "payload",
                "topic": "ColinAway"
            },
            {
                "t": "true",
                "propertyType": "msg",
                "property": "payload",
                "topic": "JudeAway"
            }
        ],
        "outputTopic": "BothAway",
        "gateType": "and",
        "emitOnlyIfTrue": true,
        "x": 510,
        "y": 80,
        "wires": [
            [
                "6b2b14341e990d6f"
            ]
        ],
        "info": "Check to see if both people are away"
    },
    {
        "id": "68699525d7d6badf",
        "type": "server-state-changed",
        "z": "2ae95c0d6fee596e",
        "name": "ColinAway",
        "server": "98511cac7ac8d7d8",
        "version": 4,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "person.colin",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "home",
        "halt_if_type": "str",
        "halt_if_compare": "is_not",
        "outputs": 2,
        "output_only_on_state_change": true,
        "for": "30",
        "forType": "num",
        "forUnits": "minutes",
        "ignorePrevStateNull": false,
        "ignorePrevStateUnknown": false,
        "ignorePrevStateUnavailable": false,
        "ignoreCurrentStateUnknown": true,
        "ignoreCurrentStateUnavailable": true,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "true",
                "valueType": "bool"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "ColinAway",
                "valueType": "str"
            }
        ],
        "x": 100,
        "y": 80,
        "wires": [
            [
                "d36a80cd2e6745ff",
                "56260fa60b4dffa2"
            ],
            []
        ]
    },
    {
        "id": "59896788424274df",
        "type": "server-state-changed",
        "z": "2ae95c0d6fee596e",
        "name": "JudeAway",
        "server": "98511cac7ac8d7d8",
        "version": 4,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "person.jude",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "home",
        "halt_if_type": "str",
        "halt_if_compare": "is_not",
        "outputs": 2,
        "output_only_on_state_change": true,
        "for": "30",
        "forType": "num",
        "forUnits": "minutes",
        "ignorePrevStateNull": false,
        "ignorePrevStateUnknown": false,
        "ignorePrevStateUnavailable": false,
        "ignoreCurrentStateUnknown": true,
        "ignoreCurrentStateUnavailable": true,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "true",
                "valueType": "bool"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "JudeAway",
                "valueType": "str"
            }
        ],
        "x": 100,
        "y": 160,
        "wires": [
            [
                "d36a80cd2e6745ff",
                "56260fa60b4dffa2"
            ],
            []
        ]
    },
    {
        "id": "6b2b14341e990d6f",
        "type": "api-call-service",
        "z": "2ae95c0d6fee596e",
        "name": "Home Mode Off",
        "server": "98511cac7ac8d7d8",
        "version": 5,
        "debugenabled": false,
        "domain": "switch",
        "service": "turn_off",
        "areaId": [],
        "deviceId": [
            "2b7232ab4d62c6c301a51cf27240220a"
        ],
        "entityId": [
            "switch.diskstation_surveillance_station_home_mode"
        ],
        "data": "",
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "last",
        "x": 980,
        "y": 120,
        "wires": [
            [
                "ecbafa6d3be7d3ac",
                "04fc0acb91bd4364"
            ]
        ]
    },
    {
        "id": "56260fa60b4dffa2",
        "type": "and-gate",
        "z": "2ae95c0d6fee596e",
        "name": "IndoorsMotionAlert",
        "rules": [
            {
                "t": "true",
                "propertyType": "msg",
                "property": "payload",
                "topic": "ColinAway"
            },
            {
                "t": "true",
                "propertyType": "msg",
                "property": "payload",
                "topic": "JudeAway"
            },
            {
                "t": "true",
                "propertyType": "msg",
                "property": "payload",
                "topic": "MotionDetected"
            }
        ],
        "outputTopic": "IndoorsMotionAlert",
        "gateType": "and",
        "emitOnlyIfTrue": true,
        "x": 510,
        "y": 160,
        "wires": [
            [
                "573d1fac88a7d594"
            ]
        ],
        "info": "Check to see if both people are away"
    },
    {
        "id": "7e10b6898845615f",
        "type": "or-gate",
        "z": "2ae95c0d6fee596e",
        "name": "MotionDetected",
        "rules": [
            {
                "t": "true",
                "propertyType": "msg",
                "property": "payload",
                "topic": "MotionDownstairs"
            },
            {
                "t": "true",
                "propertyType": "msg",
                "property": "payload",
                "topic": "MotionUpstairs"
            },
            {
                "t": "true",
                "propertyType": "msg",
                "property": "payload",
                "topic": "MotionLivingRoom"
            }
        ],
        "outputTopic": "MotionDetected",
        "gateType": "or",
        "emitOnlyIfTrue": true,
        "x": 420,
        "y": 320,
        "wires": [
            [
                "56260fa60b4dffa2"
            ]
        ]
    },
    {
        "id": "f7fd2ff58483ac20",
        "type": "server-state-changed",
        "z": "2ae95c0d6fee596e",
        "name": "MotionDownstairs",
        "server": "98511cac7ac8d7d8",
        "version": 4,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "binary_sensor.motion_sensor",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "off",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 2,
        "output_only_on_state_change": false,
        "for": "5",
        "forType": "num",
        "forUnits": "minutes",
        "ignorePrevStateNull": false,
        "ignorePrevStateUnknown": false,
        "ignorePrevStateUnavailable": false,
        "ignoreCurrentStateUnknown": true,
        "ignoreCurrentStateUnavailable": true,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "true",
                "valueType": "bool"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "MotionDownstairs",
                "valueType": "str"
            }
        ],
        "x": 110,
        "y": 240,
        "wires": [
            [],
            [
                "7e10b6898845615f"
            ]
        ]
    },
    {
        "id": "24dbd3e698ffcfc8",
        "type": "server-state-changed",
        "z": "2ae95c0d6fee596e",
        "name": "MotionUpstairs",
        "server": "98511cac7ac8d7d8",
        "version": 4,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "binary_sensor.sonoff_a480034589",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "off",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 2,
        "output_only_on_state_change": false,
        "for": "5",
        "forType": "num",
        "forUnits": "minutes",
        "ignorePrevStateNull": false,
        "ignorePrevStateUnknown": false,
        "ignorePrevStateUnavailable": false,
        "ignoreCurrentStateUnknown": true,
        "ignoreCurrentStateUnavailable": true,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "true",
                "valueType": "bool"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "MotionUpstairs",
                "valueType": "str"
            }
        ],
        "x": 120,
        "y": 340,
        "wires": [
            [],
            [
                "7e10b6898845615f",
                "6dcf71bee94cb062"
            ]
        ]
    },
    {
        "id": "58ff7a280dcfe6e3",
        "type": "server-state-changed",
        "z": "2ae95c0d6fee596e",
        "name": "MotionLivingRoom",
        "server": "98511cac7ac8d7d8",
        "version": 4,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "binary_sensor.sonoff_a480034586",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "off",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 2,
        "output_only_on_state_change": false,
        "for": "5",
        "forType": "num",
        "forUnits": "minutes",
        "ignorePrevStateNull": false,
        "ignorePrevStateUnknown": false,
        "ignorePrevStateUnavailable": false,
        "ignoreCurrentStateUnknown": true,
        "ignoreCurrentStateUnavailable": true,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "true",
                "valueType": "bool"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "MotionLivingRoom",
                "valueType": "str"
            }
        ],
        "x": 110,
        "y": 420,
        "wires": [
            [],
            [
                "7e10b6898845615f"
            ]
        ]
    },
    {
        "id": "6dcf71bee94cb062",
        "type": "debug",
        "z": "2ae95c0d6fee596e",
        "name": "debug 4",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 500,
        "y": 420,
        "wires": []
    },
    {
        "id": "e67785f831362dba",
        "type": "inject",
        "z": "2ae95c0d6fee596e",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 660,
        "y": 320,
        "wires": [
            [
                "573d1fac88a7d594"
            ]
        ]
    },
    {
        "id": "573d1fac88a7d594",
        "type": "api-call-service",
        "z": "2ae95c0d6fee596e",
        "name": "Internal motion detected",
        "server": "98511cac7ac8d7d8",
        "version": 5,
        "debugenabled": false,
        "domain": "persistent_notification",
        "service": "create",
        "areaId": [],
        "deviceId": [],
        "entityId": [],
        "data": "{\"message\":\" Internal motion detected\",\"title\":\"Vacation mode\"}",
        "dataType": "json",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "all",
        "x": 950,
        "y": 240,
        "wires": [
            []
        ]
    },
    {
        "id": "ecbafa6d3be7d3ac",
        "type": "api-call-service",
        "z": "2ae95c0d6fee596e",
        "name": "Home Mode Set",
        "server": "98511cac7ac8d7d8",
        "version": 5,
        "debugenabled": false,
        "domain": "notify",
        "service": "mobile_app_ipad_colin",
        "areaId": [],
        "deviceId": [],
        "entityId": [],
        "data": "{\"message\":\" Home Mode set - vacation\",\"title\":\"Vacation mode\"}",
        "dataType": "json",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "all",
        "x": 1260,
        "y": 140,
        "wires": [
            []
        ]
    },
    {
        "id": "04fc0acb91bd4364",
        "type": "api-call-service",
        "z": "2ae95c0d6fee596e",
        "name": "Send message",
        "server": "98511cac7ac8d7d8",
        "version": 5,
        "debugenabled": false,
        "domain": "icloud",
        "service": "display_message",
        "areaId": [],
        "deviceId": [],
        "entityId": [],
        "data": "{\"account\”:\”xxx@yyy.com\”,\”device_name\":\"iPhone12-Colin\",\"message\":\"Internal movement detected\"}",
        "dataType": "json",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1240,
        "y": 260,
        "wires": [
            []
        ]
    },
    {
        "id": "3bc699c7085bca8a",
        "type": "inject",
        "z": "2ae95c0d6fee596e",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 1020,
        "y": 380,
        "wires": [
            [
                "04fc0acb91bd4364"
            ]
        ]
    },
    {
        "id": "98511cac7ac8d7d8",
        "type": "server",
        "name": "Home Assistant",
        "version": 4,
        "addon": false,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": false,
        "cacheJson": false,
        "heartbeat": true,
        "heartbeatInterval": "30",
        "areaSelector": "friendlyName",
        "deviceSelector": "friendlyName",
        "entitySelector": "friendlyName",
        "statusSeparator": ": ",
        "statusYear": "hidden",
        "statusMonth": "short",
        "statusDay": "numeric",
        "statusHourCycle": "default",
        "statusTimeFormat": "h:m"
    }
]

I'm unable to import your flow into Node-RED.
bad_import

Hi Dave, Thanks for checking - I was trying to remove my iCloud account details, I've deleted that node, as its not important to the logic.
Try this instead:

[
    {
        "id": "d36a80cd2e6745ff",
        "type": "and-gate",
        "z": "2ae95c0d6fee596e",
        "name": "Both Away",
        "rules": [
            {
                "t": "true",
                "propertyType": "msg",
                "property": "payload",
                "topic": "ColinAway"
            },
            {
                "t": "true",
                "propertyType": "msg",
                "property": "payload",
                "topic": "JudeAway"
            }
        ],
        "outputTopic": "BothAway",
        "gateType": "and",
        "emitOnlyIfTrue": true,
        "x": 510,
        "y": 80,
        "wires": [
            [
                "6b2b14341e990d6f"
            ]
        ],
        "info": "Check to see if both people are away"
    },
    {
        "id": "68699525d7d6badf",
        "type": "server-state-changed",
        "z": "2ae95c0d6fee596e",
        "name": "ColinAway",
        "server": "98511cac7ac8d7d8",
        "version": 4,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "person.colin",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "home",
        "halt_if_type": "str",
        "halt_if_compare": "is_not",
        "outputs": 2,
        "output_only_on_state_change": true,
        "for": "30",
        "forType": "num",
        "forUnits": "minutes",
        "ignorePrevStateNull": false,
        "ignorePrevStateUnknown": false,
        "ignorePrevStateUnavailable": false,
        "ignoreCurrentStateUnknown": true,
        "ignoreCurrentStateUnavailable": true,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "true",
                "valueType": "bool"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "ColinAway",
                "valueType": "str"
            }
        ],
        "x": 100,
        "y": 80,
        "wires": [
            [
                "d36a80cd2e6745ff",
                "56260fa60b4dffa2"
            ],
            []
        ]
    },
    {
        "id": "59896788424274df",
        "type": "server-state-changed",
        "z": "2ae95c0d6fee596e",
        "name": "JudeAway",
        "server": "98511cac7ac8d7d8",
        "version": 4,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "person.jude",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "home",
        "halt_if_type": "str",
        "halt_if_compare": "is_not",
        "outputs": 2,
        "output_only_on_state_change": true,
        "for": "30",
        "forType": "num",
        "forUnits": "minutes",
        "ignorePrevStateNull": false,
        "ignorePrevStateUnknown": false,
        "ignorePrevStateUnavailable": false,
        "ignoreCurrentStateUnknown": true,
        "ignoreCurrentStateUnavailable": true,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "true",
                "valueType": "bool"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "JudeAway",
                "valueType": "str"
            }
        ],
        "x": 100,
        "y": 160,
        "wires": [
            [
                "d36a80cd2e6745ff",
                "56260fa60b4dffa2"
            ],
            []
        ]
    },
    {
        "id": "6b2b14341e990d6f",
        "type": "api-call-service",
        "z": "2ae95c0d6fee596e",
        "name": "Home Mode Off",
        "server": "98511cac7ac8d7d8",
        "version": 5,
        "debugenabled": false,
        "domain": "switch",
        "service": "turn_off",
        "areaId": [],
        "deviceId": [
            "2b7232ab4d62c6c301a51cf27240220a"
        ],
        "entityId": [
            "switch.diskstation_surveillance_station_home_mode"
        ],
        "data": "",
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "last",
        "x": 980,
        "y": 120,
        "wires": [
            [
                "ecbafa6d3be7d3ac"
            ]
        ]
    },
    {
        "id": "56260fa60b4dffa2",
        "type": "and-gate",
        "z": "2ae95c0d6fee596e",
        "name": "IndoorsMotionAlert",
        "rules": [
            {
                "t": "true",
                "propertyType": "msg",
                "property": "payload",
                "topic": "ColinAway"
            },
            {
                "t": "true",
                "propertyType": "msg",
                "property": "payload",
                "topic": "JudeAway"
            },
            {
                "t": "true",
                "propertyType": "msg",
                "property": "payload",
                "topic": "MotionDetected"
            }
        ],
        "outputTopic": "IndoorsMotionAlert",
        "gateType": "and",
        "emitOnlyIfTrue": true,
        "x": 510,
        "y": 160,
        "wires": [
            [
                "573d1fac88a7d594"
            ]
        ],
        "info": "Check to see if both people are away"
    },
    {
        "id": "7e10b6898845615f",
        "type": "or-gate",
        "z": "2ae95c0d6fee596e",
        "name": "MotionDetected",
        "rules": [
            {
                "t": "true",
                "propertyType": "msg",
                "property": "payload",
                "topic": "MotionDownstairs"
            },
            {
                "t": "true",
                "propertyType": "msg",
                "property": "payload",
                "topic": "MotionUpstairs"
            },
            {
                "t": "true",
                "propertyType": "msg",
                "property": "payload",
                "topic": "MotionLivingRoom"
            }
        ],
        "outputTopic": "MotionDetected",
        "gateType": "or",
        "emitOnlyIfTrue": true,
        "x": 420,
        "y": 320,
        "wires": [
            [
                "56260fa60b4dffa2"
            ]
        ]
    },
    {
        "id": "f7fd2ff58483ac20",
        "type": "server-state-changed",
        "z": "2ae95c0d6fee596e",
        "name": "MotionDownstairs",
        "server": "98511cac7ac8d7d8",
        "version": 4,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "binary_sensor.motion_sensor",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "off",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 2,
        "output_only_on_state_change": false,
        "for": "5",
        "forType": "num",
        "forUnits": "minutes",
        "ignorePrevStateNull": false,
        "ignorePrevStateUnknown": false,
        "ignorePrevStateUnavailable": false,
        "ignoreCurrentStateUnknown": true,
        "ignoreCurrentStateUnavailable": true,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "true",
                "valueType": "bool"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "MotionDownstairs",
                "valueType": "str"
            }
        ],
        "x": 110,
        "y": 240,
        "wires": [
            [],
            [
                "7e10b6898845615f"
            ]
        ]
    },
    {
        "id": "24dbd3e698ffcfc8",
        "type": "server-state-changed",
        "z": "2ae95c0d6fee596e",
        "name": "MotionUpstairs",
        "server": "98511cac7ac8d7d8",
        "version": 4,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "binary_sensor.sonoff_a480034589",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "off",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 2,
        "output_only_on_state_change": false,
        "for": "5",
        "forType": "num",
        "forUnits": "minutes",
        "ignorePrevStateNull": false,
        "ignorePrevStateUnknown": false,
        "ignorePrevStateUnavailable": false,
        "ignoreCurrentStateUnknown": true,
        "ignoreCurrentStateUnavailable": true,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "true",
                "valueType": "bool"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "MotionUpstairs",
                "valueType": "str"
            }
        ],
        "x": 120,
        "y": 340,
        "wires": [
            [],
            [
                "7e10b6898845615f",
                "6dcf71bee94cb062"
            ]
        ]
    },
    {
        "id": "58ff7a280dcfe6e3",
        "type": "server-state-changed",
        "z": "2ae95c0d6fee596e",
        "name": "MotionLivingRoom",
        "server": "98511cac7ac8d7d8",
        "version": 4,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "binary_sensor.sonoff_a480034586",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "off",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 2,
        "output_only_on_state_change": false,
        "for": "5",
        "forType": "num",
        "forUnits": "minutes",
        "ignorePrevStateNull": false,
        "ignorePrevStateUnknown": false,
        "ignorePrevStateUnavailable": false,
        "ignoreCurrentStateUnknown": true,
        "ignoreCurrentStateUnavailable": true,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "true",
                "valueType": "bool"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "MotionLivingRoom",
                "valueType": "str"
            }
        ],
        "x": 110,
        "y": 420,
        "wires": [
            [],
            [
                "7e10b6898845615f"
            ]
        ]
    },
    {
        "id": "6dcf71bee94cb062",
        "type": "debug",
        "z": "2ae95c0d6fee596e",
        "name": "debug 4",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 500,
        "y": 420,
        "wires": []
    },
    {
        "id": "e67785f831362dba",
        "type": "inject",
        "z": "2ae95c0d6fee596e",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 660,
        "y": 320,
        "wires": [
            [
                "573d1fac88a7d594"
            ]
        ]
    },
    {
        "id": "573d1fac88a7d594",
        "type": "api-call-service",
        "z": "2ae95c0d6fee596e",
        "name": "Internal motion detected",
        "server": "98511cac7ac8d7d8",
        "version": 5,
        "debugenabled": false,
        "domain": "persistent_notification",
        "service": "create",
        "areaId": [],
        "deviceId": [],
        "entityId": [],
        "data": "{\"message\":\" Internal motion detected\",\"title\":\"Vacation mode\"}",
        "dataType": "json",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "all",
        "x": 950,
        "y": 240,
        "wires": [
            []
        ]
    },
    {
        "id": "ecbafa6d3be7d3ac",
        "type": "api-call-service",
        "z": "2ae95c0d6fee596e",
        "name": "Home Mode Set",
        "server": "98511cac7ac8d7d8",
        "version": 5,
        "debugenabled": false,
        "domain": "notify",
        "service": "mobile_app_ipad_colin",
        "areaId": [],
        "deviceId": [],
        "entityId": [],
        "data": "{\"message\":\" Home Mode set - vacation\",\"title\":\"Vacation mode\"}",
        "dataType": "json",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "all",
        "x": 1260,
        "y": 140,
        "wires": [
            []
        ]
    },
    {
        "id": "98511cac7ac8d7d8",
        "type": "server",
        "name": "Home Assistant",
        "version": 4,
        "addon": false,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": false,
        "cacheJson": false,
        "heartbeat": true,
        "heartbeatInterval": "30",
        "areaSelector": "friendlyName",
        "deviceSelector": "friendlyName",
        "entitySelector": "friendlyName",
        "statusSeparator": ": ",
        "statusYear": "hidden",
        "statusMonth": "short",
        "statusDay": "numeric",
        "statusHourCycle": "default",
        "statusTimeFormat": "h:m"
    }
]

Here is a demo using pure node-red nodes. Not everyone has Home Assistant (and even if we did we dony have access to your server or your components).

When requesting help, it is always useful to make a demo flow replacing NON standard nodes with inject nodes or change nodes (to simulate your data).

The demo...

The flow...

[{"id":"b520f036052aa3bb","type":"comment","z":"9a11d6ef7f86328c","name":"If we're away and motion detected by any of the internal motion sensors, send an alert","info":"If we're away and motion detected by any of the internal motion sensors, send an alert","x":1240,"y":440,"wires":[]},{"id":"97696b241e8f36df","type":"inject","z":"9a11d6ef7f86328c","name":"Mr home","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"mr","payload":"true","payloadType":"bool","x":340,"y":480,"wires":[["b02c86f3f31b9802"]]},{"id":"b3da531d4498e0dd","type":"inject","z":"9a11d6ef7f86328c","name":"Mr away","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"mr","payload":"false","payloadType":"bool","x":340,"y":520,"wires":[["b02c86f3f31b9802"]]},{"id":"0619ddf4438798c3","type":"inject","z":"9a11d6ef7f86328c","name":"Mrs home","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"mrs","payload":"true","payloadType":"bool","x":340,"y":580,"wires":[["b02c86f3f31b9802"]]},{"id":"9dd8993fd684e31d","type":"inject","z":"9a11d6ef7f86328c","name":"Mrs away","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"mrs","payload":"false","payloadType":"bool","x":340,"y":620,"wires":[["b02c86f3f31b9802"]]},{"id":"10a1e06605254e57","type":"inject","z":"9a11d6ef7f86328c","name":"Hall PIR presence","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"hall","payload":"true","payloadType":"bool","x":370,"y":700,"wires":[["1aee07b42011c857"]]},{"id":"ed90c29f02ced463","type":"inject","z":"9a11d6ef7f86328c","name":"Hall PIR clear","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"hall","payload":"false","payloadType":"bool","x":350,"y":740,"wires":[["1aee07b42011c857"]]},{"id":"d1b495657723c94b","type":"inject","z":"9a11d6ef7f86328c","name":"Stairs PIR presence","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"stairs","payload":"true","payloadType":"bool","x":370,"y":800,"wires":[["1aee07b42011c857"]]},{"id":"c0b7e24e64abeb98","type":"inject","z":"9a11d6ef7f86328c","name":"Stairs PIR clear","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"stairs","payload":"false","payloadType":"bool","x":360,"y":840,"wires":[["1aee07b42011c857"]]},{"id":"1aee07b42011c857","type":"change","z":"9a11d6ef7f86328c","name":"","rules":[{"t":"set","p":"pir[msg.topic]","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":760,"wires":[["14cd4f1dfbd0d7a5"]]},{"id":"4d13016f8c454395","type":"comment","z":"9a11d6ef7f86328c","name":"store state in flow.pir","info":"","x":610,"y":720,"wires":[]},{"id":"14cd4f1dfbd0d7a5","type":"change","z":"9a11d6ef7f86328c","name":"","rules":[{"t":"set","p":"pirState","pt":"flow","to":"$flowContext(\"pir.stairs\") = true or $flowContext(\"pir.hall\") = true","tot":"jsonata"},{"t":"set","p":"payload","pt":"msg","to":"pirState","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":880,"y":760,"wires":[["279f1edb07315335","b778a57c0104cfaa"]]},{"id":"279f1edb07315335","type":"debug","z":"9a11d6ef7f86328c","name":"pirState","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1060,"y":760,"wires":[]},{"id":"b02c86f3f31b9802","type":"change","z":"9a11d6ef7f86328c","name":"","rules":[{"t":"set","p":"home[msg.topic]","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":630,"y":540,"wires":[["409468ece265f126"]]},{"id":"409468ece265f126","type":"change","z":"9a11d6ef7f86328c","name":"","rules":[{"t":"set","p":"someoneHome","pt":"flow","to":"$flowContext(\"home.mr\") = true or $flowContext(\"home.mrs\") = true","tot":"jsonata"},{"t":"set","p":"payload","pt":"msg","to":"someoneHome","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":540,"wires":[["e2b615d0b64aa105","b778a57c0104cfaa"]]},{"id":"e2b615d0b64aa105","type":"debug","z":"9a11d6ef7f86328c","name":"someoneHome","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1080,"y":540,"wires":[]},{"id":"b778a57c0104cfaa","type":"switch","z":"9a11d6ef7f86328c","name":"someoneHome yes/no","property":"someoneHome","propertyType":"flow","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":940,"y":640,"wires":[["019635e5439543e1"],["ab9246235961c0d8"]]},{"id":"ab9246235961c0d8","type":"switch","z":"9a11d6ef7f86328c","name":"pir active? yes/no","property":"pirState","propertyType":"flow","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1210,"y":660,"wires":[["e9b13f9c871ec45c"],["019635e5439543e1"]]},{"id":"9ae9a94b3d094452","type":"debug","z":"9a11d6ef7f86328c","name":"ALERT!!!","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1500,"y":600,"wires":[]},{"id":"e9b13f9c871ec45c","type":"change","z":"9a11d6ef7f86328c","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"ALERT ALERT","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1280,"y":600,"wires":[["9ae9a94b3d094452","402cfb08d5f009a6"]]},{"id":"019635e5439543e1","type":"change","z":"9a11d6ef7f86328c","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"No worries, all good","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1280,"y":720,"wires":[["402cfb08d5f009a6"]]},{"id":"402cfb08d5f009a6","type":"debug","z":"9a11d6ef7f86328c","name":"Status","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1490,"y":660,"wires":[]},{"id":"539daa09a880da13","type":"comment","z":"9a11d6ef7f86328c","name":"store state in flow.home","info":"","x":620,"y":500,"wires":[]},{"id":"f1bab472e753852f","type":"comment","z":"9a11d6ef7f86328c","name":"Is someone at home?","info":"","x":940,"y":600,"wires":[]},{"id":"125896566924f306","type":"comment","z":"9a11d6ef7f86328c","name":"Simulate HA signals with inject nodes \\n Not everyone has HA and we definitely \\n dont have access to your HA server ;)","info":"","x":350,"y":420,"wires":[]}]

Thanks Steve - will try later. Point noted about replacing non standard nodes, presume that also saves having to ship the wife round to everyone’s house that want to test the automation :slight_smile:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.