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"
}
]