Skip to content

Instantly share code, notes, and snippets.

@51av0sh
Created February 28, 2025 06:14
Show Gist options
  • Save 51av0sh/47bed5f2eaa01ece88ca0d66f4a07078 to your computer and use it in GitHub Desktop.
Save 51av0sh/47bed5f2eaa01ece88ca0d66f4a07078 to your computer and use it in GitHub Desktop.
Presence Flow (nodered)
[
{
"id": "",
"type": "tab",
"label": "Presence",
"disabled": false,
"info": ""
},
{
"id": "a36140755c016c60",
"type": "junction",
"z": "",
"x": 1740,
"y": 4220,
"wires": [
[
"7bae33f6.55dd7c"
]
]
},
{
"id": "c86b482b3c28acd9",
"type": "junction",
"z": "",
"x": 1740,
"y": 4140,
"wires": [
[
"7bae33f6.55dd7c"
]
]
},
{
"id": "068d61e20e34d405",
"type": "junction",
"z": "",
"x": 1740,
"y": 3900,
"wires": [
[
"7bae33f6.55dd7c"
]
]
},
{
"id": "4fd4c7653c3a28de",
"type": "junction",
"z": "",
"x": 1740,
"y": 3980,
"wires": [
[
"7bae33f6.55dd7c"
]
]
},
{
"id": "bd650b2bca262b3d",
"type": "junction",
"z": "",
"x": 1740,
"y": 4060,
"wires": [
[
"7bae33f6.55dd7c"
]
]
},
{
"id": "e8a67a90f912bb23",
"type": "junction",
"z": "",
"x": 1420,
"y": 3900,
"wires": [
[
"4f424c9f.eb2f04"
]
]
},
{
"id": "ad01cbb8fd329064",
"type": "junction",
"z": "",
"x": 1420,
"y": 4140,
"wires": [
[
"7fe12d4.35459d4"
]
]
},
{
"id": "cd509edbc1216e41",
"type": "junction",
"z": "",
"x": 1420,
"y": 4060,
"wires": [
[
"5e8bcad.dfff434"
]
]
},
{
"id": "3cbeb32ae128a58b",
"type": "junction",
"z": "",
"x": 1420,
"y": 3980,
"wires": [
[
"537c8f7.ddb947"
]
]
},
{
"id": "c3c12c057d75046f",
"type": "junction",
"z": "",
"x": 1420,
"y": 4220,
"wires": [
[
"f038e42342bbdb22"
]
]
},
{
"id": "685d18700def8f97",
"type": "junction",
"z": "",
"x": 1740,
"y": 4300,
"wires": [
[
"7bae33f6.55dd7c"
]
]
},
{
"id": "0d237769f0ed50a6",
"type": "junction",
"z": "",
"x": 1420,
"y": 4300,
"wires": [
[
"68432d44d2f55ab2"
]
]
},
{
"id": "ec94f9406b23ed17",
"type": "junction",
"z": "",
"x": 420,
"y": 5160,
"wires": [
[
"1f3751a7261cf52f"
]
]
},
{
"id": "f35dfc17d0f219af",
"type": "junction",
"z": "",
"x": 1480,
"y": 2240,
"wires": [
[
"406894355f44e5d4"
]
]
},
{
"id": "246723a354fce217",
"type": "junction",
"z": "",
"x": 1480,
"y": 2200,
"wires": [
[
"053a9acd11caec36"
]
]
},
{
"id": "babd46949b230f02",
"type": "junction",
"z": "",
"x": 420,
"y": 5080,
"wires": [
[
"d43cb77dba7ea5c8"
]
]
},
{
"id": "2fe748f74ba00212",
"type": "junction",
"z": "",
"x": 420,
"y": 4760,
"wires": [
[
"ca108cd7.dda85"
]
]
},
{
"id": "05bc6dd84c63e9d6",
"type": "junction",
"z": "",
"x": 420,
"y": 4840,
"wires": [
[
"9088033a.0f72d"
]
]
},
{
"id": "29ce960dfb04fe6b",
"type": "junction",
"z": "",
"x": 420,
"y": 4920,
"wires": [
[
"26e80aa567cd7362"
]
]
},
{
"id": "03973b7a37078dfe",
"type": "junction",
"z": "",
"x": 420,
"y": 5000,
"wires": [
[
"4832696c2877a00d"
]
]
},
{
"id": "cde8332fe9e9a0ed",
"type": "junction",
"z": "",
"x": 1480,
"y": 2080,
"wires": [
[
"fd054dda.b9126"
]
]
},
{
"id": "a6dd67e8438f9367",
"type": "junction",
"z": "",
"x": 1480,
"y": 2280,
"wires": [
[
"1cf74401c34c0d28"
]
]
},
{
"id": "4e940cdc9f2c2d11",
"type": "junction",
"z": "",
"x": 1740,
"y": 4380,
"wires": [
[
"7bae33f6.55dd7c"
]
]
},
{
"id": "c07a9d0750499f90",
"type": "junction",
"z": "",
"x": 1420,
"y": 4380,
"wires": [
[
"476b8adf48332891"
]
]
},
{
"id": "6eb976513a3f13ee",
"type": "junction",
"z": "",
"x": 420,
"y": 5240,
"wires": [
[
"fe7909104ebf94e0"
]
]
},
{
"id": "5b37faf91a9f3556",
"type": "junction",
"z": "",
"x": 420,
"y": 5320,
"wires": [
[
"5138cb902d95da89"
]
]
},
{
"id": "f6b3f251b2be8419",
"type": "junction",
"z": "",
"x": 1740,
"y": 4460,
"wires": [
[
"7bae33f6.55dd7c"
]
]
},
{
"id": "07bd316521ad4a54",
"type": "junction",
"z": "",
"x": 1420,
"y": 4460,
"wires": [
[
"3ebccd1be3ec0d92"
]
]
},
{
"id": "82247a947d27557d",
"type": "junction",
"z": "",
"x": 820,
"y": 4020,
"wires": [
[
"604425105eb1c89d"
]
]
},
{
"id": "c12009828276ba33",
"type": "junction",
"z": "",
"x": 820,
"y": 4100,
"wires": [
[
"d48fabbd6e78455e"
]
]
},
{
"id": "7ba493d398bfa7f7",
"type": "junction",
"z": "",
"x": 820,
"y": 4180,
"wires": [
[
"6005813ad765525c"
]
]
},
{
"id": "8584bbc94651bca1",
"type": "junction",
"z": "",
"x": 820,
"y": 4260,
"wires": [
[
"d32f7a4d775abb10"
]
]
},
{
"id": "fdfb547d4756f818",
"type": "junction",
"z": "",
"x": 820,
"y": 4340,
"wires": [
[
"a7c43a3666874d6d"
]
]
},
{
"id": "c4862776e5afda51",
"type": "junction",
"z": "",
"x": 820,
"y": 4420,
"wires": [
[
"c081ab548422f61b"
]
]
},
{
"id": "e79f07cb5aa211fc",
"type": "junction",
"z": "",
"x": 820,
"y": 4500,
"wires": [
[
"29c576c486a5c984"
]
]
},
{
"id": "19471f1044f548b1",
"type": "junction",
"z": "",
"x": 1180,
"y": 3980,
"wires": [
[
"3cbeb32ae128a58b"
]
]
},
{
"id": "4c33094280c346a2",
"type": "junction",
"z": "",
"x": 1180,
"y": 4060,
"wires": [
[
"cd509edbc1216e41"
]
]
},
{
"id": "579d46e456780a67",
"type": "junction",
"z": "",
"x": 1180,
"y": 4140,
"wires": [
[
"ad01cbb8fd329064"
]
]
},
{
"id": "c26ac73562c3acd5",
"type": "junction",
"z": "",
"x": 1180,
"y": 4220,
"wires": [
[
"c3c12c057d75046f"
]
]
},
{
"id": "2aed4311350660ab",
"type": "junction",
"z": "",
"x": 1180,
"y": 4300,
"wires": [
[
"0d237769f0ed50a6"
]
]
},
{
"id": "e2173851839010ef",
"type": "junction",
"z": "",
"x": 1180,
"y": 4380,
"wires": [
[
"c07a9d0750499f90"
]
]
},
{
"id": "56534c6a12ca8805",
"type": "junction",
"z": "",
"x": 1180,
"y": 4460,
"wires": [
[
"07bd316521ad4a54"
]
]
},
{
"id": "f8b2cc9ec4e75300",
"type": "junction",
"z": "",
"x": 1180,
"y": 4040,
"wires": [
[
"97dac6eba2e07cf1"
]
]
},
{
"id": "97dac6eba2e07cf1",
"type": "junction",
"z": "",
"x": 1420,
"y": 4040,
"wires": [
[
"fabfa00fc4279c25"
]
]
},
{
"id": "76f8227fb7a0a0b5",
"type": "junction",
"z": "",
"x": 1180,
"y": 4120,
"wires": [
[
"d4a5952e6edbec93"
]
]
},
{
"id": "d4a5952e6edbec93",
"type": "junction",
"z": "",
"x": 1420,
"y": 4120,
"wires": [
[
"de068c6039e34e35"
]
]
},
{
"id": "c2df9b0eab90bfbd",
"type": "junction",
"z": "",
"x": 1180,
"y": 4200,
"wires": [
[
"f89c7e8ab415dc6e"
]
]
},
{
"id": "f89c7e8ab415dc6e",
"type": "junction",
"z": "",
"x": 1420,
"y": 4200,
"wires": [
[
"a44d8d2769289216"
]
]
},
{
"id": "abe3409c05a28aba",
"type": "junction",
"z": "",
"x": 1180,
"y": 4280,
"wires": [
[
"e402537e8ea2faa2"
]
]
},
{
"id": "e402537e8ea2faa2",
"type": "junction",
"z": "",
"x": 1420,
"y": 4280,
"wires": [
[
"7192d331a9623b0c"
]
]
},
{
"id": "a60d1677fc1652a4",
"type": "junction",
"z": "",
"x": 1180,
"y": 4360,
"wires": [
[
"f7132962c126df15"
]
]
},
{
"id": "f7132962c126df15",
"type": "junction",
"z": "",
"x": 1420,
"y": 4360,
"wires": [
[
"e0a698771fbbf6b4"
]
]
},
{
"id": "1edf5dd6f9a21217",
"type": "junction",
"z": "",
"x": 1180,
"y": 4440,
"wires": [
[
"f346dd2d54d83679"
]
]
},
{
"id": "f346dd2d54d83679",
"type": "junction",
"z": "",
"x": 1420,
"y": 4440,
"wires": [
[
"b0fa5c63cc79e63f"
]
]
},
{
"id": "1cb55a67473f509c",
"type": "junction",
"z": "",
"x": 1180,
"y": 4520,
"wires": [
[
"d3893ec5768f11eb"
]
]
},
{
"id": "d3893ec5768f11eb",
"type": "junction",
"z": "",
"x": 1380,
"y": 4520,
"wires": [
[
"90fd74216728f27b"
]
]
},
{
"id": "3e333068428ed6ee",
"type": "junction",
"z": "",
"x": 420,
"y": 5400,
"wires": [
[
"4177bcd354409d33"
]
]
},
{
"id": "f113e406508b9574",
"type": "junction",
"z": "",
"x": 1740,
"y": 4540,
"wires": [
[
"7bae33f6.55dd7c"
]
]
},
{
"id": "db0c5b790e0ee45d",
"type": "junction",
"z": "",
"x": 1420,
"y": 4540,
"wires": [
[
"17f7c894f32361bf"
]
]
},
{
"id": "9c0c124a07340d77",
"type": "junction",
"z": "",
"x": 820,
"y": 4580,
"wires": [
[
"0cdea4d07e238778"
]
]
},
{
"id": "b27f9c362b610c51",
"type": "junction",
"z": "",
"x": 1180,
"y": 4540,
"wires": [
[
"db0c5b790e0ee45d"
]
]
},
{
"id": "c2c5bdda15128f3f",
"type": "junction",
"z": "",
"x": 1180,
"y": 4520,
"wires": [
[]
]
},
{
"id": "d58e1c1d1911a075",
"type": "junction",
"z": "",
"x": 1180,
"y": 4600,
"wires": [
[
"d2c48012a1b5dde1"
]
]
},
{
"id": "d2c48012a1b5dde1",
"type": "junction",
"z": "",
"x": 1420,
"y": 4600,
"wires": [
[
"c7540dd8932c103b"
]
]
},
{
"id": "5fb0abe490698c86",
"type": "junction",
"z": "",
"x": 1480,
"y": 2120,
"wires": [
[
"efa695eb.c7dbe8"
]
]
},
{
"id": "cfa61b7f09bb4326",
"type": "junction",
"z": "",
"x": 740,
"y": 4740,
"wires": [
[
"86ab9e9.125176"
]
]
},
{
"id": "67e90afba0d3847f",
"type": "junction",
"z": "",
"x": 740,
"y": 4820,
"wires": [
[
"c00e2c02.3313a"
]
]
},
{
"id": "63f8d1d3d26e2831",
"type": "junction",
"z": "",
"x": 740,
"y": 4900,
"wires": [
[
"7fc6dc30.43cb14"
]
]
},
{
"id": "dec013d7a733f0c5",
"type": "junction",
"z": "",
"x": 740,
"y": 4980,
"wires": [
[
"330c7ee0.eaf012"
]
]
},
{
"id": "557ab358c15fab27",
"type": "junction",
"z": "",
"x": 740,
"y": 5060,
"wires": [
[
"145556a5ca748594"
]
]
},
{
"id": "72af4a2dcb918416",
"type": "junction",
"z": "",
"x": 740,
"y": 5140,
"wires": [
[
"05ee32c899caf5d2"
]
]
},
{
"id": "89ab12f26465f158",
"type": "junction",
"z": "",
"x": 740,
"y": 5220,
"wires": [
[
"8b3067f68c3919d2"
]
]
},
{
"id": "2f8ec70d5c4a8922",
"type": "junction",
"z": "",
"x": 740,
"y": 5300,
"wires": [
[
"1ac6ed82b0230bc6"
]
]
},
{
"id": "18dcfa9b443f79d3",
"type": "junction",
"z": "",
"x": 740,
"y": 5380,
"wires": [
[
"0828ca9cf5b10ad9"
]
]
},
{
"id": "f173028a31e75704",
"type": "junction",
"z": "",
"x": 740,
"y": 4780,
"wires": [
[
"ed53d591.4d9b78"
]
]
},
{
"id": "e4d6a858f82f791c",
"type": "junction",
"z": "",
"x": 740,
"y": 5180,
"wires": [
[
"73200755654c4319"
]
]
},
{
"id": "c0644dbb67e260c6",
"type": "junction",
"z": "",
"x": 740,
"y": 4940,
"wires": [
[
"59324c27.e01084"
]
]
},
{
"id": "371f9febc6c20fda",
"type": "junction",
"z": "",
"x": 740,
"y": 5260,
"wires": [
[
"d9427be664062c44"
]
]
},
{
"id": "15c7ab94d9b5b867",
"type": "junction",
"z": "",
"x": 740,
"y": 5340,
"wires": [
[
"234977093ae90704"
]
]
},
{
"id": "252d0a999a4966b7",
"type": "junction",
"z": "",
"x": 1660,
"y": 1820,
"wires": [
[
"19c7a5ce03745742"
]
]
},
{
"id": "131e62302c685270",
"type": "junction",
"z": "",
"x": 1660,
"y": 1980,
"wires": [
[
"55f442e87f3c795a"
]
]
},
{
"id": "969e7544682f0355",
"type": "junction",
"z": "",
"x": 1440,
"y": 2360,
"wires": [
[
"9dcc26963cc5e458"
]
]
},
{
"id": "da215203e10a3ba9",
"type": "junction",
"z": "",
"x": 1440,
"y": 2040,
"wires": [
[
"3db4c25e.151f3e"
]
]
},
{
"id": "402d3a3a1aea098a",
"type": "junction",
"z": "",
"x": 820,
"y": 3940,
"wires": [
[
"719b9ee7f45e9136"
]
]
},
{
"id": "93469d5aef55b158",
"type": "junction",
"z": "",
"x": 1180,
"y": 3900,
"wires": [
[
"e8a67a90f912bb23"
]
]
},
{
"id": "aa485baee85d19c8",
"type": "junction",
"z": "",
"x": 1420,
"y": 3960,
"wires": [
[
"d3961d8a5d9b15a7"
]
]
},
{
"id": "d212f7349a1d042d",
"type": "junction",
"z": "",
"x": 1180,
"y": 3960,
"wires": [
[
"aa485baee85d19c8"
]
]
},
{
"id": "bbff812315c5291e",
"type": "junction",
"z": "",
"x": 660,
"y": 4300,
"wires": [
[
"d67b6ecb98f5e08d"
]
]
},
{
"id": "1c9e22d463646c4a",
"type": "junction",
"z": "",
"x": 660,
"y": 3900,
"wires": [
[
"7a88eae7e8625961"
]
]
},
{
"id": "28a3b31c7480b356",
"type": "junction",
"z": "",
"x": 660,
"y": 3980,
"wires": [
[
"5a25b30e.20e30c"
]
]
},
{
"id": "5a0c14a9de811604",
"type": "junction",
"z": "",
"x": 660,
"y": 4220,
"wires": [
[
"04f2e1bbe93a9f9b"
]
]
},
{
"id": "b347e014756cd322",
"type": "junction",
"z": "",
"x": 660,
"y": 4380,
"wires": [
[
"e6f7fa9dff8c5e3d"
]
]
},
{
"id": "84e30fdb7b1a5189",
"type": "junction",
"z": "",
"x": 660,
"y": 4540,
"wires": [
[
"5640ae7079429841"
]
]
},
{
"id": "2af792e68a43eb86",
"type": "junction",
"z": "",
"x": 820,
"y": 900,
"wires": [
[
"fd89c167.7e8f2",
"2cf41b3f3a70ff7f"
]
]
},
{
"id": "57b27c4e0e0ade79",
"type": "junction",
"z": "",
"x": 1000,
"y": 880,
"wires": [
[
"c09a918a.49bf6"
]
]
},
{
"id": "aae5524b155f86a8",
"type": "junction",
"z": "",
"x": 1300,
"y": 860,
"wires": [
[
"63fff231.9c8d7c"
]
]
},
{
"id": "2cf41b3f3a70ff7f",
"type": "junction",
"z": "",
"x": 1100,
"y": 900,
"wires": [
[
"68966c34.9a9b74"
]
]
},
{
"id": "be906d9f68b3b17a",
"type": "junction",
"z": "",
"x": 700,
"y": 860,
"wires": [
[
"aae5524b155f86a8"
]
]
},
{
"id": "a0850594c828a0aa",
"type": "junction",
"z": "",
"x": 540,
"y": 900,
"wires": [
[
"2af792e68a43eb86"
]
]
},
{
"id": "3dd5e5d765a02b18",
"type": "junction",
"z": "",
"x": 540,
"y": 880,
"wires": [
[
"57b27c4e0e0ade79"
]
]
},
{
"id": "3160444c2611e82e",
"type": "junction",
"z": "",
"x": 720,
"y": 1100,
"wires": [
[
"2b5b0e7a.bba302"
]
]
},
{
"id": "47f0337b.bf4a1c",
"type": "api-call-service",
"z": "",
"name": "Set Master Bedroom Pres.",
"server": "",
"version": 7,
"debugenabled": false,
"action": "input_select.select_option",
"floorId": [],
"areaId": [],
"deviceId": [],
"entityId": [
"input_select.master_bedroom_presence"
],
"labelId": [],
"data": "",
"dataType": "json",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "data"
}
],
"queue": "none",
"blockInputOverrides": false,
"domain": "input_select",
"service": "select_option",
"output_location": "payload",
"output_location_type": "msg",
"x": 300,
"y": 160,
"wires": [
[]
]
},
{
"id": "94a826a2.864ed8",
"type": "api-call-service",
"z": "",
"name": "Set Familyroom Pres.",
"server": "",
"version": 7,
"debugenabled": false,
"action": "input_select.select_option",
"floorId": [],
"areaId": [],
"deviceId": [],
"entityId": [
"input_select.familyroom_presence"
],
"labelId": [],
"data": "",
"dataType": "json",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "data"
}
],
"queue": "none",
"blockInputOverrides": false,
"domain": "input_select",
"service": "select_option",
"output_location": "payload",
"output_location_type": "msg",
"x": 280,
"y": 200,
"wires": [
[]
]
},
{
"id": "c6c64a2b.75a6a8",
"type": "api-call-service",
"z": "",
"name": "Set Guestroom Pres.",
"server": "",
"version": 7,
"debugenabled": false,
"action": "input_select.select_option",
"floorId": [],
"areaId": [],
"deviceId": [],
"entityId": [
"input_select.guestroom_presence"
],
"labelId": [],
"data": "",
"dataType": "json",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "data"
}
],
"queue": "none",
"blockInputOverrides": false,
"domain": "input_select",
"service": "select_option",
"output_location": "payload",
"output_location_type": "msg",
"x": 280,
"y": 280,
"wires": [
[]
]
},
{
"id": "3c15a2dd.bbb8fe",
"type": "api-call-service",
"z": "",
"name": "Set House Pres.",
"server": "",
"version": 7,
"debugenabled": false,
"action": "input_select.select_option",
"floorId": [],
"areaId": [],
"deviceId": [],
"entityId": [
"input_select.house_presence"
],
"labelId": [],
"data": "",
"dataType": "json",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "data"
}
],
"queue": "none",
"blockInputOverrides": false,
"domain": "input_select",
"service": "select_option",
"output_location": "payload",
"output_location_type": "msg",
"x": 680,
"y": 160,
"wires": [
[]
]
},
{
"id": "ab2554a4.425d08",
"type": "api-call-service",
"z": "",
"name": "Set person1 Loc.",
"server": "",
"version": 7,
"debugenabled": false,
"action": "input_select.select_option",
"floorId": [],
"areaId": [],
"deviceId": [],
"entityId": [
"input_select.person1"
],
"labelId": [],
"data": "",
"dataType": "json",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "data"
}
],
"queue": "none",
"blockInputOverrides": false,
"domain": "input_select",
"service": "select_option",
"output_location": "payload",
"output_location_type": "msg",
"x": 670,
"y": 240,
"wires": [
[]
]
},
{
"id": "baa2825b.69dca",
"type": "api-call-service",
"z": "",
"name": "Set person2 Loc.",
"server": "",
"version": 7,
"debugenabled": false,
"action": "input_select.select_option",
"floorId": [],
"areaId": [],
"deviceId": [],
"entityId": [
"input_select.person2"
],
"labelId": [],
"data": "",
"dataType": "json",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "data"
}
],
"queue": "none",
"blockInputOverrides": false,
"domain": "input_select",
"service": "select_option",
"output_location": "payload",
"output_location_type": "msg",
"x": 680,
"y": 280,
"wires": [
[]
]
},
{
"id": "dd187599.623e98",
"type": "api-call-service",
"z": "",
"name": "Set Person Loc.",
"server": "",
"version": 7,
"debugenabled": false,
"action": "input_select.select_option",
"floorId": [],
"areaId": [],
"deviceId": [],
"entityId": [],
"labelId": [],
"data": "",
"dataType": "json",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "data"
}
],
"queue": "none",
"blockInputOverrides": false,
"domain": "input_select",
"service": "select_option",
"output_location": "payload",
"output_location_type": "msg",
"x": 680,
"y": 200,
"wires": [
[]
]
},
{
"id": "a2dbfbe4.3aed08",
"type": "link in",
"z": "",
"name": "Set House Presence",
"links": [
"2b5b0e7a.bba302",
"31ba3f02.64339"
],
"x": 555,
"y": 160,
"wires": [
[
"3c15a2dd.bbb8fe"
]
]
},
{
"id": "10a4c1c.ab5cf3e",
"type": "link in",
"z": "",
"name": "Set Familyroom Presence",
"links": [
"4b81d4a0.c7368c",
"56552240.11affc",
"f4c6f48e.0105a8"
],
"x": 135,
"y": 200,
"wires": [
[
"94a826a2.864ed8"
]
]
},
{
"id": "e3687c81.8fcca",
"type": "link in",
"z": "",
"name": "Set Master Bedroom Presence",
"links": [
"60a292a2.a604fc",
"8a3a253c.e62288",
"9e4bad54.76f89"
],
"x": 135,
"y": 160,
"wires": [
[
"47f0337b.bf4a1c"
]
]
},
{
"id": "1c1603fd.cc6ecc",
"type": "link in",
"z": "",
"name": "Set Guestroom Presence",
"links": [
"027abc55376d5523",
"9affd85cc86d28ae",
"9e53d751.aaa578"
],
"x": 135,
"y": 280,
"wires": [
[
"c6c64a2b.75a6a8"
]
]
},
{
"id": "6e8ae924.7b48d8",
"type": "link in",
"z": "",
"name": "Set person1 Loc.",
"links": [
"fdd305cc.1fbb38"
],
"x": 555,
"y": 240,
"wires": [
[
"ab2554a4.425d08"
]
]
},
{
"id": "b85f0795.cf4928",
"type": "link in",
"z": "",
"name": "Set person2 Loc.",
"links": [
"7ba87b35.c25054"
],
"x": 555,
"y": 280,
"wires": [
[
"baa2825b.69dca"
]
]
},
{
"id": "fd252457.e41e18",
"type": "link in",
"z": "",
"name": "Set Person Loc.",
"links": [
"59b500cc.29b7b"
],
"x": 555,
"y": 200,
"wires": [
[
"dd187599.623e98"
]
]
},
{
"id": "a4b2cbfc.eb5288",
"type": "trigger-state",
"z": "",
"name": "Startup",
"server": "",
"version": 5,
"inputs": 0,
"outputs": 2,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"sensor.uptime_h"
],
"substring": [],
"regex": []
},
"debugEnabled": false,
"constraints": [
{
"targetType": "this_entity",
"targetValue": "",
"propertyType": "current_state",
"propertyValue": "new_state.state",
"comparatorType": "is",
"comparatorValueDatatype": "str",
"comparatorValue": "0.05"
},
{
"targetType": "this_entity",
"targetValue": "",
"propertyType": "previous_state",
"propertyValue": "old_state.state",
"comparatorType": "is_not",
"comparatorValueDatatype": "str",
"comparatorValue": "0.05"
}
],
"customOutputs": [],
"outputInitially": true,
"stateType": "str",
"enableInput": false,
"exposeToHomeAssistant": false,
"haConfig": [
{
"property": "name",
"value": ""
},
{
"property": "icon",
"value": ""
}
],
"x": 210,
"y": 40,
"wires": [
[
"d65ddba8.4b6fb8"
],
[]
]
},
{
"id": "12ec67c4.488cf8",
"type": "link in",
"z": "",
"name": "Startup IN",
"links": [
"b498cf4.23e743"
],
"x": 135,
"y": 660,
"wires": [
[
"83758e02.495f8"
]
]
},
{
"id": "917fc2a6.9718f",
"type": "comment",
"z": "",
"name": "1.1 - At Startup, Set P1/P2 to Home/Away",
"info": "Triggered whenever HomeAssistant starts (uptime reaches a certain value).\n\nIt checks the Home/Away status for everyone and sets their input_select.*person*_location entities.",
"x": 200,
"y": 600,
"wires": []
},
{
"id": "83758e02.495f8",
"type": "delay",
"z": "",
"name": "5s",
"pauseType": "delay",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"outputs": 1,
"x": 230,
"y": 660,
"wires": [
[
"744ce665.f25438",
"649a7c77.e4ef14"
]
]
},
{
"id": "744ce665.f25438",
"type": "function",
"z": "",
"name": "person1 Home/Away?",
"func": "// @ts-nocheck\n//code modified from: https://community.home-assistant.io/t/examples-for-using-the-new-get-entities-node/85777/4\nconst globalHomeAssistant = global.get('homeassistant');\nconst ha = globalHomeAssistant.homeAssistant;\nconst person1_home_or_away = ha.states[\"person.person1\"].state;\nconst person1_loc = ha.states[\"input_select.person1\"].state;\n\nnewmsg = {};\n\nif(person1_loc != \"Extended Away\"){\n if(person1_home_or_away == \"home\"){\n newmsg.payload = { data: { \"option\": \"Home\"} }; \n }\n else{\n newmsg.payload = { data: { \"option\": \"Away\"} }; \n }\n return newmsg;\n}\n\n//This flow returns an option to set a person's input_select.p1_location to.\n//It only returns a value if it is not already set to extended away\n//If not extended away, it will return home when the person.p1 is home or\n//away if it is away.\n",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 410,
"y": 640,
"wires": [
[
"fdd305cc.1fbb38"
]
]
},
{
"id": "b498cf4.23e743",
"type": "link out",
"z": "",
"name": "Startup",
"links": [
"12ec67c4.488cf8"
],
"x": 435,
"y": 40,
"wires": []
},
{
"id": "fdd305cc.1fbb38",
"type": "link out",
"z": "",
"name": "",
"links": [
"6e8ae924.7b48d8"
],
"x": 565,
"y": 640,
"wires": []
},
{
"id": "3eaaae0d.ff9d32",
"type": "comment",
"z": "",
"name": "+ Extra People",
"info": "",
"x": 380,
"y": 720,
"wires": []
},
{
"id": "649a7c77.e4ef14",
"type": "function",
"z": "",
"name": "person2 Home/Away?",
"func": "//code modified from: https://community.home-assistant.io/t/examples-for-using-the-new-get-entities-node/85777/4\nconst globalHomeAssistant = global.get('homeassistant');\nconst ha = globalHomeAssistant.homeAssistant;\nconst person2_home_or_away = ha.states[\"person.person2\"].state;\nconst person2_loc = ha.states[\"input_select.person2\"].state;\n\nnewmsg = {};\n\nif(person2_loc != \"Extended Away\"){\n if(person2_home_or_away == \"home\"){\n newmsg.payload = { data: { \"option\": \"Home\"} }; \n }\n else{\n newmsg.payload = { data: { \"option\": \"Away\"} }; \n }\n return newmsg;\n}\n\n//This flow returns an option to set a person's input_select.p2_location to.\n//It only returns a value if it is not already set to extended away\n//If not extended away, it will return home when the person.p2 is home or\n//away if it is away.\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 420,
"y": 680,
"wires": [
[
"7ba87b35.c25054"
]
]
},
{
"id": "7ba87b35.c25054",
"type": "link out",
"z": "",
"name": "",
"links": [
"b85f0795.cf4928"
],
"x": 565,
"y": 680,
"wires": []
},
{
"id": "8f1e0cd2.b21b7",
"type": "switch",
"z": "",
"name": "Home?",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "home",
"vt": "str"
},
{
"t": "eq",
"v": "not_home",
"vt": "str"
}
],
"checkall": "false",
"repair": false,
"outputs": 2,
"x": 420,
"y": 880,
"wires": [
[
"22c8cf70.8b888",
"a0850594c828a0aa"
],
[
"275770da.ec95d",
"3dd5e5d765a02b18"
]
]
},
{
"id": "fd89c167.7e8f2",
"type": "trigger",
"z": "",
"name": "5m",
"op1": "",
"op2": "{\"payload\":{\"data\":{\"option\":\"\"}}}",
"op1type": "nul",
"op2type": "json",
"duration": "5",
"extend": false,
"overrideDelay": false,
"units": "min",
"reset": "home",
"bytopic": "topic",
"topic": "topic",
"outputs": 1,
"x": 910,
"y": 940,
"wires": [
[
"34073b7c.2da564"
]
]
},
{
"id": "68966c34.9a9b74",
"type": "trigger",
"z": "",
"name": "24hr",
"op1": "",
"op2": "{\"payload\":{\"data\":{\"option\":\"\"}}}",
"op1type": "nul",
"op2type": "json",
"duration": "24",
"extend": false,
"overrideDelay": false,
"units": "hr",
"reset": "home",
"bytopic": "topic",
"topic": "topic",
"outputs": 1,
"x": 1190,
"y": 940,
"wires": [
[
"2d8075ba.fd47aa"
]
]
},
{
"id": "22c8cf70.8b888",
"type": "api-current-state",
"z": "",
"name": "Status?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Just Left",
"halt_if_type": "str",
"halt_if_compare": "is_not",
"entity_id": "input_select.{{topic}}",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 600,
"y": 840,
"wires": [
[
"56fffc9f.9a7d24"
],
[
"be906d9f68b3b17a"
]
]
},
{
"id": "275770da.ec95d",
"type": "api-current-state",
"z": "",
"name": "Status?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "[\"Just Left\", \"Away\", \"Extended Away\"]",
"halt_if_type": "jsonata",
"halt_if_compare": "does_not_include",
"entity_id": "input_select.{{topic}}",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 600,
"y": 940,
"wires": [
[
"c4925292.966ab"
],
[]
]
},
{
"id": "c09a918a.49bf6",
"type": "trigger",
"z": "",
"name": "5m",
"op1": "",
"op2": "{\"payload\":{\"data\":{\"option\":\"\"}}}",
"op1type": "nul",
"op2type": "json",
"duration": "5",
"extend": false,
"overrideDelay": false,
"units": "min",
"reset": "not_home",
"bytopic": "topic",
"topic": "topic",
"outputs": 1,
"x": 1090,
"y": 820,
"wires": [
[
"a1856431563e8688"
]
]
},
{
"id": "4d25fb56.83ada4",
"type": "rbe",
"z": "",
"name": "",
"func": "rbe",
"gap": "",
"start": "",
"inout": "out",
"septopics": true,
"property": "payload",
"topi": "topic",
"x": 325,
"y": 880,
"wires": [
[
"8f1e0cd2.b21b7"
]
],
"l": false
},
{
"id": "c4925292.966ab",
"type": "api-call-service",
"z": "",
"name": "Just Left",
"server": "",
"version": 7,
"debugenabled": false,
"action": "input_select.select_option",
"floorId": [],
"areaId": [],
"deviceId": [],
"entityId": [],
"labelId": [],
"data": "{\"entity_id\":\"input_select.{{topic}}\",\"option\":\"Just Left\"}",
"dataType": "json",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"blockInputOverrides": false,
"domain": "input_select",
"service": "select_option",
"output_location": "",
"output_location_type": "none",
"x": 760,
"y": 940,
"wires": [
[
"fd89c167.7e8f2"
]
]
},
{
"id": "34073b7c.2da564",
"type": "api-call-service",
"z": "",
"name": "Away",
"server": "",
"version": 7,
"debugenabled": false,
"action": "input_select.select_option",
"floorId": [],
"areaId": [],
"deviceId": [],
"entityId": [],
"labelId": [],
"data": "{\"entity_id\":\"input_select.{{topic}}\",\"option\":\"Away\"}",
"dataType": "json",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"blockInputOverrides": false,
"domain": "input_select",
"service": "select_option",
"output_location": "",
"output_location_type": "none",
"x": 1050,
"y": 940,
"wires": [
[
"68966c34.9a9b74"
]
]
},
{
"id": "2d8075ba.fd47aa",
"type": "api-call-service",
"z": "",
"name": "Extended Away",
"server": "",
"version": 7,
"debugenabled": false,
"action": "input_select.select_option",
"floorId": [],
"areaId": [],
"deviceId": [],
"entityId": [],
"labelId": [],
"data": "{\"entity_id\":\"input_select.{{topic}}\",\"option\":\"Extended Away\"}",
"dataType": "json",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"blockInputOverrides": false,
"domain": "input_select",
"service": "select_option",
"output_location": "",
"output_location_type": "none",
"x": 1360,
"y": 940,
"wires": [
[]
]
},
{
"id": "56fffc9f.9a7d24",
"type": "api-current-state",
"z": "",
"name": "Status?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Master Bedroom,Livingroom,Office,Guestroom,Diningroom,Garage,Kitchen,Familyroom,Bedroom",
"halt_if_type": "str",
"halt_if_compare": "does_not_include",
"entity_id": "input_select.{{topic}}",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 760,
"y": 820,
"wires": [
[
"f9721f98.eaa53"
],
[]
]
},
{
"id": "63fff231.9c8d7c",
"type": "api-call-service",
"z": "",
"name": "Home",
"server": "",
"version": 7,
"debugenabled": false,
"action": "input_select.select_option",
"floorId": [],
"areaId": [],
"deviceId": [],
"entityId": [],
"labelId": [],
"data": "{\"entity_id\":\"input_select.{{topic}}\",\"option\":\"Home\"}",
"dataType": "json",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"blockInputOverrides": false,
"domain": "input_select",
"service": "select_option",
"output_location": "",
"output_location_type": "none",
"x": 1390,
"y": 840,
"wires": [
[]
]
},
{
"id": "f9721f98.eaa53",
"type": "api-call-service",
"z": "",
"name": "Just Arrived",
"server": "",
"version": 7,
"debugenabled": false,
"action": "input_select.select_option",
"floorId": [],
"areaId": [],
"deviceId": [],
"entityId": [],
"labelId": [],
"data": "{\"entity_id\":\"input_select.{{topic}}\",\"option\":\"Just Arrived\"}",
"dataType": "json",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"blockInputOverrides": false,
"domain": "input_select",
"service": "select_option",
"output_location": "",
"output_location_type": "none",
"x": 930,
"y": 820,
"wires": [
[
"c09a918a.49bf6"
]
]
},
{
"id": "ae961a68.88df58",
"type": "change",
"z": "",
"name": "Change",
"rules": [
{
"t": "change",
"p": "topic",
"pt": "msg",
"from": "person.",
"fromt": "str",
"to": "",
"tot": "str"
},
{
"t": "change",
"p": "topic",
"pt": "msg",
"from": "person1",
"fromt": "str",
"to": "person1",
"tot": "str"
},
{
"t": "change",
"p": "topic",
"pt": "msg",
"from": "person2",
"fromt": "str",
"to": "person2",
"tot": "str"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload = \"home\" ? \"home\" : \"not_home\"",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 275,
"y": 880,
"wires": [
[
"4d25fb56.83ada4"
]
],
"l": false
},
{
"id": "42b6162b.61b9e8",
"type": "trigger-state",
"z": "",
"name": "Person",
"server": "",
"version": 5,
"inputs": 0,
"outputs": 2,
"exposeAsEntityConfig": "",
"entities": {
"entity": [],
"substring": [],
"regex": [
"^person\\..*$"
]
},
"debugEnabled": false,
"constraints": [
{
"targetType": "this_entity",
"targetValue": "",
"propertyType": "current_state",
"propertyValue": "new_state.state",
"comparatorType": "is_not",
"comparatorValueDatatype": "prevEntity",
"comparatorValue": "state"
}
],
"customOutputs": [],
"outputInitially": true,
"stateType": "str",
"enableInput": false,
"exposeToHomeAssistant": false,
"haConfig": [
{
"property": "name",
"value": ""
},
{
"property": "icon",
"value": ""
}
],
"x": 180,
"y": 880,
"wires": [
[
"ae961a68.88df58"
],
[]
]
},
{
"id": "b2b2aabd.72ef48",
"type": "comment",
"z": "",
"name": "1.2 - Set P1/P2.. Just Arrived/Home/Just Left/Away/Extended Away?",
"info": "https://bonani.tech/making-home-assistants-presence-detection-not-so-binary-node-red-version/\n\nThis flow is modified from the example at the link above. It sets people's input_select.*person*_location to either \"Just Arrived\", \"Home\", \"Just Left\", \"Away\" or \"Extended Away\".\n\nWith modifications to change node (2nd)\nPerson is removed and topic is set to p1_location and p2_location to match the input selects for their locations. Added extra status node with a comment too.",
"x": 300,
"y": 800,
"wires": []
},
{
"id": "336268b7.62c108",
"type": "comment",
"z": "",
"name": "Added Extra Status Node",
"info": "The Status? Node top left now filters to check that input_select.*person*_location is not in:\nJust Left,\nLiving Room,\nBedroom,\nBathroom,\nKitchen\n\nThese extra rooms ensure that Just Arrived is not set when the person has just arrived but BLE locations have already set a room. The second one is used so that the original function of setting location back to home when person.*person* goes to home while input_select.*person*_location is set to Just Left. ",
"x": 750,
"y": 780,
"wires": []
},
{
"id": "91822b0f.5c0e78",
"type": "api-current-state",
"z": "",
"name": "person1 Ext. Away?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Extended Away",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_select.person1",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1360,
"y": 1120,
"wires": [
[
"f9bd6772.16f928"
],
[]
]
},
{
"id": "f9bd6772.16f928",
"type": "function",
"z": "",
"name": "Extended Away",
"func": "// @ts-ignore\nnewmsg = {};\nnewmsg.payload = { data: { \"option\": \"Extended Away\"} }; \nreturn newmsg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1580,
"y": 1100,
"wires": [
[
"31ba3f02.64339"
]
]
},
{
"id": "1ad8d0e6.b4789f",
"type": "server-state-changed",
"z": "",
"name": "person2 to Ext. Away",
"server": "",
"version": 6,
"outputs": 2,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"input_select.person2"
],
"substring": [],
"regex": []
},
"outputInitially": true,
"stateType": "str",
"ifState": "Extended Away",
"ifStateType": "str",
"ifStateOperator": "is",
"outputOnlyOnStateChange": true,
"for": "0",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": false,
"ignoreCurrentStateUnavailable": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 1150,
"y": 1120,
"wires": [
[
"91822b0f.5c0e78"
],
[]
]
},
{
"id": "761a272b.89a7e8",
"type": "api-current-state",
"z": "",
"name": "person2 Ext. Away?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Extended Away",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_select.person2",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1370,
"y": 1080,
"wires": [
[
"f9bd6772.16f928"
],
[]
]
},
{
"id": "f3b4b3c0.81c59",
"type": "server-state-changed",
"z": "",
"name": "person1 to Ext. Away",
"server": "",
"version": 6,
"outputs": 2,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"input_select.person1"
],
"substring": [],
"regex": []
},
"outputInitially": true,
"stateType": "str",
"ifState": "Extended Away",
"ifStateType": "str",
"ifStateOperator": "is",
"outputOnlyOnStateChange": true,
"for": "0",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": false,
"ignoreCurrentStateUnavailable": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 1160,
"y": 1080,
"wires": [
[
"761a272b.89a7e8"
],
[]
]
},
{
"id": "31ba3f02.64339",
"type": "link out",
"z": "",
"name": "",
"links": [
"a2dbfbe4.3aed08"
],
"x": 1705,
"y": 1100,
"wires": []
},
{
"id": "2fe57e28.994fe2",
"type": "comment",
"z": "",
"name": "1.4 - Set House Presence to \"Extended Away\" if everyone is \"Extended Away\"",
"info": "This flow is triggered by someones input_select.*person*_location going to \"Extended Away\".\n\nThen it checks if everyone else is \"Extended Away\" too. If so, input_select.house_presence is also set to \"Extended Away\"",
"x": 1270,
"y": 1020,
"wires": []
},
{
"id": "992f67de.873138",
"type": "server-state-changed",
"z": "",
"name": "person1 Presence",
"server": "",
"version": 6,
"outputs": 1,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"person.person1"
],
"substring": [],
"regex": []
},
"outputInitially": false,
"stateType": "str",
"ifState": "",
"ifStateType": "str",
"ifStateOperator": "is",
"outputOnlyOnStateChange": true,
"for": "0",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": false,
"ignoreCurrentStateUnavailable": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 190,
"y": 1060,
"wires": [
[
"3fdd1097.9a64d"
]
]
},
{
"id": "f1586625.db50f8",
"type": "server-state-changed",
"z": "",
"name": "person2 Presence",
"server": "",
"version": 6,
"outputs": 1,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"person.person2"
],
"substring": [],
"regex": []
},
"outputInitially": false,
"stateType": "str",
"ifState": "",
"ifStateType": "str",
"ifStateOperator": "is",
"outputOnlyOnStateChange": true,
"for": "0",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": false,
"ignoreCurrentStateUnavailable": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 180,
"y": 1100,
"wires": [
[
"3fdd1097.9a64d"
]
]
},
{
"id": "3fdd1097.9a64d",
"type": "api-current-state",
"z": "",
"name": "Cont.?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "on",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_boolean.automations_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 315,
"y": 1080,
"wires": [
[
"87c1e4bb.3ff988"
],
[]
],
"icon": "font-awesome/fa-question",
"l": false
},
{
"id": "87c1e4bb.3ff988",
"type": "api-current-state",
"z": "",
"name": "No Guests?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "off",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_boolean.guest_mode",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 430,
"y": 1060,
"wires": [
[
"4d555bcc.18d884"
],
[
"22f9a936.a708b6"
]
]
},
{
"id": "22f9a936.a708b6",
"type": "function",
"z": "",
"name": "Guests",
"func": "// @ts-ignore\nnewmsg = {};\nnewmsg.payload = { data: { \"option\": \"Guests\"} }; \nreturn newmsg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 620,
"y": 1100,
"wires": [
[
"3160444c2611e82e"
]
]
},
{
"id": "8a1fb05e.c53ed",
"type": "trigger-state",
"z": "",
"name": "Guests?",
"server": "",
"version": 5,
"inputs": 0,
"outputs": 2,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"input_boolean.guest_mode"
],
"substring": [],
"regex": []
},
"debugEnabled": false,
"constraints": [
{
"targetType": "this_entity",
"targetValue": "",
"propertyType": "current_state",
"propertyValue": "new_state.state",
"comparatorType": "is",
"comparatorValueDatatype": "str",
"comparatorValue": "on"
},
{
"targetType": "this_entity",
"targetValue": "",
"propertyType": "previous_state",
"propertyValue": "old_state.state",
"comparatorType": "is_not",
"comparatorValueDatatype": "str",
"comparatorValue": "on"
}
],
"customOutputs": [],
"outputInitially": false,
"stateType": "str",
"enableInput": false,
"exposeToHomeAssistant": false,
"haConfig": [
{
"property": "name",
"value": ""
},
{
"property": "icon",
"value": ""
}
],
"x": 440,
"y": 1120,
"wires": [
[
"22f9a936.a708b6"
],
[
"4d555bcc.18d884"
]
]
},
{
"id": "4d555bcc.18d884",
"type": "function",
"z": "",
"name": "Set House Pres.",
"func": "// @ts-nocheck\n//code modified from: https://community.home-assistant.io/t/examples-for-using-the-new-get-entities-node/85777/4\nconst globalHomeAssistant = global.get('homeassistant');\nconst ha = globalHomeAssistant.homeAssistant;\nconst groupEntity = ha.states['group.home_presence'];\n\nlet occupants = [];\n\ngroupEntity.attributes.entity_id.forEach(i => {\n if(ha.states[i].state === 'home') {\n occupants.push(ha.states[i].attributes.friendly_name);\n //The push bit adds the friendly name of any persons location input select which matches the state (ie home)\n //In this case, the frienly_name of each person.*person* entity is simply that person's initials\n //So this bit returns the initials of all people who are home.\n }\n});\n\n//the join function creates '+' separated string from the array.\noccupants = occupants.join(' + ');\n\n//If no BLE occupation is detected but the motion sensor is on, set the room to Someone\n//Otherwise with no BLE or motion set to Empty \nif (occupants === '') {\n occupants = \"Empty\";\n}\n\nmsg.payload = { data: { \"option\": occupants} };\n\nreturn msg;\n",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 640,
"y": 1060,
"wires": [
[
"2b5b0e7a.bba302"
]
]
},
{
"id": "2b5b0e7a.bba302",
"type": "link out",
"z": "",
"name": "",
"mode": "link",
"links": [
"a2dbfbe4.3aed08"
],
"x": 765,
"y": 1080,
"wires": []
},
{
"id": "d8861e41.5c914",
"type": "comment",
"z": "",
"name": "1.3 - Set House Presence",
"info": "Keep input_select.house_presence updated with current occupation. \n\nThe input \"events:state\" nodes can also be used to trigger home/away notifications/logging for people.",
"x": 150,
"y": 1000,
"wires": []
},
{
"id": "cd28945d.d487e8",
"type": "comment",
"z": "",
"name": "1 - HOME/AWAY PRESENCE",
"info": "",
"x": 130,
"y": 560,
"wires": []
},
{
"id": "f69bc648.c69128",
"type": "comment",
"z": "",
"name": "2 - GENERIC ROOM PRESENCE DETECTION",
"info": "Generic Room Presence adds an extra layer on top of House Presence. It relies just on motion sensors and can be modified to include other sorts of indications of room presence (TV/bed presence etc.).\n\nGeneric Room Presence can set a room to \"Someone\" if motion is detected.\n\nOnce motion is cleared, and the room presence is still \"Someone\", the room is set to \"Empty\" after a short delay.",
"x": 190,
"y": 1200,
"wires": []
},
{
"id": "e728149.8ef6de8",
"type": "server-state-changed",
"z": "",
"name": "Familyroom Motion?",
"server": "",
"version": 6,
"outputs": 2,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"binary_sensor.familyroom_motion"
],
"substring": [],
"regex": []
},
"outputInitially": true,
"stateType": "str",
"ifState": "on",
"ifStateType": "str",
"ifStateOperator": "is",
"outputOnlyOnStateChange": true,
"for": "0",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": true,
"ignoreCurrentStateUnavailable": true,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 170,
"y": 1520,
"wires": [
[
"c01abdb.896b44"
],
[
"3a4622e7.23d09e"
]
]
},
{
"id": "ce8ad9d6.37f498",
"type": "server-state-changed",
"z": "",
"name": "Master Motion?",
"server": "",
"version": 6,
"outputs": 2,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"binary_sensor.master_all_motion"
],
"substring": [],
"regex": []
},
"outputInitially": true,
"stateType": "str",
"ifState": "on",
"ifStateType": "str",
"ifStateOperator": "is",
"outputOnlyOnStateChange": true,
"for": "0",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": false,
"ignoreCurrentStateUnavailable": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 180,
"y": 1400,
"wires": [
[
"a423cbf9.f121d8"
],
[
"4568a6ef.0c68b8"
]
]
},
{
"id": "96639cad.a0e55",
"type": "comment",
"z": "",
"name": "2.1 - Motion/Other Presence Indicators",
"info": "Input triggers that start flows are listed at the top of this section and wired in to a link node so that it's easy to trace which section is prompted by what trigger.\n\nHere examples are given on how motion sensors or other presence detection like bed presence or even a humidity rise in the bathroom would update a room's input_select.*room*_presence to \"Someone\".\n\nOther triggers such as a TV turning on could also be added here. The key is to sepearate what suggests occupation and no occupation and wire them to the appropriate paths.",
"x": 190,
"y": 1240,
"wires": []
},
{
"id": "a423cbf9.f121d8",
"type": "link out",
"z": "",
"name": "Master Bedroom Motion",
"mode": "link",
"links": [
"24ce8072.21636",
"3eb9debc.bc3e82",
"956403e9.f7ebf"
],
"x": 315,
"y": 1380,
"wires": []
},
{
"id": "4568a6ef.0c68b8",
"type": "link out",
"z": "",
"name": "Master Bedroom Motion Cleared",
"mode": "link",
"links": [
"8afc3ce7.b5a0c",
"d20b8b75.a58e68"
],
"x": 315,
"y": 1420,
"wires": []
},
{
"id": "c01abdb.896b44",
"type": "link out",
"z": "",
"name": "Familyroom Motion",
"mode": "link",
"links": [
"272101fc.06d30e",
"2e7101b2.3a72be",
"e2abdf2e.3d15d"
],
"x": 315,
"y": 1480,
"wires": []
},
{
"id": "3a4622e7.23d09e",
"type": "link out",
"z": "",
"name": "Familyroom Motion Cleared",
"mode": "link",
"links": [
"4fd39568.02ef8c",
"e9b8aff7.2651f"
],
"x": 315,
"y": 1520,
"wires": []
},
{
"id": "7b4f2a2.719dfd4",
"type": "change",
"z": "",
"name": "Save Last Room Used",
"rules": [
{
"t": "move",
"p": "room",
"pt": "msg",
"to": "last_used_room",
"tot": "global"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 680,
"y": 2000,
"wires": [
[
"7f4c5204.f08b8c"
]
]
},
{
"id": "7f4c5204.f08b8c",
"type": "api-current-state",
"z": "",
"name": "Cont.?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "on",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_boolean.automations_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 795,
"y": 2000,
"wires": [
[
"f29a6881.cbcd08",
"8a1b912e5b0fcde8"
],
[]
],
"icon": "font-awesome/fa-question",
"l": false
},
{
"id": "c9a7fc9b.17112",
"type": "comment",
"z": "",
"name": "2.2 - Set rooms to \"Someone\"",
"info": "When there is motion in either the Bedroom or Living Room, the room where motion is detected is saved to a global variable so it can quickly be checked in later nodes too.\n\nRooms will only be set when the House is occupied (can help for alarm statuses)\n\nIf only one person is home, then their input_select.*person*_location will be changed to the last room used.\n\nOtherwise is there are 2 or more people home, the input_select.*room*_presence of the last used room will be set to \"Someone\".",
"x": 160,
"y": 1800,
"wires": []
},
{
"id": "24ce8072.21636",
"type": "link in",
"z": "",
"name": "",
"links": [
"a423cbf9.f121d8"
],
"x": 635,
"y": 1380,
"wires": [
[
"91698b36.9ecf88"
]
]
},
{
"id": "d20b8b75.a58e68",
"type": "link in",
"z": "",
"name": "",
"links": [
"4568a6ef.0c68b8"
],
"x": 635,
"y": 1420,
"wires": [
[
"cb12eba6.f64b88"
]
]
},
{
"id": "2e7101b2.3a72be",
"type": "link in",
"z": "",
"name": "",
"links": [
"c01abdb.896b44"
],
"x": 635,
"y": 1480,
"wires": [
[
"c8009d0c.1c861"
]
]
},
{
"id": "4fd39568.02ef8c",
"type": "link in",
"z": "",
"name": "",
"links": [
"3a4622e7.23d09e"
],
"x": 635,
"y": 1520,
"wires": [
[
"a4f57c31.61b97"
]
]
},
{
"id": "956403e9.f7ebf",
"type": "link in",
"z": "",
"name": "",
"links": [
"a423cbf9.f121d8"
],
"x": 325,
"y": 1860,
"wires": [
[
"efdece28.f700b"
]
]
},
{
"id": "272101fc.06d30e",
"type": "link in",
"z": "",
"name": "",
"links": [
"c01abdb.896b44"
],
"x": 325,
"y": 1900,
"wires": [
[
"250e07c2.e9d0b8"
]
]
},
{
"id": "f29a6881.cbcd08",
"type": "api-current-state",
"z": "",
"name": "House Pres.?",
"server": "",
"version": 3,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_select.house_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 920,
"y": 2000,
"wires": [
[
"3f74e1d6.604fae"
]
]
},
{
"id": "3f74e1d6.604fae",
"type": "switch",
"z": "",
"name": "person1/person2/Otherwise",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "person1",
"vt": "str"
},
{
"t": "eq",
"v": "person2",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 3,
"x": 1140,
"y": 2000,
"wires": [
[
"6cb30943.4f1ac8"
],
[
"dd1a3f1d.dee2a"
],
[
"d5ac397b122a8ca4"
]
]
},
{
"id": "6cb30943.4f1ac8",
"type": "api-call-service",
"z": "",
"name": "Set person1 Loc",
"server": "",
"version": 7,
"debugenabled": false,
"action": "input_select.select_option",
"floorId": [],
"areaId": [],
"deviceId": [],
"entityId": [
"input_select.person1"
],
"labelId": [],
"data": "{\"option\":\"{{global.last_used_room}}\"}",
"dataType": "json",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "data"
}
],
"queue": "none",
"blockInputOverrides": false,
"domain": "input_select",
"service": "select_option",
"output_location": "payload",
"output_location_type": "msg",
"x": 1350,
"y": 1960,
"wires": [
[
"6395d34dad653ecf"
]
]
},
{
"id": "dd1a3f1d.dee2a",
"type": "api-call-service",
"z": "",
"name": "Set person2 Loc",
"server": "",
"version": 7,
"debugenabled": false,
"action": "input_select.select_option",
"floorId": [],
"areaId": [],
"deviceId": [],
"entityId": [
"input_select.person2"
],
"labelId": [],
"data": "{\"option\":\"{{global.last_used_room}}\"}",
"dataType": "json",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "data"
}
],
"queue": "none",
"blockInputOverrides": false,
"domain": "input_select",
"service": "select_option",
"output_location": "payload",
"output_location_type": "msg",
"x": 1360,
"y": 2000,
"wires": [
[
"6395d34dad653ecf"
]
]
},
{
"id": "ce079eff.8fd8e",
"type": "switch",
"z": "",
"name": "Room",
"property": "last_used_room",
"propertyType": "global",
"rules": [
{
"t": "eq",
"v": "Master Bedroom",
"vt": "str"
},
{
"t": "eq",
"v": "Familyroom",
"vt": "str"
},
{
"t": "eq",
"v": "Office",
"vt": "str"
},
{
"t": "eq",
"v": "Guestroom",
"vt": "str"
},
{
"t": "eq",
"v": "Livingroom",
"vt": "str"
},
{
"t": "eq",
"v": "Garage",
"vt": "str"
},
{
"t": "eq",
"v": "Kitchen",
"vt": "str"
},
{
"t": "eq",
"v": "Bedroom",
"vt": "str"
},
{
"t": "eq",
"v": "Diningroom",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 9,
"x": 1350,
"y": 2200,
"wires": [
[
"da215203e10a3ba9"
],
[
"cde8332fe9e9a0ed"
],
[
"5fb0abe490698c86"
],
[
"e2ef925c0f077f45"
],
[
"246723a354fce217"
],
[
"f35dfc17d0f219af"
],
[
"a6dd67e8438f9367"
],
[
"6bb9b690727f4622"
],
[
"969e7544682f0355"
]
]
},
{
"id": "3db4c25e.151f3e",
"type": "api-current-state",
"z": "",
"name": "Asleep?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "[\"Going to Sleep\", \"Sleeping\", \"Waking Up\"]",
"halt_if_type": "jsonata",
"halt_if_compare": "includes",
"entity_id": "input_select.master_bedroom_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1485,
"y": 2040,
"wires": [
[],
[
"56fe6ed2.bd92b"
]
],
"icon": "font-awesome/fa-moon-o",
"l": false
},
{
"id": "d2af3a42.658f28",
"type": "function",
"z": "",
"name": "Someone",
"func": "// @ts-nocheck\nnewmsg = {};\nnewmsg.payload = { data: { \"option\": \"Someone\"} }; \nreturn newmsg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1760,
"y": 2080,
"wires": [
[
"4b81d4a0.c7368c"
]
]
},
{
"id": "c2f1745c.130678",
"type": "function",
"z": "",
"name": "Someone",
"func": "// @ts-ignore\nnewmsg = {};\nnewmsg.payload = { data: { \"option\": \"Someone\"} }; \nreturn newmsg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1760,
"y": 2040,
"wires": [
[
"8a3a253c.e62288"
]
]
},
{
"id": "fd054dda.b9126",
"type": "api-current-state",
"z": "",
"name": "Empty?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Empty",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_select.familyroom_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1600,
"y": 2080,
"wires": [
[
"d2af3a42.658f28"
],
[]
]
},
{
"id": "56fe6ed2.bd92b",
"type": "api-current-state",
"z": "",
"name": "Empty?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Empty",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_select.master_bedroom_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1600,
"y": 2040,
"wires": [
[
"c2f1745c.130678"
],
[]
]
},
{
"id": "4b81d4a0.c7368c",
"type": "link out",
"z": "",
"name": "",
"links": [
"10a4c1c.ab5cf3e",
"e2abdf2e.3d15d"
],
"x": 1865,
"y": 2080,
"wires": []
},
{
"id": "8a3a253c.e62288",
"type": "link out",
"z": "",
"name": "",
"mode": "link",
"links": [
"3eb9debc.bc3e82",
"e3687c81.8fcca"
],
"x": 1865,
"y": 2040,
"wires": []
},
{
"id": "db9d5a44.a743f8",
"type": "comment",
"z": "",
"name": "Set Master Bedroom Presence",
"info": "",
"x": 2030,
"y": 2040,
"wires": []
},
{
"id": "e8dd2e55.f44d5",
"type": "comment",
"z": "",
"name": "Set Familyroom Presence",
"info": "",
"x": 2010,
"y": 2080,
"wires": []
},
{
"id": "cf96b447.a3c558",
"type": "trigger",
"z": "",
"name": "15s",
"op1": "",
"op2": "",
"op1type": "nul",
"op2type": "payl",
"duration": "15",
"extend": true,
"units": "s",
"reset": "stop",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 830,
"y": 2620,
"wires": [
[
"0d56e1af67cbd234"
]
]
},
{
"id": "aaf1e470.b1aac8",
"type": "function",
"z": "",
"name": "Empty",
"func": "// @ts-nocheck\nnewmsg = {};\nnewmsg.payload = { data: { \"option\": \"Empty\"} }; \nreturn newmsg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1430,
"y": 2620,
"wires": [
[
"f4c6f48e.0105a8"
]
]
},
{
"id": "99ba15fa.213488",
"type": "api-current-state",
"z": "",
"name": "FamilyroomSomeone?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Someone",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_select.familyroom_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 600,
"y": 2620,
"wires": [
[
"cf96b447.a3c558"
],
[]
]
},
{
"id": "a0011126.f5f14",
"type": "trigger-state",
"z": "",
"name": "Familyroom !Someone",
"server": "",
"version": 5,
"inputs": 0,
"outputs": 2,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"input_select.livingroom_presence"
],
"substring": [],
"regex": []
},
"debugEnabled": false,
"constraints": [
{
"targetType": "this_entity",
"targetValue": "",
"propertyType": "current_state",
"propertyValue": "new_state.state",
"comparatorType": "is_not",
"comparatorValueDatatype": "str",
"comparatorValue": "Someone"
}
],
"customOutputs": [],
"outputInitially": true,
"stateType": "str",
"enableInput": false,
"exposeToHomeAssistant": false,
"haConfig": [
{
"property": "name",
"value": ""
},
{
"property": "icon",
"value": ""
}
],
"x": 600,
"y": 2660,
"wires": [
[
"5752fede.7c7ae"
],
[]
]
},
{
"id": "5752fede.7c7ae",
"type": "change",
"z": "",
"name": "RESET",
"rules": [
{
"t": "set",
"p": "reset",
"pt": "msg",
"to": "true",
"tot": "bool"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "stop",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 745,
"y": 2660,
"wires": [
[
"cf96b447.a3c558"
]
],
"icon": "node-red/timer.svg",
"l": false
},
{
"id": "cdb2754a.684238",
"type": "api-current-state",
"z": "",
"name": "Cont.?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "on",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_boolean.automations_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 455,
"y": 2620,
"wires": [
[
"99ba15fa.213488"
],
[]
],
"icon": "font-awesome/fa-question",
"l": false
},
{
"id": "78c26be3.5c9c24",
"type": "api-current-state",
"z": "",
"name": "Master Someone?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Someone",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_select.master_bedroom_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 590,
"y": 2500,
"wires": [
[
"b63673c.eb69c9"
],
[]
]
},
{
"id": "b63673c.eb69c9",
"type": "trigger",
"z": "",
"name": "15s",
"op1": "",
"op2": "",
"op1type": "nul",
"op2type": "payl",
"duration": "15",
"extend": true,
"overrideDelay": false,
"units": "s",
"reset": "",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 810,
"y": 2500,
"wires": [
[
"a59f2df4.4348a"
]
]
},
{
"id": "7492e8.aadb3d18",
"type": "api-current-state",
"z": "",
"name": "Cont.?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "on",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_boolean.automations_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 455,
"y": 2500,
"wires": [
[
"78c26be3.5c9c24"
],
[]
],
"icon": "font-awesome/fa-question",
"l": false
},
{
"id": "1f3586b9.205109",
"type": "change",
"z": "",
"name": "RESET",
"rules": [
{
"t": "set",
"p": "reset",
"pt": "msg",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 725,
"y": 2540,
"wires": [
[
"b63673c.eb69c9"
]
],
"icon": "node-red/timer.svg",
"l": false
},
{
"id": "a59f2df4.4348a",
"type": "api-current-state",
"z": "",
"name": "Asleep?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "[\"Going to Sleep\", \"Sleeping\", \"Waking Up\"]",
"halt_if_type": "jsonata",
"halt_if_compare": "includes",
"entity_id": "input_select.bedroom_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 915,
"y": 2500,
"wires": [
[],
[
"d7670ed8.a1389"
]
],
"icon": "font-awesome/fa-moon-o",
"l": false
},
{
"id": "d6edeed8.b743e",
"type": "trigger-state",
"z": "",
"name": "Master !Someone",
"server": "",
"version": 5,
"inputs": 0,
"outputs": 2,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"input_select.master_bedroom_presence"
],
"substring": [],
"regex": []
},
"debugEnabled": false,
"constraints": [
{
"targetType": "this_entity",
"targetValue": "",
"propertyType": "current_state",
"propertyValue": "new_state.state",
"comparatorType": "is_not",
"comparatorValueDatatype": "str",
"comparatorValue": "Someone"
}
],
"customOutputs": [],
"outputInitially": true,
"stateType": "str",
"enableInput": false,
"exposeToHomeAssistant": false,
"haConfig": [
{
"property": "name",
"value": ""
},
{
"property": "icon",
"value": ""
}
],
"x": 590,
"y": 2540,
"wires": [
[
"1f3586b9.205109"
],
[]
]
},
{
"id": "ba04c593.327998",
"type": "comment",
"z": "",
"name": "Reset",
"info": "This yellow timer node resets the timer that it's linked too. In this case, no message will be passed through.\n\nIt's useful in cases where something is scheduled but should no longer happen. ie. the Bedroom is about to be set to \"Empty\" but then there is new motion in there.",
"x": 790,
"y": 2580,
"wires": []
},
{
"id": "d7670ed8.a1389",
"type": "api-current-state",
"z": "",
"name": "person1 in Bed?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "on",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "binary_sensor.bed_presence_person1",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 985,
"y": 2500,
"wires": [
[
"17e285d.4f75e7a"
],
[
"2ae4a631.8ae67a"
]
],
"icon": "font-awesome/fa-bed",
"l": false
},
{
"id": "2ae4a631.8ae67a",
"type": "api-current-state",
"z": "",
"name": "person2 in Bed?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "on",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "binary_sensor.bed_presence_person2",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1055,
"y": 2500,
"wires": [
[
"80a36898.c0d558"
],
[
"bb96eaab49174dc7"
]
],
"icon": "font-awesome/fa-bed",
"l": false
},
{
"id": "de2e2047.7dbea",
"type": "function",
"z": "",
"name": "Empty",
"func": "// @ts-ignore\nnewmsg = {};\nnewmsg.payload = { data: { \"option\": \"Empty\"} }; \nreturn newmsg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1430,
"y": 2500,
"wires": [
[
"9e4bad54.76f89"
]
]
},
{
"id": "8afc3ce7.b5a0c",
"type": "link in",
"z": "",
"name": "Master Bedroom Motion Reset",
"links": [
"17e285d.4f75e7a",
"4568a6ef.0c68b8",
"80a36898.c0d558",
"c397f16031290c49"
],
"x": 395,
"y": 2500,
"wires": [
[
"7492e8.aadb3d18"
]
]
},
{
"id": "e9b8aff7.2651f",
"type": "link in",
"z": "",
"name": "Familyroom Motion Reset",
"links": [
"3a4622e7.23d09e",
"e1ab5bf75161d74d",
"85ccf169ad5d820a"
],
"x": 395,
"y": 2620,
"wires": [
[
"cdb2754a.684238"
]
]
},
{
"id": "3eb9debc.bc3e82",
"type": "link in",
"z": "",
"name": "Reset Master Bedroom to Empty Timer",
"links": [
"8a3a253c.e62288",
"a423cbf9.f121d8"
],
"x": 665,
"y": 2580,
"wires": [
[
"1f3586b9.205109"
]
]
},
{
"id": "e2abdf2e.3d15d",
"type": "link in",
"z": "",
"name": "Reset Familyroom to Empty Timer",
"links": [
"4b81d4a0.c7368c",
"c01abdb.896b44"
],
"x": 685,
"y": 2700,
"wires": [
[
"5752fede.7c7ae"
]
]
},
{
"id": "17e285d.4f75e7a",
"type": "link out",
"z": "",
"name": "",
"links": [
"8afc3ce7.b5a0c"
],
"x": 1035,
"y": 2460,
"wires": []
},
{
"id": "80a36898.c0d558",
"type": "link out",
"z": "",
"name": "",
"mode": "link",
"links": [
"8afc3ce7.b5a0c"
],
"x": 1105,
"y": 2460,
"wires": []
},
{
"id": "9e4bad54.76f89",
"type": "link out",
"z": "",
"name": "",
"links": [
"e3687c81.8fcca"
],
"x": 1495,
"y": 2500,
"wires": []
},
{
"id": "f4c6f48e.0105a8",
"type": "link out",
"z": "",
"name": "",
"links": [
"10a4c1c.ab5cf3e"
],
"x": 1495,
"y": 2620,
"wires": []
},
{
"id": "6691f5be.da2f3c",
"type": "comment",
"z": "",
"name": "3 - BLE ROOM PRESENCE",
"info": "",
"x": 140,
"y": 3580,
"wires": []
},
{
"id": "7392c782.985d88",
"type": "server-state-changed",
"z": "",
"name": "person1 BLE Room",
"server": "",
"version": 6,
"outputs": 2,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"sensor.person1_room_presence"
],
"substring": [],
"regex": []
},
"outputInitially": true,
"stateType": "str",
"ifState": "not_home",
"ifStateType": "str",
"ifStateOperator": "is_not",
"outputOnlyOnStateChange": false,
"for": "0",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": false,
"ignoreCurrentStateUnavailable": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
},
{
"property": "id",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 160,
"y": 3740,
"wires": [
[
"bd0de279.2c72c"
],
[]
]
},
{
"id": "28a0ed5d.98a582",
"type": "link in",
"z": "",
"name": "BLE Room Check",
"links": [
"7261551f.c1283c"
],
"x": 55,
"y": 4220,
"wires": [
[
"c9811790.d9fd08"
]
]
},
{
"id": "7261551f.c1283c",
"type": "link out",
"z": "",
"name": "",
"mode": "link",
"links": [
"28a0ed5d.98a582"
],
"x": 1855,
"y": 3720,
"wires": []
},
{
"id": "7bae33f6.55dd7c",
"type": "function",
"z": "",
"name": "Set Room",
"func": "// @ts-nocheck\nnewmsg = {};\nconst person_location_entity = msg.person_location_data.entity_id;\nconst new_room_to_set = msg.new_room_to_set;\nnewmsg.payload = { data: {\"entity_id\": person_location_entity, \"option\": new_room_to_set} }; \nreturn newmsg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1900,
"y": 4220,
"wires": [
[
"59b500cc.29b7b"
]
]
},
{
"id": "5e8bcad.dfff434",
"type": "change",
"z": "",
"name": "Set Office",
"rules": [
{
"t": "set",
"p": "new_room_to_set",
"pt": "msg",
"to": "Office",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1520,
"y": 4060,
"wires": [
[
"bd650b2bca262b3d",
"aa2231a1c037ce5d"
]
]
},
{
"id": "537c8f7.ddb947",
"type": "change",
"z": "",
"name": "Set Familyroom",
"rules": [
{
"t": "set",
"p": "new_room_to_set",
"pt": "msg",
"to": "Familyroom",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1540,
"y": 3980,
"wires": [
[
"4fd4c7653c3a28de",
"62a33dace70a8db3"
]
]
},
{
"id": "4f424c9f.eb2f04",
"type": "change",
"z": "",
"name": "Set Master Bedroom",
"rules": [
{
"t": "set",
"p": "new_room_to_set",
"pt": "msg",
"to": "Master Bedroom",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1560,
"y": 3900,
"wires": [
[
"068d61e20e34d405",
"236cae4884eaafd1"
]
]
},
{
"id": "b98af048.ea84e",
"type": "switch",
"z": "",
"name": "Familyroom Motion event <2min ago?",
"property": "familyroom_motion_data.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "lte",
"v": "120000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 970,
"y": 3980,
"wires": [
[
"19471f1044f548b1"
],
[
"49816e8d.16afb"
]
]
},
{
"id": "49816e8d.16afb",
"type": "switch",
"z": "",
"name": "BLE Same for >2min?",
"property": "ble_room_data.new_state.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "gte",
"v": "120000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 1280,
"y": 4020,
"wires": [
[
"3cbeb32ae128a58b"
],
[
"fabfa00fc4279c25"
]
]
},
{
"id": "a7b720af.d1d5d",
"type": "switch",
"z": "",
"name": "Master Motion event <2min ago?",
"property": "master_motion_data.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "lte",
"v": "120000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 960,
"y": 3900,
"wires": [
[
"93469d5aef55b158"
],
[
"ed70426f.cc86f"
]
]
},
{
"id": "ed70426f.cc86f",
"type": "switch",
"z": "",
"name": "BLE Same for >2min?",
"property": "ble_room_data.new_state.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "gte",
"v": "120000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 1280,
"y": 3940,
"wires": [
[
"e8a67a90f912bb23"
],
[
"d3961d8a5d9b15a7"
]
]
},
{
"id": "5a25b30e.20e30c",
"type": "switch",
"z": "",
"name": "!In Bed?",
"property": "bed_presence",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "off/not automated",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 775,
"y": 3980,
"wires": [
[
"b98af048.ea84e"
],
[
"82247a947d27557d"
]
],
"icon": "font-awesome/fa-bed",
"l": false
},
{
"id": "b6cc8954.dbec48",
"type": "switch",
"z": "",
"name": "Master !Set?",
"property": "person_location",
"propertyType": "msg",
"rules": [
{
"t": "neq",
"v": "Master Bedroom",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 410,
"y": 3900,
"wires": [
[
"3e9c06510dd2bb6c"
]
]
},
{
"id": "60da4519.0537ec",
"type": "switch",
"z": "",
"name": "!In Bed?",
"property": "bed_presence",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "off/not automated",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 775,
"y": 4060,
"wires": [
[
"596e144e2c2c29c0"
],
[
"c12009828276ba33"
]
],
"icon": "font-awesome/fa-bed",
"l": false
},
{
"id": "610aed6e.d78974",
"type": "switch",
"z": "",
"name": "Familyroom!Set?",
"property": "person_location",
"propertyType": "msg",
"rules": [
{
"t": "neq",
"v": "Familyroom",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 430,
"y": 3980,
"wires": [
[
"2b2d24243c57bff2"
]
]
},
{
"id": "c9811790.d9fd08",
"type": "switch",
"z": "",
"name": "BLE Room?",
"property": "ble_room",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "master",
"vt": "str"
},
{
"t": "eq",
"v": "familyroom",
"vt": "str"
},
{
"t": "eq",
"v": "office",
"vt": "str"
},
{
"t": "eq",
"v": "guestroom",
"vt": "str"
},
{
"t": "eq",
"v": "livingroom",
"vt": "str"
},
{
"t": "eq",
"v": "garage",
"vt": "str"
},
{
"t": "eq",
"v": "kitchen",
"vt": "str"
},
{
"t": "eq",
"v": "bedroom",
"vt": "str"
},
{
"t": "eq",
"v": "diningroom",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 9,
"x": 170,
"y": 4220,
"wires": [
[
"b6cc8954.dbec48"
],
[
"610aed6e.d78974"
],
[
"232b9b18.1d3f94"
],
[
"a46bbef4.19bc6"
],
[
"9daf247115edf7c2"
],
[
"cee9477c6d93df67"
],
[
"56f99bda7a717a16"
],
[
"90e869a1efb3a898"
],
[
"7642c5a95a6e9c9b"
]
]
},
{
"id": "232b9b18.1d3f94",
"type": "switch",
"z": "",
"name": "Office !Set?",
"property": "person_location",
"propertyType": "msg",
"rules": [
{
"t": "neq",
"v": "Office",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 410,
"y": 4060,
"wires": [
[
"355501a58a94be7a"
]
]
},
{
"id": "b81476a5.c50a78",
"type": "function",
"z": "",
"name": "Bed Presence",
"func": "// @ts-nocheck\nconst globalHomeAssistant = global.get('homeassistant');\nconst ha = globalHomeAssistant.homeAssistant; //Generic bits to get HA states\nperson = msg.person; //Create constant for the relevant person\nbed_presence_entity = \"binary_sensor.bed_presence_\" + person; //Create string for the bed presence of the relevant person\nbed_presence_state = ha.states[bed_presence_entity].state; //Get Bed Presence State for the relevant person\n\nconst automate_bed_presence = ha.states['input_boolean.automations_presence_bed'].state; //Check if bed presence automations are on\n\nlet bed_presence = [];\n\nif (automate_bed_presence == 'on') {\n if (bed_presence_state == 'on') {\n bed_presence = \"on\";\n } else {\n bed_presence = \"off/not automated\";\n }\n}\nelse {\n bed_presence = \"off/not automated\";\n}\n\nmsg.bed_presence = bed_presence;\nreturn msg;\n\n//This code sets msg.bed_presence to either on or off/not automated\n//It sets to on if bed presence automations are on and bed presence is detected.\n//Otherwise it sets it to off/not automated",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1540,
"y": 3740,
"wires": [
[
"7323cc0b69ee472f"
]
]
},
{
"id": "fd3314cc.1c3678",
"type": "api-current-state",
"z": "",
"name": "Person Loc?",
"server": "",
"version": 3,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_select.{{person}}",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "person_location",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "person_location_data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1405,
"y": 3760,
"wires": [
[
"b81476a5.c50a78"
]
],
"icon": "font-awesome/fa-location-arrow",
"l": false
},
{
"id": "254288f.e47c678",
"type": "api-current-state",
"z": "",
"name": "Familyroom Motion?",
"server": "",
"version": 3,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "binary_sensor.familyroom_motion",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "familyroom_motion",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "familyroom_motion_data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 925,
"y": 3760,
"wires": [
[
"3e3373b0b64fddd3"
]
],
"icon": "font-awesome/fa-child",
"l": false
},
{
"id": "f44a6616.660158",
"type": "api-current-state",
"z": "",
"name": "Master Motion?",
"server": "",
"version": 3,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "binary_sensor.master_all_motion",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "master_motion",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "master_motion_data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 865,
"y": 3720,
"wires": [
[
"254288f.e47c678"
]
],
"icon": "font-awesome/fa-child",
"l": false
},
{
"id": "c2c49e69.f292e",
"type": "api-current-state",
"z": "",
"name": "Cont.?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "on",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_boolean.automations_presence_ble",
"state_type": "str",
"blockInputOverrides": true,
"outputProperties": [],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 565,
"y": 3760,
"wires": [
[
"0ed857ebc9690161"
],
[]
],
"icon": "font-awesome/fa-question",
"l": false
},
{
"id": "43bdfceb.2281c4",
"type": "change",
"z": "",
"name": "Save BLE Room",
"rules": [
{
"t": "move",
"p": "payload",
"pt": "msg",
"to": "ble_room",
"tot": "msg"
},
{
"t": "move",
"p": "data",
"pt": "msg",
"to": "ble_room_data",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 430,
"y": 3740,
"wires": [
[
"c2c49e69.f292e"
]
]
},
{
"id": "bd0de279.2c72c",
"type": "change",
"z": "",
"name": "Change",
"rules": [
{
"t": "change",
"p": "topic",
"pt": "msg",
"from": "sensor.",
"fromt": "str",
"to": "",
"tot": "str"
},
{
"t": "change",
"p": "topic",
"pt": "msg",
"from": "_room_presence",
"fromt": "str",
"to": "",
"tot": "str"
},
{
"t": "set",
"p": "person",
"pt": "msg",
"to": "topic",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 295,
"y": 3740,
"wires": [
[
"43bdfceb.2281c4"
]
],
"l": false
},
{
"id": "4ec0fb61.927404",
"type": "server-state-changed",
"z": "",
"name": "person2 BLE Room",
"server": "",
"version": 6,
"outputs": 2,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"sensor.person2_room_presence"
],
"substring": [],
"regex": []
},
"outputInitially": true,
"stateType": "str",
"ifState": "not_home",
"ifStateType": "str",
"ifStateOperator": "is_not",
"outputOnlyOnStateChange": false,
"for": "0",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": false,
"ignoreCurrentStateUnavailable": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
},
{
"property": "id",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 150,
"y": 3700,
"wires": [
[
"bd0de279.2c72c"
],
[]
]
},
{
"id": "59b500cc.29b7b",
"type": "link out",
"z": "",
"name": "",
"links": [
"fd252457.e41e18"
],
"x": 2005,
"y": 4220,
"wires": []
},
{
"id": "43c7cf59.f26c2",
"type": "comment",
"z": "",
"name": "4 - UPDATE ROOM PRESENCE",
"info": "This flow is triggered by a change in a person's \"input_select.person_location\".\nIt can also be manually triggered via the link node.",
"x": 150,
"y": 4680,
"wires": []
},
{
"id": "15da28bf.4f5ec7",
"type": "server-state-changed",
"z": "",
"name": "person1 Loc Change?",
"server": "",
"version": 6,
"outputs": 1,
"exposeAsEntityConfig": "",
"entities": {
"entity": [],
"substring": [
"input_select.person1"
],
"regex": []
},
"outputInitially": false,
"stateType": "str",
"ifState": "",
"ifStateType": "str",
"ifStateOperator": "is",
"outputOnlyOnStateChange": true,
"for": "0",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": false,
"ignoreCurrentStateUnavailable": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 180,
"y": 5040,
"wires": [
[
"a9262368.89267",
"bf1f90c95c279c26"
]
]
},
{
"id": "8e52304.29c7ad",
"type": "server-state-changed",
"z": "",
"name": "person2 Loc Change?",
"server": "",
"version": 6,
"outputs": 1,
"exposeAsEntityConfig": "",
"entities": {
"entity": [],
"substring": [
"input_select.person2"
],
"regex": []
},
"outputInitially": false,
"stateType": "str",
"ifState": "",
"ifStateType": "str",
"ifStateOperator": "is",
"outputOnlyOnStateChange": true,
"for": "0",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": false,
"ignoreCurrentStateUnavailable": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 160,
"y": 5120,
"wires": [
[
"a9262368.89267",
"bf1f90c95c279c26"
]
]
},
{
"id": "a9262368.89267",
"type": "api-current-state",
"z": "",
"name": "Cont.?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "on",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_boolean.automations_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 325,
"y": 5080,
"wires": [
[
"ec94f9406b23ed17",
"babd46949b230f02",
"2fe748f74ba00212",
"05bc6dd84c63e9d6",
"29ce960dfb04fe6b",
"03973b7a37078dfe",
"6eb976513a3f13ee",
"5b37faf91a9f3556",
"3e333068428ed6ee"
],
[]
],
"icon": "font-awesome/fa-question",
"l": false
},
{
"id": "ca108cd7.dda85",
"type": "api-current-state",
"z": "",
"name": "Sleeping?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "[\"Going to Sleep\", \"Sleeping\", \"Waking Up\"]",
"halt_if_type": "jsonata",
"halt_if_compare": "includes",
"entity_id": "input_select.master_bedroom_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 455,
"y": 4760,
"wires": [
[],
[
"52a787fe.4bac18"
]
],
"icon": "font-awesome/fa-moon-o",
"l": false
},
{
"id": "330c7ee0.eaf012",
"type": "change",
"z": "",
"name": "RESET",
"rules": [
{
"t": "set",
"p": "reset",
"pt": "msg",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 925,
"y": 4980,
"wires": [
[
"47735677.e75c98",
"9e53d751.aaa578"
]
],
"icon": "node-red/timer.svg",
"l": false
},
{
"id": "47735677.e75c98",
"type": "trigger",
"z": "",
"name": "",
"op1": "",
"op2": "",
"op1type": "nul",
"op2type": "payl",
"duration": "15",
"extend": true,
"overrideDelay": false,
"units": "s",
"reset": "stop",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 995,
"y": 5000,
"wires": [
[
"9e53d751.aaa578"
]
],
"l": false
},
{
"id": "bb14cf9f.1ca57",
"type": "api-current-state",
"z": "",
"name": "Guestroom !Empty?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Empty",
"halt_if_type": "str",
"halt_if_compare": "is_not",
"entity_id": "input_select.guestroom_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 840,
"y": 5020,
"wires": [
[
"47735677.e75c98"
],
[]
]
},
{
"id": "86ab9e9.125176",
"type": "change",
"z": "",
"name": "RESET",
"rules": [
{
"t": "set",
"p": "reset",
"pt": "msg",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 925,
"y": 4740,
"wires": [
[
"2da4093e.86a9d6",
"60a292a2.a604fc"
]
],
"icon": "node-red/timer.svg",
"l": false
},
{
"id": "2da4093e.86a9d6",
"type": "trigger",
"z": "",
"name": "",
"op1": "",
"op2": "",
"op1type": "nul",
"op2type": "payl",
"duration": "15",
"extend": true,
"overrideDelay": false,
"units": "s",
"reset": "stop",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 995,
"y": 4760,
"wires": [
[
"60a292a2.a604fc"
]
],
"l": false
},
{
"id": "ed53d591.4d9b78",
"type": "api-current-state",
"z": "",
"name": "Master !Empty?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Empty",
"halt_if_type": "str",
"halt_if_compare": "is_not",
"entity_id": "input_select.master_bedroom_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 860,
"y": 4780,
"wires": [
[
"2da4093e.86a9d6"
],
[]
]
},
{
"id": "c00e2c02.3313a",
"type": "change",
"z": "",
"name": "RESET",
"rules": [
{
"t": "set",
"p": "reset",
"pt": "msg",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 925,
"y": 4820,
"wires": [
[
"f49ce45.18f8c18",
"56552240.11affc"
]
],
"icon": "node-red/timer.svg",
"l": false
},
{
"id": "f49ce45.18f8c18",
"type": "trigger",
"z": "",
"name": "",
"op1": "",
"op2": "",
"op1type": "nul",
"op2type": "payl",
"duration": "15",
"extend": true,
"overrideDelay": false,
"units": "s",
"reset": "stop",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 995,
"y": 4840,
"wires": [
[
"56552240.11affc"
]
],
"l": false
},
{
"id": "b36df4f8.a17438",
"type": "api-current-state",
"z": "",
"name": "Familyroom !Empty?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Empty",
"halt_if_type": "str",
"halt_if_compare": "is_not",
"entity_id": "input_select.familyroom_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 840,
"y": 4860,
"wires": [
[
"f49ce45.18f8c18"
],
[]
]
},
{
"id": "56552240.11affc",
"type": "link out",
"z": "",
"name": "",
"links": [
"10a4c1c.ab5cf3e"
],
"x": 1055,
"y": 4820,
"wires": []
},
{
"id": "60a292a2.a604fc",
"type": "link out",
"z": "",
"name": "",
"links": [
"e3687c81.8fcca"
],
"x": 1055,
"y": 4740,
"wires": []
},
{
"id": "9e53d751.aaa578",
"type": "link out",
"z": "",
"name": "",
"mode": "link",
"links": [
"1c1603fd.cc6ecc"
],
"x": 1055,
"y": 4980,
"wires": []
},
{
"id": "d65ddba8.4b6fb8",
"type": "delay",
"z": "",
"name": "5s",
"pauseType": "delay",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"outputs": 1,
"x": 340,
"y": 40,
"wires": [
[
"b498cf4.23e743"
]
]
},
{
"id": "dce85a3.a67fba8",
"type": "comment",
"z": "",
"name": "Frequently Used Nodes",
"info": "These nodes are gathered in one place so it's easy to tell which flows can set what.",
"x": 120,
"y": 100,
"wires": []
},
{
"id": "a383cd87.f4542",
"type": "comment",
"z": "",
"name": "2.3 - Set rooms to \"Empty\"",
"info": "",
"x": 170,
"y": 2440,
"wires": []
},
{
"id": "591f0ead.f8624",
"type": "comment",
"z": "",
"name": "Master Occupied",
"info": "",
"x": 440,
"y": 1380,
"wires": []
},
{
"id": "26bc9b59.512064",
"type": "comment",
"z": "",
"name": "Master Not Occupied",
"info": "",
"x": 460,
"y": 1420,
"wires": []
},
{
"id": "4f7476a7.483328",
"type": "comment",
"z": "",
"name": "Familyroom Occupied",
"info": "",
"x": 460,
"y": 1480,
"wires": []
},
{
"id": "70d28de.84d6774",
"type": "comment",
"z": "",
"name": "Familyroom Not Occupied",
"info": "",
"x": 470,
"y": 1520,
"wires": []
},
{
"id": "efdece28.f700b",
"type": "change",
"z": "",
"name": "Master",
"rules": [
{
"t": "set",
"p": "room",
"pt": "msg",
"to": "Master Bedroom",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 470,
"y": 1860,
"wires": [
[
"7b4f2a2.719dfd4"
]
]
},
{
"id": "250e07c2.e9d0b8",
"type": "change",
"z": "",
"name": "Familyroom",
"rules": [
{
"t": "set",
"p": "room",
"pt": "msg",
"to": "Familyroom",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 450,
"y": 1900,
"wires": [
[
"7b4f2a2.719dfd4"
]
]
},
{
"id": "51912916.f2e538",
"type": "comment",
"z": "",
"name": "Set House Presence",
"info": "",
"x": 1730,
"y": 1140,
"wires": []
},
{
"id": "d290338.cb58dd",
"type": "comment",
"z": "",
"name": "Set House Presence",
"info": "",
"x": 770,
"y": 1140,
"wires": []
},
{
"id": "cf90f23b.770d2",
"type": "comment",
"z": "",
"name": "person1 Loc.",
"info": "",
"x": 660,
"y": 640,
"wires": []
},
{
"id": "cf985db6.ceae",
"type": "comment",
"z": "",
"name": "person2 Loc.",
"info": "",
"x": 670,
"y": 680,
"wires": []
},
{
"id": "c4121ec2.a5877",
"type": "comment",
"z": "",
"name": "Set Master Bedroom Presence",
"info": "",
"x": 1670,
"y": 2500,
"wires": []
},
{
"id": "ea147be4.b465c8",
"type": "comment",
"z": "",
"name": "Set Familyroom Presence",
"info": "",
"x": 1650,
"y": 2620,
"wires": []
},
{
"id": "80720b5d.688078",
"type": "comment",
"z": "",
"name": "Set Person Location",
"info": "",
"x": 1930,
"y": 4260,
"wires": []
},
{
"id": "c820bd13.743e9",
"type": "comment",
"z": "",
"name": "Set Master Bedroom Presence",
"info": "",
"x": 1230,
"y": 4740,
"wires": []
},
{
"id": "22c5af76.0e49d",
"type": "comment",
"z": "",
"name": "Set Familyroom Presence",
"info": "",
"x": 1210,
"y": 4820,
"wires": []
},
{
"id": "250cfda0.ae2802",
"type": "comment",
"z": "",
"name": "Set Guestroom Presence",
"info": "",
"x": 1210,
"y": 4980,
"wires": []
},
{
"id": "7697765c.54d968",
"type": "comment",
"z": "",
"name": "3.1 - BLE Inputs and Checking other States",
"info": "",
"x": 220,
"y": 3620,
"wires": []
},
{
"id": "5c96fd8d.f13824",
"type": "comment",
"z": "",
"name": "3.2 - Set Room Presence",
"info": "",
"x": 210,
"y": 3880,
"wires": []
},
{
"id": "53084e82.1e2ec",
"type": "comment",
"z": "",
"name": "Note",
"info": "It's important to leave these as person.p1 rather than input_select.p1_location.\n\nSince the person entity can be slow to update, it's possible that BLE kicks in before person.p1 goes to home so a room would be assigned and input_select.p1_location would never actually go to \"Just Arrived\" or \"Home\"",
"x": 210,
"y": 1140,
"wires": []
},
{
"id": "77c09734.806218",
"type": "comment",
"z": "",
"name": "Note",
"info": "This way of checking is a little lazy but works just fine for only 2 people. I will update this to work for any number of people at some point.",
"x": 1550,
"y": 1060,
"wires": []
},
{
"id": "5974951a.0fb34c",
"type": "comment",
"z": "",
"name": "?",
"info": "A question mark icon indicates a place where a type of automation can be stopped.\n\nIn this case, this flow to set room presence will only continue if input_select.automations_presence is set to on.\n\nThis makes it easy to stop certain types of automations from the frontend.",
"x": 830,
"y": 1940,
"wires": []
},
{
"id": "b0aa2b63.12d828",
"type": "comment",
"z": "",
"name": "Reset",
"info": "This yellow timer node resets the timer that it's linked too. In this case, no message will be passed through.\n\nIt's useful in cases where something is scheduled but should no longer happen. ie. the Bedroom is about to be set to \"Empty\" but then there is new motion in there.",
"x": 810,
"y": 2700,
"wires": []
},
{
"id": "fdfefdac.8da85",
"type": "api-call-service",
"z": "",
"name": "Set Office Pres.",
"server": "",
"version": 7,
"debugenabled": false,
"action": "input_select.select_option",
"floorId": [],
"areaId": [],
"deviceId": [],
"entityId": [
"input_select.office_presence"
],
"labelId": [],
"data": "",
"dataType": "json",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "data"
}
],
"queue": "none",
"blockInputOverrides": false,
"domain": "input_select",
"service": "select_option",
"output_location": "payload",
"output_location_type": "msg",
"x": 260,
"y": 240,
"wires": [
[]
]
},
{
"id": "672ab118.a0163",
"type": "link in",
"z": "",
"name": "Set Office Presence",
"links": [
"2f491c9b.5b2c14",
"b495f7b1.ea9d28",
"cff9e673.4738a8"
],
"x": 135,
"y": 240,
"wires": [
[
"fdfefdac.8da85"
]
]
},
{
"id": "e1032116.6609a",
"type": "link out",
"z": "",
"name": "Office Motion",
"mode": "link",
"links": [
"236a8c51.3f86f4",
"6bc52e41.3bf86",
"b9cef4ba.95ca38"
],
"x": 315,
"y": 1580,
"wires": []
},
{
"id": "236a8c51.3f86f4",
"type": "link in",
"z": "",
"name": "",
"links": [
"e1032116.6609a"
],
"x": 635,
"y": 1580,
"wires": [
[
"7f8e472d.143b48"
]
]
},
{
"id": "2b9ebdd4.c34492",
"type": "comment",
"z": "",
"name": "Office Occupied",
"info": "",
"x": 440,
"y": 1580,
"wires": []
},
{
"id": "a9cc10a8.e760a",
"type": "comment",
"z": "",
"name": "Office Not Occupied",
"info": "",
"x": 450,
"y": 1620,
"wires": []
},
{
"id": "348a1cb2.6a0394",
"type": "link out",
"z": "",
"name": "Office Motion Cleared",
"mode": "link",
"links": [
"24c9957a.2171ea",
"9db72a58.bc21d8"
],
"x": 315,
"y": 1620,
"wires": []
},
{
"id": "24c9957a.2171ea",
"type": "link in",
"z": "",
"name": "",
"links": [
"348a1cb2.6a0394"
],
"x": 635,
"y": 1620,
"wires": [
[
"93e75be.09ef8a8"
]
]
},
{
"id": "3ef9905e.3529e",
"type": "change",
"z": "",
"name": "Office",
"rules": [
{
"t": "set",
"p": "room",
"pt": "msg",
"to": "Office",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 470,
"y": 1940,
"wires": [
[
"7b4f2a2.719dfd4"
]
]
},
{
"id": "b9cef4ba.95ca38",
"type": "link in",
"z": "",
"name": "",
"links": [
"e1032116.6609a"
],
"x": 325,
"y": 1940,
"wires": [
[
"3ef9905e.3529e"
]
]
},
{
"id": "2ce982aa.6a1a3e",
"type": "server-state-changed",
"z": "",
"name": "person1 in Bed",
"server": "",
"version": 6,
"outputs": 2,
"exposeAsEntityConfig": "",
"entities": {
"entity": [],
"substring": [],
"regex": [
"binary_sensor.bed_presence_person1"
]
},
"outputInitially": false,
"stateType": "str",
"ifState": "on",
"ifStateType": "str",
"ifStateOperator": "is",
"outputOnlyOnStateChange": true,
"for": "0",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": true,
"ignoreCurrentStateUnavailable": true,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 200,
"y": 1320,
"wires": [
[
"a423cbf9.f121d8"
],
[]
]
},
{
"id": "fc7f48f6.4c7178",
"type": "server-state-changed",
"z": "",
"name": "person2 in Bed",
"server": "",
"version": 6,
"outputs": 2,
"exposeAsEntityConfig": "",
"entities": {
"entity": [],
"substring": [],
"regex": [
"binary_sensor.bed_presence_person2"
]
},
"outputInitially": false,
"stateType": "str",
"ifState": "on",
"ifStateType": "str",
"ifStateOperator": "is",
"outputOnlyOnStateChange": true,
"for": "0",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": true,
"ignoreCurrentStateUnavailable": true,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 190,
"y": 1360,
"wires": [
[
"a423cbf9.f121d8"
],
[]
]
},
{
"id": "fe4b63b2.bd32e",
"type": "trigger",
"z": "",
"name": "15s",
"op1": "",
"op2": "",
"op1type": "nul",
"op2type": "payl",
"duration": "15",
"extend": true,
"overrideDelay": false,
"units": "s",
"reset": "stop",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 810,
"y": 2740,
"wires": [
[
"0591cf386849a9f6"
]
]
},
{
"id": "75ca2147.932f3",
"type": "function",
"z": "",
"name": "Empty",
"func": "newmsg = {};\nnewmsg.payload = { data: { \"option\": \"Empty\"} }; \nreturn newmsg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1430,
"y": 2740,
"wires": [
[
"cff9e673.4738a8"
]
]
},
{
"id": "c6baca9a.b0e098",
"type": "api-current-state",
"z": "",
"name": "Office Someone?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Someone",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_select.office_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 590,
"y": 2740,
"wires": [
[
"fe4b63b2.bd32e"
],
[]
]
},
{
"id": "2d638f3c.f9174",
"type": "trigger-state",
"z": "",
"name": "Office !Someone",
"server": "",
"version": 5,
"inputs": 0,
"outputs": 2,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"input_select.office_presence"
],
"substring": [],
"regex": []
},
"debugEnabled": false,
"constraints": [
{
"targetType": "this_entity",
"targetValue": "",
"propertyType": "current_state",
"propertyValue": "new_state.state",
"comparatorType": "is_not",
"comparatorValueDatatype": "str",
"comparatorValue": "Someone"
}
],
"customOutputs": [],
"outputInitially": true,
"stateType": "str",
"enableInput": false,
"exposeToHomeAssistant": false,
"haConfig": [
{
"property": "name",
"value": ""
},
{
"property": "icon",
"value": ""
}
],
"x": 580,
"y": 2780,
"wires": [
[
"67ba6119.5ee85"
],
[]
]
},
{
"id": "67ba6119.5ee85",
"type": "change",
"z": "",
"name": "RESET",
"rules": [
{
"t": "set",
"p": "reset",
"pt": "msg",
"to": "true",
"tot": "bool"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "stop",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 715,
"y": 2780,
"wires": [
[
"fe4b63b2.bd32e"
]
],
"icon": "node-red/timer.svg",
"l": false
},
{
"id": "d621ff3a.1a46d",
"type": "api-current-state",
"z": "",
"name": "Cont.?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "on",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_boolean.automations_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 455,
"y": 2740,
"wires": [
[
"c6baca9a.b0e098"
],
[]
],
"icon": "font-awesome/fa-question",
"l": false
},
{
"id": "9db72a58.bc21d8",
"type": "link in",
"z": "",
"name": "Office Motion Reset",
"links": [
"348a1cb2.6a0394",
"e010d82ba4bbb374",
"7c56b29c17231cdd",
"4413c1f665a5358a"
],
"x": 395,
"y": 2740,
"wires": [
[
"d621ff3a.1a46d"
]
]
},
{
"id": "6bc52e41.3bf86",
"type": "link in",
"z": "",
"name": "Reset Office to Empty Timer",
"links": [
"2f491c9b.5b2c14",
"e1032116.6609a"
],
"x": 645,
"y": 2820,
"wires": [
[
"67ba6119.5ee85"
]
]
},
{
"id": "cff9e673.4738a8",
"type": "link out",
"z": "",
"name": "",
"mode": "link",
"links": [
"672ab118.a0163"
],
"x": 1495,
"y": 2740,
"wires": []
},
{
"id": "ceed26d5.d48c68",
"type": "comment",
"z": "",
"name": "Set Office Presence",
"info": "",
"x": 1630,
"y": 2740,
"wires": []
},
{
"id": "4fdb469e.4f31b8",
"type": "comment",
"z": "",
"name": "Reset",
"info": "This yellow timer node resets the timer that it's linked too. In this case, no message will be passed through.\n\nIt's useful in cases where something is scheduled but should no longer happen. ie. the Bedroom is about to be set to \"Empty\" but then there is new motion in there.",
"x": 790,
"y": 2820,
"wires": []
},
{
"id": "88612aa4.172a68",
"type": "comment",
"z": "",
"name": "Note",
"info": "Add conditions here that must be satisfied for a room to be set to empty (eg the TV is off) - \nthese conditions should be wired in to restart the timer looking to set the room presence \nto Empty like in the bed presence example above.",
"x": 910,
"y": 2440,
"wires": []
},
{
"id": "efa695eb.c7dbe8",
"type": "api-current-state",
"z": "",
"name": "Empty?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Empty",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_select.office_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1600,
"y": 2120,
"wires": [
[
"8daa82d1.5fa71"
],
[]
]
},
{
"id": "2f491c9b.5b2c14",
"type": "link out",
"z": "",
"name": "",
"mode": "link",
"links": [
"672ab118.a0163",
"6bc52e41.3bf86"
],
"x": 1865,
"y": 2120,
"wires": []
},
{
"id": "b81cc84b.31dd78",
"type": "comment",
"z": "",
"name": "Set Office Presence",
"info": "",
"x": 1990,
"y": 2120,
"wires": []
},
{
"id": "7fe12d4.35459d4",
"type": "change",
"z": "",
"name": "Set Guestroom",
"rules": [
{
"t": "set",
"p": "new_room_to_set",
"pt": "msg",
"to": "Guestroom",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1540,
"y": 4140,
"wires": [
[
"a963e079223eaa0b",
"c86b482b3c28acd9"
]
]
},
{
"id": "fe9d6a1.7be2398",
"type": "switch",
"z": "",
"name": "!In Bed?",
"property": "bed_presence",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "off/not automated",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 775,
"y": 4140,
"wires": [
[
"db91e9d6e4a57df9"
],
[
"7ba493d398bfa7f7"
]
],
"icon": "font-awesome/fa-bed",
"l": false
},
{
"id": "a46bbef4.19bc6",
"type": "switch",
"z": "",
"name": "Guestroom !Set?",
"property": "person_location",
"propertyType": "msg",
"rules": [
{
"t": "neq",
"v": "Guestroom",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 430,
"y": 4140,
"wires": [
[
"e8f1bdd5510ca153"
]
]
},
{
"id": "7ac9cd20.c642b4",
"type": "comment",
"z": "",
"name": "Startup",
"info": "This short section is triggered when Home Assistant restarts. I have an sensor.uptime_h which keeps track of how long Home Assistant has been running.\n\nWhen uptime reaches a certain time, the flows that run on startup are all triggered.",
"x": 60,
"y": 20,
"wires": []
},
{
"id": "3b257310.622a5c",
"type": "comment",
"z": "",
"name": "Master Bedroom Occupied",
"info": "",
"x": 180,
"y": 1860,
"wires": []
},
{
"id": "a8fb7e3d.07aa3",
"type": "comment",
"z": "",
"name": "Familyroom Occupied",
"info": "",
"x": 170,
"y": 1900,
"wires": []
},
{
"id": "56f7238a.fbd7cc",
"type": "comment",
"z": "",
"name": "Office Occupied",
"info": "",
"x": 150,
"y": 1940,
"wires": []
},
{
"id": "82a97cf8.5b668",
"type": "comment",
"z": "",
"name": "Master Not Occupied",
"info": "",
"x": 200,
"y": 2500,
"wires": []
},
{
"id": "83ffab05.7db4e8",
"type": "comment",
"z": "",
"name": "Familyroom Not Occupied",
"info": "",
"x": 210,
"y": 2620,
"wires": []
},
{
"id": "8ae03.bcea41fd8",
"type": "comment",
"z": "",
"name": "Office Not Occupied",
"info": "",
"x": 190,
"y": 2740,
"wires": []
},
{
"id": "7fc6dc30.43cb14",
"type": "change",
"z": "",
"name": "RESET",
"rules": [
{
"t": "set",
"p": "reset",
"pt": "msg",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 925,
"y": 4900,
"wires": [
[
"3568143c.7188ec",
"b495f7b1.ea9d28"
]
],
"icon": "node-red/timer.svg",
"l": false
},
{
"id": "3568143c.7188ec",
"type": "trigger",
"z": "",
"name": "",
"op1": "",
"op2": "",
"op1type": "nul",
"op2type": "payl",
"duration": "15",
"extend": true,
"overrideDelay": false,
"units": "s",
"reset": "stop",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 995,
"y": 4920,
"wires": [
[
"b495f7b1.ea9d28"
]
],
"l": false
},
{
"id": "59324c27.e01084",
"type": "api-current-state",
"z": "",
"name": "Office !Empty?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Empty",
"halt_if_type": "str",
"halt_if_compare": "is_not",
"entity_id": "input_select.office_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 860,
"y": 4940,
"wires": [
[
"3568143c.7188ec"
],
[]
]
},
{
"id": "b495f7b1.ea9d28",
"type": "link out",
"z": "",
"name": "",
"mode": "link",
"links": [
"672ab118.a0163"
],
"x": 1055,
"y": 4900,
"wires": []
},
{
"id": "51be1178.e1fa1",
"type": "comment",
"z": "",
"name": "Set OfficePresence",
"info": "",
"x": 1190,
"y": 4900,
"wires": []
},
{
"id": "2856dd68.802132",
"type": "comment",
"z": "",
"name": "Generic Pres. Considered",
"info": "The bedroom and living room have motion sensors so the function node accounts for those too in the setting of room presence.\n\nA list '+' seperated list of room occupants is created. \n - the room's input_select.*room*_presence is updated with this list of occupants.\n\nIf the list is empty (ie no people are detected in the room by BLE):\n There is a check for motion in the room\n If there is motion:\n - the room's input_select.*room*_presence is set to \"Someone\".\n This is a bit like reverting back to generic room presence (and is helpful in case BLE incorrectly causes someone to move to a difference room briefly).\n - also any timer about to the set the room to \"Empty\" is cancelled.\n If there is no motion:\n - the room's input_select.*room*_presence is set to \"Empty\" after a short delay.\n ",
"x": 230,
"y": 4860,
"wires": []
},
{
"id": "3dce5ee9.3d8262",
"type": "comment",
"z": "",
"name": "Generic Pres. !Considered",
"info": "The bathroom and kitchen do not have motion sensors so the function node doesn't account for motion in the setting of room presence here.\n\nA list '+' seperated list of room occupants is created. \n - the room's input_select.*room*_presence is updated with this list of occupants.\n\nIf the list is empty (ie no people are detected in the room by BLE):\n - the room's input_select.*room*_presence is set to \"Empty\" after a short delay.\n - also any timer about to the set the room to \"Empty\" is cancelled.",
"x": 230,
"y": 5360,
"wires": []
},
{
"id": "cedb48c1.669f18",
"type": "comment",
"z": "",
"name": "15s Delay",
"info": "",
"x": 1000,
"y": 4700,
"wires": []
},
{
"id": "91698b36.9ecf88",
"type": "change",
"z": "",
"name": "Master Generic Presence to TRUE",
"rules": [
{
"t": "set",
"p": "Master_Bedroom_generic_presence",
"pt": "flow",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 820,
"y": 1380,
"wires": [
[]
]
},
{
"id": "cb12eba6.f64b88",
"type": "change",
"z": "",
"name": "Master Generic Presence to FALSE",
"rules": [
{
"t": "set",
"p": "Master_Bedroom_generic_presence",
"pt": "flow",
"to": "false",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 820,
"y": 1420,
"wires": [
[]
]
},
{
"id": "c8009d0c.1c861",
"type": "change",
"z": "",
"name": "Familyroom Generic Presence to TRUE",
"rules": [
{
"t": "set",
"p": "Familyroom_generic_presence",
"pt": "flow",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 840,
"y": 1480,
"wires": [
[]
]
},
{
"id": "7f8e472d.143b48",
"type": "change",
"z": "",
"name": "Office Generic Presence to TRUE",
"rules": [
{
"t": "set",
"p": "Office_generic_presence",
"pt": "flow",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 820,
"y": 1580,
"wires": [
[]
]
},
{
"id": "93e75be.09ef8a8",
"type": "change",
"z": "",
"name": "Office Generic Presence to FALSE",
"rules": [
{
"t": "set",
"p": "Office_generic_presence",
"pt": "flow",
"to": "false",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 820,
"y": 1620,
"wires": [
[]
]
},
{
"id": "a4f57c31.61b97",
"type": "change",
"z": "",
"name": "Familyroom Generic Presence to FALSE",
"rules": [
{
"t": "set",
"p": "Familyroom_generic_presence",
"pt": "flow",
"to": "false",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 840,
"y": 1520,
"wires": [
[]
]
},
{
"id": "52a787fe.4bac18",
"type": "function",
"z": "",
"name": "Master Bedroom Pres.",
"func": "// @ts-nocheck\n//code modified from: https://community.home-assistant.io/t/examples-for-using-the-new-get-entities-node/85777/4\nconst globalHomeAssistant = global.get('homeassistant');\nconst ha = globalHomeAssistant.homeAssistant;\nconst groupEntity = ha.states['group.presence'];\nlet occupants = [];\n\n//*******Just change the room below to whichever room the flow is for*******\n\nroom = \"Master Bedroom\"; //Room should be whatever input_select.*room*_presence would be set to\n //eg Bedroom or Living Room (capitalised and with a space if required)\n//Next, set up the variable that is the flow variable indicating generic room presence - this is checked further down\ngeneric_room_presence = room.replace(\" \", \"_\") + \"_generic_presence\";\n\ngroupEntity.attributes.entity_id.forEach(i => {\n if(ha.states[i].state === room) {\n occupants.push(ha.states[i].attributes.friendly_name.replace(\" Home Presence\", \"\"));\n //The push bit adds the friendly name of any persons location input select which matches the state (ie Living Room)\n //The replace bit clears the Location part from the friendly name leaving just the initials. \n }\n});\n\n//the join function creates '+' separated string from the array.\noccupants = occupants.join(' + ');\n\n//If no BLE occupation is detected but Generic Room Presence is detected (motion/bed/TV etc.), set the room to Someone\n//Otherwise with no BLE or Generic Presence, set to Empty \nif (occupants === '') {\n if (flow.get(generic_room_presence) === true) {\n occupants = \"Someone\";\n } else {\n occupants = \"Empty\";\n }\n}\n\n//if (occupants === '') {\n// occupants = \"Empty\"\n//}\n\nmsg.payload = { data: { \"option\": occupants} };\n\n//Output to top channel by default but to bottom channel if room will be set to Empty\nif (occupants == \"Empty\") {\n return [ null, msg ];\n} else {\n return [ msg, null ];\n}",
"outputs": 2,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 600,
"y": 4760,
"wires": [
[
"cfa61b7f09bb4326"
],
[
"f173028a31e75704"
]
]
},
{
"id": "9088033a.0f72d",
"type": "function",
"z": "",
"name": "FamilyroomPres.",
"func": "// @ts-nocheck\n//code modified from: https://community.home-assistant.io/t/examples-for-using-the-new-get-entities-node/85777/4\nconst globalHomeAssistant = global.get('homeassistant');\nconst ha = globalHomeAssistant.homeAssistant;\nconst groupEntity = ha.states['group.presence'];\nlet occupants = [];\n\n//*******Just change the room below to whichever room the flow is for*******\n\nroom = \"Familyroom\"; //Room should be whatever input_select.*room*_presence would be set to\n //eg Bedroom or Living Room (capitalised and with a space if required)\n//Next, set up the variable that is the flow variable indicating generic room presence - this is checked further down\ngeneric_room_presence = room.replace(\" \", \"_\") + \"_generic_presence\";\n\ngroupEntity.attributes.entity_id.forEach(i => {\n if(ha.states[i].state === room) {\n occupants.push(ha.states[i].attributes.friendly_name.replace(\" Home Presence\", \"\"));\n //The push bit adds the friendly name of any persons location input select which matches the state (ie Living Room)\n //The replace bit clears the Location part from the friendly name leaving just the initials. \n }\n});\n\n//the join function creates '+' separated string from the array.\noccupants = occupants.join(' + ');\n\n//If no BLE occupation is detected but Generic Room Presence is detected (motion/bed/TV etc.), set the room to Someone\n//Otherwise with no BLE or Generic Presence, set to Empty \nif (occupants === '') {\n if (flow.get(generic_room_presence) === true) {\n occupants = \"Someone\";\n } else {\n occupants = \"Empty\";\n }\n}\n\n//if (occupants === '') {\n// occupants = \"Empty\"\n//}\n\nmsg.payload = { data: { \"option\": occupants} };\n\n//Output to top channel by default but to bottom channel if room will be set to Empty\nif (occupants == \"Empty\") {\n return [ null, msg ];\n} else {\n return [ msg, null ];\n}",
"outputs": 2,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 610,
"y": 4840,
"wires": [
[
"67e90afba0d3847f"
],
[
"b36df4f8.a17438"
]
]
},
{
"id": "bff440b.792d5c",
"type": "comment",
"z": "",
"name": "Note",
"info": "These flow variable keep track of whether Generic Room Presence is observed in a room. They are used later in Step 4 to set the presence in each individual room.\n\nThe naming convention should be followed carefully.\nThe variable should start with:\n\nThe name of the room (including capitals) and underscore separated if required (eg \"Bedroom\" or \"Living_Room\"). \nThis should be followed by \"_generic_presence\"\n\nSo for the bedroom the flow variable would be \"Bedroom_generic_presence\"\nFor the Living Room the flow variable would be \"Living_Room_generic_presence\"",
"x": 730,
"y": 1340,
"wires": []
},
{
"id": "9c82cae6.054278",
"type": "comment",
"z": "",
"name": "Note",
"info": "The sensors that report BLE room presence that I use are named sensor.*person*_esp32_mqtt_room.\neg: sensor.p1_esp32_mqtt_room\n\nThis is important since it is used to set the msg.person variable in the following change node. The \"sensor.\" and \"_esp32_mqtt_room\" parts are stripped from the incoming entity name allowing msg.person just to be set to the initials of the relevant person.\n\nThese initials should also match the corresponding input select (eg input_select.p1_location) for the person.",
"x": 150,
"y": 3660,
"wires": []
},
{
"id": "133b4abb17882f52",
"type": "server-state-changed",
"z": "",
"name": "Office Motion?",
"server": "",
"version": 6,
"outputs": 2,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"binary_sensor.office_motion"
],
"substring": [],
"regex": []
},
"outputInitially": true,
"stateType": "str",
"ifState": "on",
"ifStateType": "str",
"ifStateOperator": "is",
"outputOnlyOnStateChange": true,
"for": "0",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": true,
"ignoreCurrentStateUnavailable": true,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 190,
"y": 1620,
"wires": [
[
"e1032116.6609a"
],
[
"348a1cb2.6a0394"
]
]
},
{
"id": "8690f6962dcf15d4",
"type": "change",
"z": "",
"name": "Guestroom",
"rules": [
{
"t": "set",
"p": "room",
"pt": "msg",
"to": "Guestroom",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 450,
"y": 1980,
"wires": [
[
"7b4f2a2.719dfd4"
]
]
},
{
"id": "fb6c9f3f815fac71",
"type": "link in",
"z": "",
"name": "",
"links": [
"40799341cb2b3d89"
],
"x": 325,
"y": 1980,
"wires": [
[
"8690f6962dcf15d4"
]
]
},
{
"id": "3f26490b0d7efe79",
"type": "comment",
"z": "",
"name": "Guestroom Occupied",
"info": "",
"x": 170,
"y": 1980,
"wires": []
},
{
"id": "40799341cb2b3d89",
"type": "link out",
"z": "",
"name": "Guestroom Motion",
"mode": "link",
"links": [
"d1cefa40391f794e",
"d8c1d137e802813f",
"fb6c9f3f815fac71"
],
"x": 1285,
"y": 1380,
"wires": []
},
{
"id": "d8c1d137e802813f",
"type": "link in",
"z": "",
"name": "",
"links": [
"40799341cb2b3d89"
],
"x": 1615,
"y": 1380,
"wires": [
[
"269dd15a71df061a"
]
]
},
{
"id": "05fbee6e18a2e5d6",
"type": "comment",
"z": "",
"name": "Guestroom Occupied",
"info": "",
"x": 1440,
"y": 1380,
"wires": []
},
{
"id": "acc4f5bec898daae",
"type": "comment",
"z": "",
"name": "Guestroom Not Occupied",
"info": "",
"x": 1450,
"y": 1420,
"wires": []
},
{
"id": "73b6180866e5c424",
"type": "link out",
"z": "",
"name": "Guestroom Motion Cleared",
"mode": "link",
"links": [
"4f3fa80473da1a07",
"c594a7c70d591e0e"
],
"x": 1285,
"y": 1420,
"wires": []
},
{
"id": "c594a7c70d591e0e",
"type": "link in",
"z": "",
"name": "",
"links": [
"73b6180866e5c424"
],
"x": 1615,
"y": 1420,
"wires": [
[
"d21cdab5dac00560"
]
]
},
{
"id": "269dd15a71df061a",
"type": "change",
"z": "",
"name": "Guestroom Generic Presence to TRUE",
"rules": [
{
"t": "set",
"p": "Guestroom_generic_presence",
"pt": "flow",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1810,
"y": 1380,
"wires": [
[]
]
},
{
"id": "d21cdab5dac00560",
"type": "change",
"z": "",
"name": "Guestroom Generic Presence to FALSE",
"rules": [
{
"t": "set",
"p": "Guestroom_generic_presence",
"pt": "flow",
"to": "false",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1820,
"y": 1420,
"wires": [
[]
]
},
{
"id": "45344b07382bb4e4",
"type": "server-state-changed",
"z": "",
"name": "Guestroom Motion?",
"server": "",
"version": 6,
"outputs": 2,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"binary_sensor.guestroom_motion"
],
"substring": [],
"regex": []
},
"outputInitially": true,
"stateType": "str",
"ifState": "on",
"ifStateType": "str",
"ifStateOperator": "is",
"outputOnlyOnStateChange": true,
"for": "0",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": true,
"ignoreCurrentStateUnavailable": true,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 1150,
"y": 1400,
"wires": [
[
"40799341cb2b3d89"
],
[
"73b6180866e5c424"
]
]
},
{
"id": "4ebfa04999d496f5",
"type": "trigger",
"z": "",
"name": "15s",
"op1": "",
"op2": "",
"op1type": "nul",
"op2type": "payl",
"duration": "15",
"extend": true,
"overrideDelay": false,
"units": "s",
"reset": "stop",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 850,
"y": 2860,
"wires": [
[
"76bfa89da063588f"
]
]
},
{
"id": "4a5c2aa4f917e5ee",
"type": "function",
"z": "",
"name": "Empty",
"func": "newmsg = {};\nnewmsg.payload = { data: { \"option\": \"Empty\"} }; \nreturn newmsg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1430,
"y": 2860,
"wires": [
[
"027abc55376d5523"
]
]
},
{
"id": "0859a22f00b75936",
"type": "api-current-state",
"z": "",
"name": "Guestroom Someone?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Someone",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_select.guestroom_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 600,
"y": 2860,
"wires": [
[
"4ebfa04999d496f5"
],
[]
]
},
{
"id": "d7e3b3e05229506f",
"type": "trigger-state",
"z": "",
"name": "Guestroom !Someone",
"server": "",
"version": 5,
"inputs": 0,
"outputs": 2,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"input_select.guestroom_presence"
],
"substring": [],
"regex": []
},
"debugEnabled": false,
"constraints": [
{
"targetType": "this_entity",
"targetValue": "",
"propertyType": "current_state",
"propertyValue": "new_state.state",
"comparatorType": "is_not",
"comparatorValueDatatype": "str",
"comparatorValue": "Someone"
}
],
"customOutputs": [],
"outputInitially": true,
"stateType": "str",
"enableInput": false,
"exposeToHomeAssistant": false,
"haConfig": [
{
"property": "name",
"value": ""
},
{
"property": "icon",
"value": ""
}
],
"x": 600,
"y": 2900,
"wires": [
[
"fa4786de64a57090"
],
[]
]
},
{
"id": "fa4786de64a57090",
"type": "change",
"z": "",
"name": "RESET",
"rules": [
{
"t": "set",
"p": "reset",
"pt": "msg",
"to": "true",
"tot": "bool"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "stop",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 755,
"y": 2900,
"wires": [
[
"4ebfa04999d496f5"
]
],
"icon": "node-red/timer.svg",
"l": false
},
{
"id": "45983e2c5c372343",
"type": "api-current-state",
"z": "",
"name": "Cont.?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "on",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_boolean.automations_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 455,
"y": 2860,
"wires": [
[
"0859a22f00b75936"
],
[]
],
"icon": "font-awesome/fa-question",
"l": false
},
{
"id": "4f3fa80473da1a07",
"type": "link in",
"z": "",
"name": "Guestroom Motion Reset",
"links": [
"73b6180866e5c424",
"35cd2104cdcb5f1a"
],
"x": 395,
"y": 2860,
"wires": [
[
"45983e2c5c372343"
]
]
},
{
"id": "d1cefa40391f794e",
"type": "link in",
"z": "",
"name": "Reset Guestroom to Empty Timer",
"links": [
"40799341cb2b3d89",
"9affd85cc86d28ae"
],
"x": 685,
"y": 2940,
"wires": [
[
"fa4786de64a57090"
]
]
},
{
"id": "027abc55376d5523",
"type": "link out",
"z": "",
"name": "",
"mode": "link",
"links": [
"1c1603fd.cc6ecc"
],
"x": 1495,
"y": 2860,
"wires": []
},
{
"id": "106e9a5577182eda",
"type": "comment",
"z": "",
"name": "Set Guestroom Presence",
"info": "",
"x": 1650,
"y": 2860,
"wires": []
},
{
"id": "5f4c1b3fda8d053b",
"type": "comment",
"z": "",
"name": "Reset",
"info": "This yellow timer node resets the timer that it's linked too. In this case, no message will be passed through.\n\nIt's useful in cases where something is scheduled but should no longer happen. ie. the Bedroom is about to be set to \"Empty\" but then there is new motion in there.",
"x": 790,
"y": 2940,
"wires": []
},
{
"id": "a4a839d1a78aff3a",
"type": "comment",
"z": "",
"name": "Guestroom Not Occupied",
"info": "",
"x": 210,
"y": 2860,
"wires": []
},
{
"id": "c19278553df8e826",
"type": "function",
"z": "",
"name": "Someone",
"func": "newmsg = {};\nnewmsg.payload = { data: { \"option\": \"Someone\"} }; \nreturn newmsg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1760,
"y": 2160,
"wires": [
[
"9affd85cc86d28ae"
]
]
},
{
"id": "e56757ad5b740bca",
"type": "api-current-state",
"z": "",
"name": "Empty?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Empty",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_select.guestroom_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1600,
"y": 2160,
"wires": [
[
"c19278553df8e826"
],
[]
]
},
{
"id": "9affd85cc86d28ae",
"type": "link out",
"z": "",
"name": "",
"mode": "link",
"links": [
"1c1603fd.cc6ecc",
"d1cefa40391f794e"
],
"x": 1865,
"y": 2160,
"wires": []
},
{
"id": "dfd5190d9bf072c7",
"type": "comment",
"z": "",
"name": "Set Guestroom Presence",
"info": "",
"x": 2010,
"y": 2160,
"wires": []
},
{
"id": "26e80aa567cd7362",
"type": "function",
"z": "",
"name": "Office Pres.",
"func": "// @ts-nocheck\n//code modified from: https://community.home-assistant.io/t/examples-for-using-the-new-get-entities-node/85777/4\nconst globalHomeAssistant = global.get('homeassistant');\nconst ha = globalHomeAssistant.homeAssistant;\nconst groupEntity = ha.states['group.presence'];\nlet occupants = [];\n\n//*******Just change the room below to whichever room the flow is for*******\n\nroom = \"Office\"; //Room should be whatever input_select.*room*_presence would be set to\n //eg Bedroom or Living Room (capitalised and with a space if required)\n//Next, set up the variable that is the flow variable indicating generic room presence - this is checked further down\ngeneric_room_presence = room.replace(\" \", \"_\") + \"_generic_presence\";\n\ngroupEntity.attributes.entity_id.forEach(i => {\n if(ha.states[i].state === room) {\n occupants.push(ha.states[i].attributes.friendly_name.replace(\" Home Presence\", \"\"));\n //The push bit adds the friendly name of any persons location input select which matches the state (ie Living Room)\n //The replace bit clears the Location part from the friendly name leaving just the initials. \n }\n});\n\n//the join function creates '+' separated string from the array.\noccupants = occupants.join(' + ');\n\n//If no BLE occupation is detected but Generic Room Presence is detected (motion/bed/TV etc.), set the room to Someone\n//Otherwise with no BLE or Generic Presence, set to Empty \nif (occupants === '') {\n if (flow.get(generic_room_presence) === true) {\n occupants = \"Someone\";\n } else {\n occupants = \"Empty\";\n }\n}\n\n//if (occupants === '') {\n// occupants = \"Empty\"\n//}\n\nmsg.payload = { data: { \"option\": occupants} };\n\n//Output to top channel by default but to bottom channel if room will be set to Empty\nif (occupants == \"Empty\") {\n return [ null, msg ];\n} else {\n return [ msg, null ];\n}",
"outputs": 2,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 630,
"y": 4920,
"wires": [
[
"63f8d1d3d26e2831"
],
[
"c0644dbb67e260c6"
]
]
},
{
"id": "1e8bd07503882cdd",
"type": "function",
"z": "",
"name": "Guestroom Pres.",
"func": "// @ts-nocheck\n//code modified from: https://community.home-assistant.io/t/examples-for-using-the-new-get-entities-node/85777/4\nconst globalHomeAssistant = global.get('homeassistant');\nconst ha = globalHomeAssistant.homeAssistant;\nconst groupEntity = ha.states['group.presence'];\nlet occupants = [];\n\n//*******Just change the room below to whichever room the flow is for*******\n\nroom = \"Guestroom\"; //Room should be whatever input_select.*room*_presence would be set to\n //eg Bedroom or Living Room (capitalised and with a space if required)\n//Next, set up the variable that is the flow variable indicating generic room presence - this is checked further down\ngeneric_room_presence = room.replace(\" \", \"_\") + \"_generic_presence\";\n\ngroupEntity.attributes.entity_id.forEach(i => {\n if(ha.states[i].state === room) {\n occupants.push(ha.states[i].attributes.friendly_name.replace(\" Home Presence\", \"\"));\n //The push bit adds the friendly name of any persons location input select which matches the state (ie Living Room)\n //The replace bit clears the Location part from the friendly name leaving just the initials. \n }\n});\n\n//the join function creates '+' separated string from the array.\noccupants = occupants.join(' + ');\n\n//If no BLE occupation is detected but Generic Room Presence is detected (motion/bed/TV etc.), set the room to Someone\n//Otherwise with no BLE or Generic Presence, set to Empty \nif (occupants === '') {\n if (flow.get(generic_room_presence) === true) {\n occupants = \"Someone\";\n } else {\n occupants = \"Empty\";\n }\n}\n\n//if (occupants === '') {\n// occupants = \"Empty\"\n//}\n\nmsg.payload = { data: { \"option\": occupants} };\n\n//Output to top channel by default but to bottom channel if room will be set to Empty\nif (occupants == \"Empty\") {\n return [ null, msg ];\n} else {\n return [ msg, null ];\n}",
"outputs": 2,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 610,
"y": 5000,
"wires": [
[
"dec013d7a733f0c5"
],
[
"bb14cf9f.1ca57"
]
]
},
{
"id": "596e144e2c2c29c0",
"type": "switch",
"z": "",
"name": "Office Motion event <2min ago?",
"property": "office_motion_data.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "lte",
"v": "120000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 950,
"y": 4060,
"wires": [
[
"4c33094280c346a2"
],
[
"d3deffbc81b96df0"
]
]
},
{
"id": "d3deffbc81b96df0",
"type": "switch",
"z": "",
"name": "BLE Same for >2min?",
"property": "ble_room_data.new_state.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "gte",
"v": "120000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 1280,
"y": 4100,
"wires": [
[
"cd509edbc1216e41"
],
[
"de068c6039e34e35"
]
]
},
{
"id": "3e3373b0b64fddd3",
"type": "api-current-state",
"z": "",
"name": "Office Motion?",
"server": "",
"version": 3,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "binary_sensor.office_motion",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "office_motion",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "office_motion_data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 985,
"y": 3720,
"wires": [
[
"6ea1c91c320c537f"
]
],
"icon": "font-awesome/fa-child",
"l": false
},
{
"id": "6ea1c91c320c537f",
"type": "api-current-state",
"z": "",
"name": "Bedroom Motion?",
"server": "",
"version": 3,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "binary_sensor.bedroom_motion",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "bedroom_motion",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "bedroom_motion_data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1045,
"y": 3760,
"wires": [
[
"43697459c34be5e7"
]
],
"icon": "font-awesome/fa-child",
"l": false
},
{
"id": "db91e9d6e4a57df9",
"type": "switch",
"z": "",
"name": "Guestroom Motion event <2min ago?",
"property": "guestroom_motion_data.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "lte",
"v": "120000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 970,
"y": 4140,
"wires": [
[
"579d46e456780a67"
],
[
"785029d1c6c0a3b3"
]
]
},
{
"id": "785029d1c6c0a3b3",
"type": "switch",
"z": "",
"name": "BLE Same for >2min?",
"property": "ble_room_data.new_state.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "gte",
"v": "120000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 1280,
"y": 4180,
"wires": [
[
"ad01cbb8fd329064"
],
[
"a44d8d2769289216"
]
]
},
{
"id": "0d56e1af67cbd234",
"type": "api-current-state",
"z": "",
"name": "TV ON?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "on",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "media_player.familyroom_tv_group",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 935,
"y": 2620,
"wires": [
[
"e1ab5bf75161d74d"
],
[
"137931cfacf70b4a"
]
],
"icon": "font-awesome/fa-tv",
"l": false
},
{
"id": "e1ab5bf75161d74d",
"type": "link out",
"z": "",
"name": "",
"mode": "link",
"links": [
"e9b8aff7.2651f"
],
"x": 985,
"y": 2580,
"wires": []
},
{
"id": "6395d34dad653ecf",
"type": "switch",
"z": "",
"name": "",
"property": "last_used_room",
"propertyType": "global",
"rules": [
{
"t": "eq",
"v": "Master Bedroom",
"vt": "str"
},
{
"t": "eq",
"v": "Familyroom",
"vt": "str"
},
{
"t": "eq",
"v": "Office",
"vt": "str"
},
{
"t": "eq",
"v": "Guestroom",
"vt": "str"
},
{
"t": "eq",
"v": "Livingroom",
"vt": "str"
},
{
"t": "eq",
"v": "Garage",
"vt": "str"
},
{
"t": "eq",
"v": "Kitchen",
"vt": "str"
},
{
"t": "eq",
"v": "Bedroom",
"vt": "str"
},
{
"t": "eq",
"v": "Diningroom",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 9,
"x": 1590,
"y": 1900,
"wires": [
[
"252d0a999a4966b7"
],
[
"a7ee6651db14216b"
],
[
"958537e74f19a8d7"
],
[
"bdb56111ba0f5dc1"
],
[
"468156f32dff62fd"
],
[
"0329b34ecdc49d5b"
],
[
"e1beccd45eb10753"
],
[
"370a63c1899b6f2c"
],
[
"131e62302c685270"
]
]
},
{
"id": "4ae96d1498756139",
"type": "link in",
"z": "",
"name": "Master Bedroom Empty",
"links": [
"468156f32dff62fd",
"958537e74f19a8d7",
"a7ee6651db14216b",
"bdb56111ba0f5dc1",
"0329b34ecdc49d5b",
"e1beccd45eb10753",
"370a63c1899b6f2c",
"55f442e87f3c795a"
],
"x": 1345,
"y": 2540,
"wires": [
[
"de2e2047.7dbea"
]
]
},
{
"id": "15ea49710908994f",
"type": "link in",
"z": "",
"name": "Familyroom Empty",
"links": [
"0329b34ecdc49d5b",
"19c7a5ce03745742",
"468156f32dff62fd",
"958537e74f19a8d7",
"bdb56111ba0f5dc1",
"e1beccd45eb10753",
"370a63c1899b6f2c",
"55f442e87f3c795a"
],
"x": 1345,
"y": 2660,
"wires": [
[
"aaf1e470.b1aac8"
]
]
},
{
"id": "575904114c55950b",
"type": "link in",
"z": "",
"name": "Office Empty",
"links": [
"19c7a5ce03745742",
"a7ee6651db14216b",
"bdb56111ba0f5dc1",
"468156f32dff62fd",
"0329b34ecdc49d5b",
"e1beccd45eb10753",
"370a63c1899b6f2c",
"55f442e87f3c795a"
],
"x": 1345,
"y": 2780,
"wires": [
[
"75ca2147.932f3"
]
]
},
{
"id": "a81529e82d19e178",
"type": "link in",
"z": "",
"name": "Guestroom Empty",
"links": [
"19c7a5ce03745742",
"a7ee6651db14216b",
"958537e74f19a8d7",
"468156f32dff62fd",
"0329b34ecdc49d5b",
"e1beccd45eb10753",
"370a63c1899b6f2c",
"55f442e87f3c795a"
],
"x": 1345,
"y": 2900,
"wires": [
[
"4a5c2aa4f917e5ee"
]
]
},
{
"id": "19c7a5ce03745742",
"type": "link out",
"z": "",
"name": "",
"mode": "link",
"links": [
"14ad2074c86c4e40",
"15ea49710908994f",
"575904114c55950b",
"7814ee55f186d3e1",
"a81529e82d19e178",
"e16de7e03ce1be65",
"96535f9f66d5917c",
"ffe42bdc0c303198"
],
"x": 1745,
"y": 1820,
"wires": []
},
{
"id": "a7ee6651db14216b",
"type": "link out",
"z": "",
"name": "",
"mode": "link",
"links": [
"14ad2074c86c4e40",
"4ae96d1498756139",
"575904114c55950b",
"7814ee55f186d3e1",
"a81529e82d19e178",
"e16de7e03ce1be65",
"96535f9f66d5917c",
"ffe42bdc0c303198"
],
"x": 1705,
"y": 1840,
"wires": []
},
{
"id": "958537e74f19a8d7",
"type": "link out",
"z": "",
"name": "",
"mode": "link",
"links": [
"14ad2074c86c4e40",
"15ea49710908994f",
"4ae96d1498756139",
"7814ee55f186d3e1",
"a81529e82d19e178",
"e16de7e03ce1be65",
"96535f9f66d5917c",
"ffe42bdc0c303198"
],
"x": 1745,
"y": 1860,
"wires": []
},
{
"id": "bdb56111ba0f5dc1",
"type": "link out",
"z": "",
"name": "",
"mode": "link",
"links": [
"14ad2074c86c4e40",
"15ea49710908994f",
"4ae96d1498756139",
"575904114c55950b",
"7814ee55f186d3e1",
"e16de7e03ce1be65",
"96535f9f66d5917c",
"ffe42bdc0c303198"
],
"x": 1705,
"y": 1880,
"wires": []
},
{
"id": "dace8010081a67b0",
"type": "api-call-service",
"z": "",
"name": "Set Livingroom Pres.",
"server": "",
"version": 7,
"debugenabled": false,
"action": "input_select.select_option",
"floorId": [],
"areaId": [],
"deviceId": [],
"entityId": [
"input_select.livingroom_presence"
],
"labelId": [],
"data": "",
"dataType": "json",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "data"
}
],
"queue": "none",
"blockInputOverrides": false,
"domain": "input_select",
"service": "select_option",
"output_location": "payload",
"output_location_type": "msg",
"x": 280,
"y": 320,
"wires": [
[]
]
},
{
"id": "f48425f61fe957b1",
"type": "link in",
"z": "",
"name": "Set Diningroom Presence",
"links": [
"14fc18c1ba91d39f",
"36d027f20aea671a",
"79a9e66e1b50a7de"
],
"x": 135,
"y": 320,
"wires": [
[
"dace8010081a67b0"
]
]
},
{
"id": "053a9acd11caec36",
"type": "api-current-state",
"z": "",
"name": "Empty?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Empty",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_select.livingroom_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1600,
"y": 2200,
"wires": [
[
"c855f7834c62de4a"
],
[]
]
},
{
"id": "c855f7834c62de4a",
"type": "function",
"z": "",
"name": "Someone",
"func": "// @ts-nocheck\nnewmsg = {};\nnewmsg.payload = { data: { \"option\": \"Someone\"} }; \nreturn newmsg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1760,
"y": 2200,
"wires": [
[
"14fc18c1ba91d39f"
]
]
},
{
"id": "14fc18c1ba91d39f",
"type": "link out",
"z": "",
"name": "",
"mode": "link",
"links": [
"45574c1f1ed8ccca",
"f48425f61fe957b1"
],
"x": 1865,
"y": 2200,
"wires": []
},
{
"id": "683f9a75a5e33f17",
"type": "comment",
"z": "",
"name": "Set Livingroom Presence",
"info": "",
"x": 2010,
"y": 2200,
"wires": []
},
{
"id": "14645d786238c834",
"type": "trigger",
"z": "",
"name": "15s",
"op1": "",
"op2": "",
"op1type": "nul",
"op2type": "payl",
"duration": "15",
"extend": true,
"overrideDelay": false,
"units": "s",
"reset": "stop",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 850,
"y": 2980,
"wires": [
[
"a88c32250b8e9e10"
]
]
},
{
"id": "a88c32250b8e9e10",
"type": "function",
"z": "",
"name": "Empty",
"func": "// @ts-ignore\nnewmsg = {};\nnewmsg.payload = { data: { \"option\": \"Empty\"} }; \nreturn newmsg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1430,
"y": 2980,
"wires": [
[
"36d027f20aea671a"
]
]
},
{
"id": "c33e59357f818d5b",
"type": "api-current-state",
"z": "",
"name": "Livingroom Someone?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Someone",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_select.livingroom_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 600,
"y": 2980,
"wires": [
[
"14645d786238c834"
],
[]
]
},
{
"id": "cb18268bc2958239",
"type": "trigger-state",
"z": "",
"name": "Livingroom !Someone",
"server": "",
"version": 5,
"inputs": 0,
"outputs": 2,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"input_select.livingroom_presence"
],
"substring": [],
"regex": []
},
"debugEnabled": false,
"constraints": [
{
"targetType": "this_entity",
"targetValue": "",
"propertyType": "current_state",
"propertyValue": "new_state.state",
"comparatorType": "is_not",
"comparatorValueDatatype": "str",
"comparatorValue": "Someone"
}
],
"customOutputs": [],
"outputInitially": true,
"stateType": "str",
"enableInput": false,
"exposeToHomeAssistant": false,
"haConfig": [
{
"property": "name",
"value": ""
},
{
"property": "icon",
"value": ""
}
],
"x": 600,
"y": 3020,
"wires": [
[
"ae2bfcb61419b457"
],
[]
]
},
{
"id": "ae2bfcb61419b457",
"type": "change",
"z": "",
"name": "RESET",
"rules": [
{
"t": "set",
"p": "reset",
"pt": "msg",
"to": "true",
"tot": "bool"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "stop",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 755,
"y": 3020,
"wires": [
[
"14645d786238c834"
]
],
"icon": "node-red/timer.svg",
"l": false
},
{
"id": "7f7a18cf8417a31c",
"type": "api-current-state",
"z": "",
"name": "Cont.?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "on",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_boolean.automations_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 455,
"y": 2980,
"wires": [
[
"c33e59357f818d5b"
],
[]
],
"icon": "font-awesome/fa-question",
"l": false
},
{
"id": "ec0797c643aa0d37",
"type": "link in",
"z": "",
"name": "Guestroom Motion Reset",
"links": [
"baaf85d1c092bb6e"
],
"x": 395,
"y": 2980,
"wires": [
[
"7f7a18cf8417a31c"
]
]
},
{
"id": "45574c1f1ed8ccca",
"type": "link in",
"z": "",
"name": "Reset Diningroom to Empty Timer",
"links": [
"14fc18c1ba91d39f",
"52f312f8449dc99a"
],
"x": 685,
"y": 3060,
"wires": [
[
"ae2bfcb61419b457"
]
]
},
{
"id": "36d027f20aea671a",
"type": "link out",
"z": "",
"name": "",
"mode": "link",
"links": [
"f48425f61fe957b1"
],
"x": 1495,
"y": 2980,
"wires": []
},
{
"id": "e1b74b782414aaa0",
"type": "comment",
"z": "",
"name": "Set Livingroom Presence",
"info": "",
"x": 1650,
"y": 2980,
"wires": []
},
{
"id": "973d35d8689a5794",
"type": "comment",
"z": "",
"name": "Reset",
"info": "This yellow timer node resets the timer that it's linked too. In this case, no message will be passed through.\n\nIt's useful in cases where something is scheduled but should no longer happen. ie. the Bedroom is about to be set to \"Empty\" but then there is new motion in there.",
"x": 790,
"y": 3060,
"wires": []
},
{
"id": "7346e58e203dfcbf",
"type": "comment",
"z": "",
"name": "Livingroom Not Occupied",
"info": "",
"x": 210,
"y": 2980,
"wires": []
},
{
"id": "14ad2074c86c4e40",
"type": "link in",
"z": "",
"name": "Diningroom Empty",
"links": [
"19c7a5ce03745742",
"958537e74f19a8d7",
"a7ee6651db14216b",
"bdb56111ba0f5dc1",
"0329b34ecdc49d5b",
"e1beccd45eb10753",
"370a63c1899b6f2c",
"55f442e87f3c795a"
],
"x": 1345,
"y": 3020,
"wires": [
[
"a88c32250b8e9e10"
]
]
},
{
"id": "52f312f8449dc99a",
"type": "link out",
"z": "",
"name": "Diningroom Motion",
"mode": "link",
"links": [
"45574c1f1ed8ccca",
"a5710a17aa8debd1",
"faab7399b913920e"
],
"x": 1285,
"y": 1280,
"wires": []
},
{
"id": "a5710a17aa8debd1",
"type": "link in",
"z": "",
"name": "",
"links": [
"52f312f8449dc99a"
],
"x": 1615,
"y": 1280,
"wires": [
[
"ba2e12feef508577"
]
]
},
{
"id": "5b31861238c8abb5",
"type": "comment",
"z": "",
"name": "Livingroom Occupied",
"info": "",
"x": 1440,
"y": 1280,
"wires": []
},
{
"id": "74ce539d56f426fa",
"type": "comment",
"z": "",
"name": "Livingroom Not Occupied",
"info": "",
"x": 1450,
"y": 1320,
"wires": []
},
{
"id": "baaf85d1c092bb6e",
"type": "link out",
"z": "",
"name": "Diningroom Motion Cleared",
"mode": "link",
"links": [
"5a4b7d16b788600f",
"ec0797c643aa0d37"
],
"x": 1285,
"y": 1320,
"wires": []
},
{
"id": "5a4b7d16b788600f",
"type": "link in",
"z": "",
"name": "",
"links": [
"baaf85d1c092bb6e"
],
"x": 1615,
"y": 1320,
"wires": [
[
"76e70dcf8aec61e1"
]
]
},
{
"id": "ba2e12feef508577",
"type": "change",
"z": "",
"name": "Livingroom Generic Presence to TRUE",
"rules": [
{
"t": "set",
"p": "Livingroom_generic_presence",
"pt": "flow",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1810,
"y": 1280,
"wires": [
[]
]
},
{
"id": "76e70dcf8aec61e1",
"type": "change",
"z": "",
"name": "Livingroom Generic Presence to FALSE",
"rules": [
{
"t": "set",
"p": "Livingroom_generic_presence",
"pt": "flow",
"to": "false",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1820,
"y": 1320,
"wires": [
[]
]
},
{
"id": "8a00b5594cfc4f2c",
"type": "server-state-changed",
"z": "",
"name": "Livingroom Motion?",
"server": "",
"version": 6,
"outputs": 2,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"binary_sensor.livingroom_motion"
],
"substring": [],
"regex": []
},
"outputInitially": true,
"stateType": "str",
"ifState": "on",
"ifStateType": "str",
"ifStateOperator": "is",
"outputOnlyOnStateChange": true,
"for": "0",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": true,
"ignoreCurrentStateUnavailable": true,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 1150,
"y": 1300,
"wires": [
[
"52f312f8449dc99a"
],
[
"baaf85d1c092bb6e"
]
]
},
{
"id": "fd57027ec0236384",
"type": "change",
"z": "",
"name": "Livingroom",
"rules": [
{
"t": "set",
"p": "room",
"pt": "msg",
"to": "Livingroom",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 450,
"y": 2020,
"wires": [
[
"7b4f2a2.719dfd4"
]
]
},
{
"id": "faab7399b913920e",
"type": "link in",
"z": "",
"name": "",
"links": [
"52f312f8449dc99a"
],
"x": 325,
"y": 2020,
"wires": [
[
"fd57027ec0236384"
]
]
},
{
"id": "7fa2a71c30a5cc2a",
"type": "comment",
"z": "",
"name": "Livingroom Occupied",
"info": "",
"x": 170,
"y": 2020,
"wires": []
},
{
"id": "145556a5ca748594",
"type": "change",
"z": "",
"name": "RESET",
"rules": [
{
"t": "set",
"p": "reset",
"pt": "msg",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 925,
"y": 5060,
"wires": [
[
"f9adaaa4ef75e95a",
"79a9e66e1b50a7de"
]
],
"icon": "node-red/timer.svg",
"l": false
},
{
"id": "f9adaaa4ef75e95a",
"type": "trigger",
"z": "",
"name": "",
"op1": "",
"op2": "",
"op1type": "nul",
"op2type": "payl",
"duration": "15",
"extend": true,
"overrideDelay": false,
"units": "s",
"reset": "stop",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 995,
"y": 5080,
"wires": [
[
"79a9e66e1b50a7de"
]
],
"l": false
},
{
"id": "48f0bc462fe39c3d",
"type": "api-current-state",
"z": "",
"name": "Livingroom !Empty?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Empty",
"halt_if_type": "str",
"halt_if_compare": "is_not",
"entity_id": "input_select.livingroom_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 840,
"y": 5100,
"wires": [
[
"f9adaaa4ef75e95a"
],
[]
]
},
{
"id": "79a9e66e1b50a7de",
"type": "link out",
"z": "",
"name": "",
"mode": "link",
"links": [
"f48425f61fe957b1"
],
"x": 1055,
"y": 5060,
"wires": []
},
{
"id": "09dcdad946fdf736",
"type": "comment",
"z": "",
"name": "Set Livingroom Presence",
"info": "",
"x": 1210,
"y": 5060,
"wires": []
},
{
"id": "d43cb77dba7ea5c8",
"type": "function",
"z": "",
"name": "Livingroom Pres.",
"func": "// @ts-nocheck\n//code modified from: https://community.home-assistant.io/t/examples-for-using-the-new-get-entities-node/85777/4\nconst globalHomeAssistant = global.get('homeassistant');\nconst ha = globalHomeAssistant.homeAssistant;\nconst groupEntity = ha.states['group.presence'];\nlet occupants = [];\n\n//*******Just change the room below to whichever room the flow is for*******\n\nroom = \"Livingroom\"; //Room should be whatever input_select.*room*_presence would be set to\n //eg Bedroom or Living Room (capitalised and with a space if required)\n//Next, set up the variable that is the flow variable indicating generic room presence - this is checked further down\ngeneric_room_presence = room.replace(\" \", \"_\") + \"_generic_presence\";\n\ngroupEntity.attributes.entity_id.forEach(i => {\n if(ha.states[i].state === room) {\n occupants.push(ha.states[i].attributes.friendly_name.replace(\" Home Presence\", \"\"));\n //The push bit adds the friendly name of any persons location input select which matches the state (ie Living Room)\n //The replace bit clears the Location part from the friendly name leaving just the initials. \n }\n});\n\n//the join function creates '+' separated string from the array.\noccupants = occupants.join(' + ');\n\n//If no BLE occupation is detected but Generic Room Presence is detected (motion/bed/TV etc.), set the room to Someone\n//Otherwise with no BLE or Generic Presence, set to Empty \nif (occupants === '') {\n if (flow.get(generic_room_presence) === true) {\n occupants = \"Someone\";\n } else {\n occupants = \"Empty\";\n }\n}\n\n//if (occupants === '') {\n// occupants = \"Empty\"\n//}\n\nmsg.payload = { data: { \"option\": occupants} };\n\n//Output to top channel by default but to bottom channel if room will be set to Empty\nif (occupants == \"Empty\") {\n return [ null, msg ];\n} else {\n return [ msg, null ];\n}",
"outputs": 2,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 610,
"y": 5080,
"wires": [
[
"557ab358c15fab27"
],
[
"48f0bc462fe39c3d"
]
]
},
{
"id": "f038e42342bbdb22",
"type": "change",
"z": "",
"name": "Set Livingroom",
"rules": [
{
"t": "set",
"p": "new_room_to_set",
"pt": "msg",
"to": "Livingroom",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1540,
"y": 4220,
"wires": [
[
"0c517bb99aa2a6e3",
"a36140755c016c60"
]
]
},
{
"id": "04f2e1bbe93a9f9b",
"type": "switch",
"z": "",
"name": "!In Bed?",
"property": "bed_presence",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "off/not automated",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 775,
"y": 4220,
"wires": [
[
"f39697420937bfec"
],
[
"8584bbc94651bca1"
]
],
"icon": "font-awesome/fa-bed",
"l": false
},
{
"id": "9daf247115edf7c2",
"type": "switch",
"z": "",
"name": "Livingroom !Set?",
"property": "person_location",
"propertyType": "msg",
"rules": [
{
"t": "neq",
"v": "Livingroom",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 430,
"y": 4220,
"wires": [
[
"6ee57080b54b5467"
]
]
},
{
"id": "f39697420937bfec",
"type": "switch",
"z": "",
"name": "Livingroom Motion event <2min ago?",
"property": "livingroom_motion_data.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "lte",
"v": "120000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 970,
"y": 4220,
"wires": [
[
"c26ac73562c3acd5"
],
[
"7b66bfb7e8e0a4b3"
]
]
},
{
"id": "7b66bfb7e8e0a4b3",
"type": "switch",
"z": "",
"name": "BLE Same for >2min?",
"property": "ble_room_data.new_state.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "gte",
"v": "120000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "false",
"repair": true,
"outputs": 2,
"x": 1280,
"y": 4260,
"wires": [
[
"c3c12c057d75046f"
],
[
"7192d331a9623b0c"
]
]
},
{
"id": "468156f32dff62fd",
"type": "link out",
"z": "",
"name": "",
"mode": "link",
"links": [
"15ea49710908994f",
"4ae96d1498756139",
"575904114c55950b",
"7814ee55f186d3e1",
"a81529e82d19e178",
"e16de7e03ce1be65",
"96535f9f66d5917c",
"ffe42bdc0c303198"
],
"x": 1745,
"y": 1900,
"wires": []
},
{
"id": "8a1b912e5b0fcde8",
"type": "api-current-state",
"z": "",
"d": true,
"name": "House Pres.?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Unknown, Empty, Someone, Guests, Extended Away",
"halt_if_type": "str",
"halt_if_compare": "does_not_include",
"entity_id": "input_select.house_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 920,
"y": 2060,
"wires": [
[
"3f74e1d6.604fae"
],
[]
]
},
{
"id": "64b2104a2d7fb23d",
"type": "link in",
"z": "",
"name": "House Presence Check",
"links": [
"bf1f90c95c279c26"
],
"x": 315,
"y": 1040,
"wires": [
[
"87c1e4bb.3ff988"
]
]
},
{
"id": "bf1f90c95c279c26",
"type": "link out",
"z": "",
"d": true,
"name": "link out 7",
"mode": "link",
"links": [
"64b2104a2d7fb23d"
],
"x": 325,
"y": 5040,
"wires": []
},
{
"id": "d47ac6d0e6641e7a",
"type": "link in",
"z": "",
"name": "link in 1",
"links": [
"0c5731283943daa2",
"c0d99758f2b35be0",
"3ddbfc64a6b0834f",
"1a767dcfe1fccc63",
"46501bd89493f6fa",
"205bf8e33ac808de",
"55a7b3ba61cdbad0",
"ab74afb34cf887b4",
"6849b656a9f2f37d",
"2f66928c3ec341d0"
],
"x": 225,
"y": 3780,
"wires": [
[
"bd0de279.2c72c"
]
]
},
{
"id": "7192d331a9623b0c",
"type": "delay",
"z": "",
"name": "",
"pauseType": "delay",
"timeout": "30",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 1475,
"y": 4260,
"wires": [
[
"b4b32b7c35403cd5"
]
],
"l": false
},
{
"id": "0c5731283943daa2",
"type": "link out",
"z": "",
"name": "link out 15",
"mode": "link",
"links": [
"d47ac6d0e6641e7a"
],
"x": 1575,
"y": 4260,
"wires": []
},
{
"id": "b4b32b7c35403cd5",
"type": "api-current-state",
"z": "",
"name": "refresh",
"server": "",
"version": 3,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "{{id}}",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
},
{
"property": "id",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1525,
"y": 4260,
"wires": [
[
"0c5731283943daa2"
]
],
"icon": "font-awesome/fa-refresh",
"l": false
},
{
"id": "a44d8d2769289216",
"type": "delay",
"z": "",
"name": "",
"pauseType": "delay",
"timeout": "30",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 1475,
"y": 4180,
"wires": [
[
"9122ba0d02db451e"
]
],
"l": false
},
{
"id": "c0d99758f2b35be0",
"type": "link out",
"z": "",
"name": "link out 16",
"mode": "link",
"links": [
"d47ac6d0e6641e7a"
],
"x": 1575,
"y": 4180,
"wires": []
},
{
"id": "9122ba0d02db451e",
"type": "api-current-state",
"z": "",
"name": "refresh",
"server": "",
"version": 3,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "{{id}}",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
},
{
"property": "id",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1525,
"y": 4180,
"wires": [
[
"c0d99758f2b35be0"
]
],
"icon": "font-awesome/fa-refresh",
"l": false
},
{
"id": "de068c6039e34e35",
"type": "delay",
"z": "",
"name": "",
"pauseType": "delay",
"timeout": "30",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 1475,
"y": 4100,
"wires": [
[
"bc200540adb7cf37"
]
],
"l": false
},
{
"id": "3ddbfc64a6b0834f",
"type": "link out",
"z": "",
"name": "link out 17",
"mode": "link",
"links": [
"d47ac6d0e6641e7a"
],
"x": 1575,
"y": 4100,
"wires": []
},
{
"id": "bc200540adb7cf37",
"type": "api-current-state",
"z": "",
"name": "refresh",
"server": "",
"version": 3,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "{{id}}",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
},
{
"property": "id",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1525,
"y": 4100,
"wires": [
[
"3ddbfc64a6b0834f"
]
],
"icon": "font-awesome/fa-refresh",
"l": false
},
{
"id": "fabfa00fc4279c25",
"type": "delay",
"z": "",
"name": "",
"pauseType": "delay",
"timeout": "30",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 1475,
"y": 4020,
"wires": [
[
"ca0f5387965943ca"
]
],
"l": false
},
{
"id": "1a767dcfe1fccc63",
"type": "link out",
"z": "",
"name": "link out 18",
"mode": "link",
"links": [
"d47ac6d0e6641e7a"
],
"x": 1575,
"y": 4020,
"wires": []
},
{
"id": "ca0f5387965943ca",
"type": "api-current-state",
"z": "",
"name": "refresh",
"server": "",
"version": 3,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "{{id}}",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
},
{
"property": "id",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1525,
"y": 4020,
"wires": [
[
"1a767dcfe1fccc63"
]
],
"icon": "font-awesome/fa-refresh",
"l": false
},
{
"id": "d3961d8a5d9b15a7",
"type": "delay",
"z": "",
"name": "",
"pauseType": "delay",
"timeout": "30",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 1475,
"y": 3940,
"wires": [
[
"ac6473d8bbbbf7ab"
]
],
"l": false
},
{
"id": "46501bd89493f6fa",
"type": "link out",
"z": "",
"name": "link out 19",
"mode": "link",
"links": [
"d47ac6d0e6641e7a"
],
"x": 1575,
"y": 3940,
"wires": []
},
{
"id": "ac6473d8bbbbf7ab",
"type": "api-current-state",
"z": "",
"name": "refresh",
"server": "",
"version": 3,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "{{id}}",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
},
{
"property": "id",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1525,
"y": 3940,
"wires": [
[
"46501bd89493f6fa"
]
],
"icon": "font-awesome/fa-refresh",
"l": false
},
{
"id": "0c517bb99aa2a6e3",
"type": "change",
"z": "",
"name": "RESET",
"rules": [
{
"t": "set",
"p": "reset",
"pt": "msg",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1695,
"y": 4220,
"wires": [
[
"7192d331a9623b0c"
]
],
"icon": "node-red/timer.svg",
"l": false
},
{
"id": "a963e079223eaa0b",
"type": "change",
"z": "",
"name": "RESET",
"rules": [
{
"t": "set",
"p": "reset",
"pt": "msg",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1695,
"y": 4140,
"wires": [
[
"a44d8d2769289216"
]
],
"icon": "node-red/timer.svg",
"l": false
},
{
"id": "aa2231a1c037ce5d",
"type": "change",
"z": "",
"name": "RESET",
"rules": [
{
"t": "set",
"p": "reset",
"pt": "msg",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1695,
"y": 4060,
"wires": [
[
"de068c6039e34e35"
]
],
"icon": "node-red/timer.svg",
"l": false
},
{
"id": "62a33dace70a8db3",
"type": "change",
"z": "",
"name": "RESET",
"rules": [
{
"t": "set",
"p": "reset",
"pt": "msg",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1695,
"y": 3980,
"wires": [
[
"fabfa00fc4279c25"
]
],
"icon": "node-red/timer.svg",
"l": false
},
{
"id": "236cae4884eaafd1",
"type": "change",
"z": "",
"name": "RESET",
"rules": [
{
"t": "set",
"p": "reset",
"pt": "msg",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1695,
"y": 3900,
"wires": [
[
"d3961d8a5d9b15a7"
]
],
"icon": "node-red/timer.svg",
"l": false
},
{
"id": "8daa82d1.5fa71",
"type": "function",
"z": "",
"name": "Someone",
"func": "newmsg = {};\nnewmsg.payload = { data: { \"option\": \"Someone\"} }; \nreturn newmsg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1760,
"y": 2120,
"wires": [
[
"2f491c9b.5b2c14"
]
]
},
{
"id": "a79f00257fbd793b",
"type": "api-call-service",
"z": "",
"name": "Set Garage Pres.",
"server": "",
"version": 7,
"debugenabled": false,
"action": "input_select.select_option",
"floorId": [],
"areaId": [],
"deviceId": [],
"entityId": [
"input_select.garage_presence"
],
"labelId": [],
"data": "",
"dataType": "json",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "data"
}
],
"queue": "none",
"blockInputOverrides": false,
"domain": "input_select",
"service": "select_option",
"output_location": "payload",
"output_location_type": "msg",
"x": 270,
"y": 360,
"wires": [
[]
]
},
{
"id": "248700ca227d164d",
"type": "server-state-changed",
"z": "",
"name": "Garage Motion?",
"server": "",
"version": 6,
"outputs": 2,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"binary_sensor.garage_motion"
],
"substring": [],
"regex": []
},
"outputInitially": true,
"stateType": "str",
"ifState": "on",
"ifStateType": "str",
"ifStateOperator": "is",
"outputOnlyOnStateChange": true,
"for": "0",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": true,
"ignoreCurrentStateUnavailable": true,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 1160,
"y": 1500,
"wires": [
[
"f9a73b276d8f506a"
],
[
"1a963e984d49ec84"
]
]
},
{
"id": "9a2139c12a4e3943",
"type": "change",
"z": "",
"name": "Garage Generic Presence to TRUE",
"rules": [
{
"t": "set",
"p": "Garage_generic_presence",
"pt": "flow",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1800,
"y": 1480,
"wires": [
[]
]
},
{
"id": "93b3bff0d2ab4af3",
"type": "change",
"z": "",
"name": "Garage Generic Presence to FALSE",
"rules": [
{
"t": "set",
"p": "Garage_generic_presence",
"pt": "flow",
"to": "false",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1810,
"y": 1520,
"wires": [
[]
]
},
{
"id": "406894355f44e5d4",
"type": "api-current-state",
"z": "",
"name": "Empty?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Empty",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_select.garage_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1600,
"y": 2240,
"wires": [
[
"b3f3377ecfb5b6a1"
],
[]
]
},
{
"id": "b3f3377ecfb5b6a1",
"type": "function",
"z": "",
"name": "Someone",
"func": "// @ts-nocheck\nnewmsg = {};\nnewmsg.payload = { data: { \"option\": \"Someone\"} }; \nreturn newmsg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1760,
"y": 2240,
"wires": [
[
"b146a253a7da8984"
]
]
},
{
"id": "28ed65a7e277af5b",
"type": "comment",
"z": "",
"name": "Set Garage Presence",
"info": "",
"x": 2000,
"y": 2240,
"wires": []
},
{
"id": "3080c223c8c6115c",
"type": "trigger",
"z": "",
"name": "15s",
"op1": "",
"op2": "",
"op1type": "nul",
"op2type": "payl",
"duration": "15",
"extend": true,
"overrideDelay": false,
"units": "s",
"reset": "stop",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 830,
"y": 3100,
"wires": [
[
"19c30cffcf9f2dfe"
]
]
},
{
"id": "19c30cffcf9f2dfe",
"type": "function",
"z": "",
"name": "Empty",
"func": "// @ts-nocheck\nnewmsg = {};\nnewmsg.payload = { data: { \"option\": \"Empty\"} }; \nreturn newmsg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1430,
"y": 3100,
"wires": [
[
"e04e49c62892b725"
]
]
},
{
"id": "a193889ded72d73c",
"type": "api-current-state",
"z": "",
"name": "Garage Someone?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Someone",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_select.garage_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 590,
"y": 3100,
"wires": [
[
"3080c223c8c6115c"
],
[]
]
},
{
"id": "d92a0954594a0c2b",
"type": "trigger-state",
"z": "",
"name": "Garage !Someone",
"server": "",
"version": 5,
"inputs": 0,
"outputs": 2,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"input_select.garage_presence"
],
"substring": [],
"regex": []
},
"debugEnabled": false,
"constraints": [
{
"targetType": "this_entity",
"targetValue": "",
"propertyType": "current_state",
"propertyValue": "new_state.state",
"comparatorType": "is_not",
"comparatorValueDatatype": "str",
"comparatorValue": "Someone"
}
],
"customOutputs": [],
"outputInitially": true,
"stateType": "str",
"enableInput": false,
"exposeToHomeAssistant": false,
"haConfig": [
{
"property": "name",
"value": ""
},
{
"property": "icon",
"value": ""
}
],
"x": 590,
"y": 3140,
"wires": [
[
"dfc3128d0785859f"
],
[]
]
},
{
"id": "dfc3128d0785859f",
"type": "change",
"z": "",
"name": "RESET",
"rules": [
{
"t": "set",
"p": "reset",
"pt": "msg",
"to": "true",
"tot": "bool"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "stop",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 735,
"y": 3140,
"wires": [
[
"3080c223c8c6115c"
]
],
"icon": "node-red/timer.svg",
"l": false
},
{
"id": "9216acef02755d31",
"type": "api-current-state",
"z": "",
"name": "Cont.?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "on",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_boolean.automations_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 455,
"y": 3100,
"wires": [
[
"a193889ded72d73c"
],
[]
],
"icon": "font-awesome/fa-question",
"l": false
},
{
"id": "dca9728b9274c959",
"type": "comment",
"z": "",
"name": "Set Garage Presence",
"info": "",
"x": 1640,
"y": 3100,
"wires": []
},
{
"id": "ff2324e86a07c978",
"type": "comment",
"z": "",
"name": "Reset",
"info": "This yellow timer node resets the timer that it's linked too. In this case, no message will be passed through.\n\nIt's useful in cases where something is scheduled but should no longer happen. ie. the Bedroom is about to be set to \"Empty\" but then there is new motion in there.",
"x": 770,
"y": 3180,
"wires": []
},
{
"id": "434ec0a9751d0b0e",
"type": "comment",
"z": "",
"name": "Garage Not Occupied",
"info": "",
"x": 200,
"y": 3100,
"wires": []
},
{
"id": "43697459c34be5e7",
"type": "api-current-state",
"z": "",
"name": "Garage Motion?",
"server": "",
"version": 3,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "binary_sensor.garage_motion",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "garage_motion",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "garage_motion_data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1105,
"y": 3720,
"wires": [
[
"ff36b39d694fd758"
]
],
"icon": "font-awesome/fa-child",
"l": false
},
{
"id": "68432d44d2f55ab2",
"type": "change",
"z": "",
"name": "Set Garage",
"rules": [
{
"t": "set",
"p": "new_room_to_set",
"pt": "msg",
"to": "Garage",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1530,
"y": 4300,
"wires": [
[
"e48a65fc33d00cd2",
"685d18700def8f97"
]
]
},
{
"id": "d67b6ecb98f5e08d",
"type": "switch",
"z": "",
"name": "!In Bed?",
"property": "bed_presence",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "off/not automated",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 775,
"y": 4300,
"wires": [
[
"82c5cb21cec658bf"
],
[
"fdfb547d4756f818"
]
],
"icon": "font-awesome/fa-bed",
"l": false
},
{
"id": "cee9477c6d93df67",
"type": "switch",
"z": "",
"name": "Garage !Set?",
"property": "person_location",
"propertyType": "msg",
"rules": [
{
"t": "neq",
"v": "Garage",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 410,
"y": 4300,
"wires": [
[
"6b59cb93cb6ea096"
]
]
},
{
"id": "82c5cb21cec658bf",
"type": "switch",
"z": "",
"name": "Garage Motion event <2min ago?",
"property": "garage_motion_data.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "lte",
"v": "120000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 960,
"y": 4300,
"wires": [
[
"2aed4311350660ab"
],
[
"44547407619fd352"
]
]
},
{
"id": "44547407619fd352",
"type": "switch",
"z": "",
"name": "BLE Same for >2min?",
"property": "ble_room_data.new_state.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "gte",
"v": "120000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "false",
"repair": true,
"outputs": 2,
"x": 1280,
"y": 4340,
"wires": [
[
"0d237769f0ed50a6"
],
[
"e0a698771fbbf6b4"
]
]
},
{
"id": "e0a698771fbbf6b4",
"type": "delay",
"z": "",
"name": "",
"pauseType": "delay",
"timeout": "30",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 1475,
"y": 4340,
"wires": [
[
"0f250f15873fc486"
]
],
"l": false
},
{
"id": "205bf8e33ac808de",
"type": "link out",
"z": "",
"name": "link out 33",
"mode": "link",
"links": [
"d47ac6d0e6641e7a"
],
"x": 1575,
"y": 4340,
"wires": []
},
{
"id": "0f250f15873fc486",
"type": "api-current-state",
"z": "",
"name": "refresh",
"server": "",
"version": 3,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "{{id}}",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
},
{
"property": "id",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1525,
"y": 4340,
"wires": [
[
"205bf8e33ac808de"
]
],
"icon": "font-awesome/fa-refresh",
"l": false
},
{
"id": "e48a65fc33d00cd2",
"type": "change",
"z": "",
"name": "RESET",
"rules": [
{
"t": "set",
"p": "reset",
"pt": "msg",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1695,
"y": 4300,
"wires": [
[
"e0a698771fbbf6b4"
]
],
"icon": "node-red/timer.svg",
"l": false
},
{
"id": "05ee32c899caf5d2",
"type": "change",
"z": "",
"name": "RESET",
"rules": [
{
"t": "set",
"p": "reset",
"pt": "msg",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 925,
"y": 5140,
"wires": [
[
"6921c3f95c880c98",
"d0fe968445edde63"
]
],
"icon": "node-red/timer.svg",
"l": false
},
{
"id": "6921c3f95c880c98",
"type": "trigger",
"z": "",
"name": "",
"op1": "",
"op2": "",
"op1type": "nul",
"op2type": "payl",
"duration": "15",
"extend": true,
"overrideDelay": false,
"units": "s",
"reset": "stop",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 995,
"y": 5160,
"wires": [
[
"d0fe968445edde63"
]
],
"l": false
},
{
"id": "73200755654c4319",
"type": "api-current-state",
"z": "",
"name": "Garage !Empty?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Empty",
"halt_if_type": "str",
"halt_if_compare": "is_not",
"entity_id": "input_select.garage_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 860,
"y": 5180,
"wires": [
[
"6921c3f95c880c98"
],
[]
]
},
{
"id": "26a6c4f77495ed14",
"type": "comment",
"z": "",
"name": "Set Garage Presence",
"info": "",
"x": 1200,
"y": 5140,
"wires": []
},
{
"id": "1f3751a7261cf52f",
"type": "function",
"z": "",
"name": "Garage Pres.",
"func": "// @ts-nocheck\n//code modified from: https://community.home-assistant.io/t/examples-for-using-the-new-get-entities-node/85777/4\nconst globalHomeAssistant = global.get('homeassistant');\nconst ha = globalHomeAssistant.homeAssistant;\nconst groupEntity = ha.states['group.presence'];\nlet occupants = [];\n\n//*******Just change the room below to whichever room the flow is for*******\n\nroom = \"Garage\"; //Room should be whatever input_select.*room*_presence would be set to\n //eg Bedroom or Living Room (capitalised and with a space if required)\n//Next, set up the variable that is the flow variable indicating generic room presence - this is checked further down\ngeneric_room_presence = room.replace(\" \", \"_\") + \"_generic_presence\";\n\ngroupEntity.attributes.entity_id.forEach(i => {\n if(ha.states[i].state === room) {\n occupants.push(ha.states[i].attributes.friendly_name.replace(\" Home Presence\", \"\"));\n //The push bit adds the friendly name of any persons location input select which matches the state (ie Living Room)\n //The replace bit clears the Location part from the friendly name leaving just the initials. \n }\n});\n\n//the join function creates '+' separated string from the array.\noccupants = occupants.join(' + ');\n\n//If no BLE occupation is detected but Generic Room Presence is detected (motion/bed/TV etc.), set the room to Someone\n//Otherwise with no BLE or Generic Presence, set to Empty \nif (occupants === '') {\n if (flow.get(generic_room_presence) === true) {\n occupants = \"Someone\";\n } else {\n occupants = \"Empty\";\n }\n}\n\n//if (occupants === '') {\n// occupants = \"Empty\"\n//}\n\nmsg.payload = { data: { \"option\": occupants} };\n\n//Output to top channel by default but to bottom channel if room will be set to Empty\nif (occupants == \"Empty\") {\n return [ null, msg ];\n} else {\n return [ msg, null ];\n}",
"outputs": 2,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 630,
"y": 5160,
"wires": [
[
"72af4a2dcb918416"
],
[
"e4d6a858f82f791c"
]
]
},
{
"id": "ba4f373821108a6e",
"type": "link in",
"z": "",
"name": "Set Garage Presence",
"links": [
"b146a253a7da8984",
"e04e49c62892b725",
"d0fe968445edde63"
],
"x": 135,
"y": 360,
"wires": [
[
"a79f00257fbd793b"
]
]
},
{
"id": "b146a253a7da8984",
"type": "link out",
"z": "",
"name": "link out 34",
"mode": "link",
"links": [
"ba4f373821108a6e",
"1daa70e0300df733"
],
"x": 1865,
"y": 2240,
"wires": []
},
{
"id": "e04e49c62892b725",
"type": "link out",
"z": "",
"name": "link out 35",
"mode": "link",
"links": [
"ba4f373821108a6e"
],
"x": 1495,
"y": 3100,
"wires": []
},
{
"id": "7814ee55f186d3e1",
"type": "link in",
"z": "",
"name": "Garage Empty",
"links": [
"19c7a5ce03745742",
"a7ee6651db14216b",
"958537e74f19a8d7",
"bdb56111ba0f5dc1",
"468156f32dff62fd",
"e1beccd45eb10753",
"370a63c1899b6f2c",
"55f442e87f3c795a"
],
"x": 1345,
"y": 3140,
"wires": [
[
"19c30cffcf9f2dfe"
]
]
},
{
"id": "0329b34ecdc49d5b",
"type": "link out",
"z": "",
"name": "link out 36",
"mode": "link",
"links": [
"14ad2074c86c4e40",
"15ea49710908994f",
"4ae96d1498756139",
"575904114c55950b",
"a81529e82d19e178",
"e16de7e03ce1be65",
"96535f9f66d5917c",
"ffe42bdc0c303198"
],
"x": 1705,
"y": 1920,
"wires": []
},
{
"id": "1daa70e0300df733",
"type": "link in",
"z": "",
"name": "Reset Garage to Empty Timer",
"links": [
"f9a73b276d8f506a",
"b146a253a7da8984"
],
"x": 675,
"y": 3180,
"wires": [
[
"dfc3128d0785859f"
]
]
},
{
"id": "f9a73b276d8f506a",
"type": "link out",
"z": "",
"name": "Garage Motion",
"mode": "link",
"links": [
"1daa70e0300df733",
"46cb934e637a41d6",
"888a4e066cfe5bd7"
],
"x": 1285,
"y": 1480,
"wires": []
},
{
"id": "1a963e984d49ec84",
"type": "link out",
"z": "",
"name": "Garage Motion Cleared",
"mode": "link",
"links": [
"1784403338f2526a",
"8b60cf6b072d3bb8"
],
"x": 1285,
"y": 1520,
"wires": []
},
{
"id": "2ce07df23edb3231",
"type": "comment",
"z": "",
"name": "Garage Occupied",
"info": "",
"x": 1420,
"y": 1480,
"wires": []
},
{
"id": "a239f1a0cb9868f7",
"type": "comment",
"z": "",
"name": "Garage Not Occupied",
"info": "",
"x": 1440,
"y": 1520,
"wires": []
},
{
"id": "46cb934e637a41d6",
"type": "link in",
"z": "",
"name": "link in 9",
"links": [
"f9a73b276d8f506a"
],
"x": 1615,
"y": 1480,
"wires": [
[
"9a2139c12a4e3943"
]
]
},
{
"id": "1784403338f2526a",
"type": "link in",
"z": "",
"name": "link in 10",
"links": [
"1a963e984d49ec84"
],
"x": 1615,
"y": 1520,
"wires": [
[
"93b3bff0d2ab4af3"
]
]
},
{
"id": "6d8f3785010acfdb",
"type": "change",
"z": "",
"name": "Garage",
"rules": [
{
"t": "set",
"p": "room",
"pt": "msg",
"to": "Garage",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 460,
"y": 2060,
"wires": [
[
"7b4f2a2.719dfd4"
]
]
},
{
"id": "888a4e066cfe5bd7",
"type": "link in",
"z": "",
"name": "",
"links": [
"f9a73b276d8f506a"
],
"x": 325,
"y": 2060,
"wires": [
[
"6d8f3785010acfdb"
]
]
},
{
"id": "6567a4d1a0a960c6",
"type": "comment",
"z": "",
"name": "Garage Occupied",
"info": "",
"x": 150,
"y": 2060,
"wires": []
},
{
"id": "8b60cf6b072d3bb8",
"type": "link in",
"z": "",
"name": "Garage Motion Reset",
"links": [
"1a963e984d49ec84"
],
"x": 395,
"y": 3100,
"wires": [
[
"9216acef02755d31"
]
]
},
{
"id": "d0fe968445edde63",
"type": "link out",
"z": "",
"name": "link out 37",
"mode": "link",
"links": [
"ba4f373821108a6e"
],
"x": 1055,
"y": 5140,
"wires": []
},
{
"id": "e2ef925c0f077f45",
"type": "api-current-state",
"z": "",
"name": "Asleep?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Sleeping",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_select.guestroom_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1485,
"y": 2160,
"wires": [
[],
[
"e56757ad5b740bca"
]
],
"icon": "font-awesome/fa-moon-o",
"l": false
},
{
"id": "4832696c2877a00d",
"type": "api-current-state",
"z": "",
"name": "Asleep?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Sleeping",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_select.guestroom_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 455,
"y": 5000,
"wires": [
[],
[
"1e8bd07503882cdd"
]
],
"icon": "font-awesome/fa-moon-o",
"l": false
},
{
"id": "940d52b3c99050f4",
"type": "api-call-service",
"z": "",
"name": "Set Kitchen Pres.",
"server": "",
"version": 7,
"debugenabled": false,
"action": "input_select.select_option",
"floorId": [],
"areaId": [],
"deviceId": [],
"entityId": [
"input_select.kitchen_presence"
],
"labelId": [],
"data": "",
"dataType": "json",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "data"
}
],
"queue": "none",
"blockInputOverrides": false,
"domain": "input_select",
"service": "select_option",
"output_location": "payload",
"output_location_type": "msg",
"x": 270,
"y": 400,
"wires": [
[]
]
},
{
"id": "48bd0ffb8e2b6ad3",
"type": "link in",
"z": "",
"name": "Set Garage Presence",
"links": [
"e901df280577c5bb",
"e385d8b8fe294589",
"fd0a8fb369e4dc82"
],
"x": 135,
"y": 400,
"wires": [
[
"940d52b3c99050f4"
]
]
},
{
"id": "8b5dff3e1a48a728",
"type": "link in",
"z": "",
"name": "",
"links": [
"de244cb685c8832d"
],
"x": 325,
"y": 2100,
"wires": [
[
"9df80f1c7201fe54"
]
]
},
{
"id": "9df80f1c7201fe54",
"type": "change",
"z": "",
"name": "Kitchen",
"rules": [
{
"t": "set",
"p": "room",
"pt": "msg",
"to": "Kitchen",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 460,
"y": 2100,
"wires": [
[
"7b4f2a2.719dfd4"
]
]
},
{
"id": "7e7dde3adf59bd31",
"type": "comment",
"z": "",
"name": "Kitchen Occupied",
"info": "",
"x": 150,
"y": 2100,
"wires": []
},
{
"id": "1cf74401c34c0d28",
"type": "api-current-state",
"z": "",
"name": "Empty?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Empty",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_select.kitchen_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1600,
"y": 2280,
"wires": [
[
"454ca45d69f04751"
],
[]
]
},
{
"id": "454ca45d69f04751",
"type": "function",
"z": "",
"name": "Someone",
"func": "// @ts-nocheck\nnewmsg = {};\nnewmsg.payload = { data: { \"option\": \"Someone\"} }; \nreturn newmsg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1760,
"y": 2280,
"wires": [
[
"e901df280577c5bb"
]
]
},
{
"id": "e901df280577c5bb",
"type": "link out",
"z": "",
"name": "link out 57",
"mode": "link",
"links": [
"48bd0ffb8e2b6ad3",
"d38f4093127dc9d6"
],
"x": 1865,
"y": 2280,
"wires": []
},
{
"id": "b2dd8d0bfa4bcca5",
"type": "comment",
"z": "",
"name": "Set Kitchen Presence",
"info": "",
"x": 2000,
"y": 2280,
"wires": []
},
{
"id": "476b8adf48332891",
"type": "change",
"z": "",
"name": "Set Kitchen",
"rules": [
{
"t": "set",
"p": "new_room_to_set",
"pt": "msg",
"to": "Kitchen",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1530,
"y": 4380,
"wires": [
[
"c1b0fe451d2f9337",
"4e940cdc9f2c2d11"
]
]
},
{
"id": "e6f7fa9dff8c5e3d",
"type": "switch",
"z": "",
"name": "!In Bed?",
"property": "bed_presence",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "off/not automated",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 775,
"y": 4380,
"wires": [
[
"3940d9754df35332"
],
[
"c4862776e5afda51"
]
],
"icon": "font-awesome/fa-bed",
"l": false
},
{
"id": "56f99bda7a717a16",
"type": "switch",
"z": "",
"name": "Kitchen !Set?",
"property": "person_location",
"propertyType": "msg",
"rules": [
{
"t": "neq",
"v": "Kitchen",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 420,
"y": 4380,
"wires": [
[
"badc07f9fe505cea"
]
]
},
{
"id": "3940d9754df35332",
"type": "switch",
"z": "",
"name": "Kitchen Motion event <2min ago?",
"property": "kitchen_motion_data.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "lte",
"v": "120000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 960,
"y": 4380,
"wires": [
[
"e2173851839010ef"
],
[
"e09655fcd346aec0"
]
]
},
{
"id": "e09655fcd346aec0",
"type": "switch",
"z": "",
"name": "BLE Same for >2min?",
"property": "ble_room_data.new_state.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "gte",
"v": "120000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "false",
"repair": true,
"outputs": 2,
"x": 1280,
"y": 4420,
"wires": [
[
"c07a9d0750499f90"
],
[
"b0fa5c63cc79e63f"
]
]
},
{
"id": "b0fa5c63cc79e63f",
"type": "delay",
"z": "",
"name": "",
"pauseType": "delay",
"timeout": "30",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 1475,
"y": 4420,
"wires": [
[
"561712318ba0aeaa"
]
],
"l": false
},
{
"id": "55a7b3ba61cdbad0",
"type": "link out",
"z": "",
"name": "link out 58",
"mode": "link",
"links": [
"d47ac6d0e6641e7a"
],
"x": 1575,
"y": 4420,
"wires": []
},
{
"id": "561712318ba0aeaa",
"type": "api-current-state",
"z": "",
"name": "refresh",
"server": "",
"version": 3,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "{{id}}",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
},
{
"property": "id",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1525,
"y": 4420,
"wires": [
[
"55a7b3ba61cdbad0"
]
],
"icon": "font-awesome/fa-refresh",
"l": false
},
{
"id": "c1b0fe451d2f9337",
"type": "change",
"z": "",
"name": "RESET",
"rules": [
{
"t": "set",
"p": "reset",
"pt": "msg",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1695,
"y": 4380,
"wires": [
[
"b0fa5c63cc79e63f"
]
],
"icon": "node-red/timer.svg",
"l": false
},
{
"id": "8b3067f68c3919d2",
"type": "change",
"z": "",
"name": "RESET",
"rules": [
{
"t": "set",
"p": "reset",
"pt": "msg",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 925,
"y": 5220,
"wires": [
[
"73f64cedbd8081bc",
"e385d8b8fe294589"
]
],
"icon": "node-red/timer.svg",
"l": false
},
{
"id": "73f64cedbd8081bc",
"type": "trigger",
"z": "",
"name": "",
"op1": "",
"op2": "",
"op1type": "nul",
"op2type": "payl",
"duration": "15",
"extend": true,
"overrideDelay": false,
"units": "s",
"reset": "stop",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 995,
"y": 5240,
"wires": [
[
"e385d8b8fe294589"
]
],
"l": false
},
{
"id": "d9427be664062c44",
"type": "api-current-state",
"z": "",
"name": "Kitchen !Empty?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Empty",
"halt_if_type": "str",
"halt_if_compare": "is_not",
"entity_id": "input_select.kitchen_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 860,
"y": 5260,
"wires": [
[
"73f64cedbd8081bc"
],
[]
]
},
{
"id": "28d01a350294e823",
"type": "comment",
"z": "",
"name": "Set Kitchen Presence",
"info": "",
"x": 1200,
"y": 5220,
"wires": []
},
{
"id": "fe7909104ebf94e0",
"type": "function",
"z": "",
"name": "Kitchen Pres.",
"func": "// @ts-nocheck\n//code modified from: https://community.home-assistant.io/t/examples-for-using-the-new-get-entities-node/85777/4\nconst globalHomeAssistant = global.get('homeassistant');\nconst ha = globalHomeAssistant.homeAssistant;\nconst groupEntity = ha.states['group.presence'];\nlet occupants = [];\n\n//*******Just change the room below to whichever room the flow is for*******\n\nroom = \"Kitchen\"; //Room should be whatever input_select.*room*_presence would be set to\n //eg Bedroom or Living Room (capitalised and with a space if required)\n//Next, set up the variable that is the flow variable indicating generic room presence - this is checked further down\ngeneric_room_presence = room.replace(\" \", \"_\") + \"_generic_presence\";\n\ngroupEntity.attributes.entity_id.forEach(i => {\n if(ha.states[i].state === room) {\n occupants.push(ha.states[i].attributes.friendly_name.replace(\" Home Presence\", \"\"));\n //The push bit adds the friendly name of any persons location input select which matches the state (ie Living Room)\n //The replace bit clears the Location part from the friendly name leaving just the initials. \n }\n});\n\n//the join function creates '+' separated string from the array.\noccupants = occupants.join(' + ');\n\n//If no BLE occupation is detected but Generic Room Presence is detected (motion/bed/TV etc.), set the room to Someone\n//Otherwise with no BLE or Generic Presence, set to Empty \nif (occupants === '') {\n if (flow.get(generic_room_presence) === true) {\n occupants = \"Someone\";\n } else {\n occupants = \"Empty\";\n }\n}\n\n//if (occupants === '') {\n// occupants = \"Empty\"\n//}\n\nmsg.payload = { data: { \"option\": occupants} };\n\n//Output to top channel by default but to bottom channel if room will be set to Empty\nif (occupants == \"Empty\") {\n return [ null, msg ];\n} else {\n return [ msg, null ];\n}",
"outputs": 2,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 630,
"y": 5240,
"wires": [
[
"89ab12f26465f158"
],
[
"371f9febc6c20fda"
]
]
},
{
"id": "e385d8b8fe294589",
"type": "link out",
"z": "",
"name": "link out 59",
"mode": "link",
"links": [
"48bd0ffb8e2b6ad3"
],
"x": 1055,
"y": 5220,
"wires": []
},
{
"id": "de244cb685c8832d",
"type": "link out",
"z": "",
"name": "Office Motion",
"mode": "link",
"links": [
"bee048bc461be066",
"8b5dff3e1a48a728",
"d38f4093127dc9d6"
],
"x": 315,
"y": 1680,
"wires": []
},
{
"id": "bee048bc461be066",
"type": "link in",
"z": "",
"name": "",
"links": [
"de244cb685c8832d"
],
"x": 635,
"y": 1680,
"wires": [
[
"344224753a998b98"
]
]
},
{
"id": "189f902c1540265d",
"type": "comment",
"z": "",
"name": "Kitchen Occupied",
"info": "",
"x": 440,
"y": 1680,
"wires": []
},
{
"id": "eefe74429c929d24",
"type": "comment",
"z": "",
"name": "Kitchen Not Occupied",
"info": "",
"x": 460,
"y": 1720,
"wires": []
},
{
"id": "5aaeef1947cc4b1d",
"type": "link out",
"z": "",
"name": "Office Motion Cleared",
"mode": "link",
"links": [
"82b80fbe2fd7a479",
"6645d5d9a4409fcf"
],
"x": 315,
"y": 1720,
"wires": []
},
{
"id": "82b80fbe2fd7a479",
"type": "link in",
"z": "",
"name": "",
"links": [
"5aaeef1947cc4b1d"
],
"x": 635,
"y": 1720,
"wires": [
[
"754f6e27f99412bd"
]
]
},
{
"id": "344224753a998b98",
"type": "change",
"z": "",
"name": "Kitchen Generic Presence to TRUE",
"rules": [
{
"t": "set",
"p": "Kitchen_generic_presence",
"pt": "flow",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 820,
"y": 1680,
"wires": [
[]
]
},
{
"id": "754f6e27f99412bd",
"type": "change",
"z": "",
"name": "Kitchen Generic Presence to FALSE",
"rules": [
{
"t": "set",
"p": "Kitchen_generic_presence",
"pt": "flow",
"to": "false",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 830,
"y": 1720,
"wires": [
[]
]
},
{
"id": "5fc1bc6a3e110776",
"type": "server-state-changed",
"z": "",
"name": "Kitchen Motion?",
"server": "",
"version": 6,
"outputs": 2,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"binary_sensor.kitchen_motion"
],
"substring": [],
"regex": []
},
"outputInitially": true,
"stateType": "str",
"ifState": "on",
"ifStateType": "str",
"ifStateOperator": "is",
"outputOnlyOnStateChange": true,
"for": "0",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": true,
"ignoreCurrentStateUnavailable": true,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 180,
"y": 1700,
"wires": [
[
"de244cb685c8832d"
],
[
"5aaeef1947cc4b1d"
]
]
},
{
"id": "7f2ef3b20909439c",
"type": "trigger",
"z": "",
"name": "15s",
"op1": "",
"op2": "",
"op1type": "nul",
"op2type": "payl",
"duration": "15",
"extend": true,
"overrideDelay": false,
"units": "s",
"reset": "stop",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 830,
"y": 3220,
"wires": [
[
"38c6fe9f8d2037c0"
]
]
},
{
"id": "38c6fe9f8d2037c0",
"type": "function",
"z": "",
"name": "Empty",
"func": "// @ts-nocheck\nnewmsg = {};\nnewmsg.payload = { data: { \"option\": \"Empty\"} }; \nreturn newmsg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1430,
"y": 3220,
"wires": [
[
"fd0a8fb369e4dc82"
]
]
},
{
"id": "b3b0c27bb35d629e",
"type": "api-current-state",
"z": "",
"name": "Kitchen Someone?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Someone",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_select.kitchen_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 590,
"y": 3220,
"wires": [
[
"7f2ef3b20909439c"
],
[]
]
},
{
"id": "fc81739d0e1f6b25",
"type": "trigger-state",
"z": "",
"name": "Kitchen !Someone",
"server": "",
"version": 5,
"inputs": 0,
"outputs": 2,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"input_select.kitchen_presence"
],
"substring": [],
"regex": []
},
"debugEnabled": false,
"constraints": [
{
"targetType": "this_entity",
"targetValue": "",
"propertyType": "current_state",
"propertyValue": "new_state.state",
"comparatorType": "is_not",
"comparatorValueDatatype": "str",
"comparatorValue": "Someone"
}
],
"customOutputs": [],
"outputInitially": true,
"stateType": "str",
"enableInput": false,
"exposeToHomeAssistant": false,
"haConfig": [
{
"property": "name",
"value": ""
},
{
"property": "icon",
"value": ""
}
],
"x": 590,
"y": 3260,
"wires": [
[
"4d0baeaaf9274d01"
],
[]
]
},
{
"id": "4d0baeaaf9274d01",
"type": "change",
"z": "",
"name": "RESET",
"rules": [
{
"t": "set",
"p": "reset",
"pt": "msg",
"to": "true",
"tot": "bool"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "stop",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 735,
"y": 3260,
"wires": [
[
"7f2ef3b20909439c"
]
],
"icon": "node-red/timer.svg",
"l": false
},
{
"id": "b375be4ec7792e4f",
"type": "api-current-state",
"z": "",
"name": "Cont.?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "on",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_boolean.automations_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 455,
"y": 3220,
"wires": [
[
"b3b0c27bb35d629e"
],
[]
],
"icon": "font-awesome/fa-question",
"l": false
},
{
"id": "ba63d718f292d55c",
"type": "comment",
"z": "",
"name": "Set Kitchen Presence",
"info": "",
"x": 1640,
"y": 3220,
"wires": []
},
{
"id": "f4b072ab3aaff2e4",
"type": "comment",
"z": "",
"name": "Reset",
"info": "This yellow timer node resets the timer that it's linked too. In this case, no message will be passed through.\n\nIt's useful in cases where something is scheduled but should no longer happen. ie. the Bedroom is about to be set to \"Empty\" but then there is new motion in there.",
"x": 770,
"y": 3300,
"wires": []
},
{
"id": "a29cf796bbf0394a",
"type": "comment",
"z": "",
"name": "Kitchen Not Occupied",
"info": "",
"x": 200,
"y": 3220,
"wires": []
},
{
"id": "fd0a8fb369e4dc82",
"type": "link out",
"z": "",
"name": "link out 70",
"mode": "link",
"links": [
"48bd0ffb8e2b6ad3"
],
"x": 1495,
"y": 3220,
"wires": []
},
{
"id": "e16de7e03ce1be65",
"type": "link in",
"z": "",
"name": "Garage Empty",
"links": [
"19c7a5ce03745742",
"a7ee6651db14216b",
"958537e74f19a8d7",
"bdb56111ba0f5dc1",
"468156f32dff62fd",
"0329b34ecdc49d5b",
"370a63c1899b6f2c",
"55f442e87f3c795a"
],
"x": 1345,
"y": 3260,
"wires": [
[
"38c6fe9f8d2037c0"
]
]
},
{
"id": "d38f4093127dc9d6",
"type": "link in",
"z": "",
"name": "Reset Garage to Empty Timer",
"links": [
"de244cb685c8832d",
"e901df280577c5bb"
],
"x": 675,
"y": 3300,
"wires": [
[
"4d0baeaaf9274d01"
]
]
},
{
"id": "6645d5d9a4409fcf",
"type": "link in",
"z": "",
"name": "Garage Motion Reset",
"links": [
"5aaeef1947cc4b1d"
],
"x": 395,
"y": 3220,
"wires": [
[
"b375be4ec7792e4f"
]
]
},
{
"id": "e1beccd45eb10753",
"type": "link out",
"z": "",
"name": "link out 71",
"mode": "link",
"links": [
"4ae96d1498756139",
"15ea49710908994f",
"575904114c55950b",
"a81529e82d19e178",
"14ad2074c86c4e40",
"7814ee55f186d3e1",
"96535f9f66d5917c",
"ffe42bdc0c303198"
],
"x": 1745,
"y": 1940,
"wires": []
},
{
"id": "ff36b39d694fd758",
"type": "api-current-state",
"z": "",
"name": "Kitchen Motion?",
"server": "",
"version": 3,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "binary_sensor.kitchen_motion",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "kitchen_motion",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "kitchen_motion_data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1165,
"y": 3760,
"wires": [
[
"0c8530a32eb8b18e"
]
],
"icon": "font-awesome/fa-child",
"l": false
},
{
"id": "22447c3ae1949e1a",
"type": "link in",
"z": "",
"name": "link in 37",
"links": [
"d5ac397b122a8ca4"
],
"x": 1255,
"y": 2200,
"wires": [
[
"ce079eff.8fd8e"
]
]
},
{
"id": "d5ac397b122a8ca4",
"type": "link out",
"z": "",
"name": "link out 86",
"mode": "link",
"links": [
"22447c3ae1949e1a"
],
"x": 1285,
"y": 2040,
"wires": []
},
{
"id": "b96603747250fcbf",
"type": "api-call-service",
"z": "",
"name": "Set Bedroom Pres.",
"server": "",
"version": 7,
"debugenabled": false,
"action": "input_select.select_option",
"floorId": [],
"areaId": [],
"deviceId": [],
"entityId": [
"input_select.bedroom_presence"
],
"labelId": [],
"data": "",
"dataType": "json",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "data"
}
],
"queue": "none",
"blockInputOverrides": false,
"domain": "input_select",
"service": "select_option",
"output_location": "payload",
"output_location_type": "msg",
"x": 270,
"y": 480,
"wires": [
[]
]
},
{
"id": "abfc553db015513f",
"type": "link in",
"z": "",
"name": "Set Garage Presence",
"links": [
"084e031e45d25332",
"c3e98852935fd6eb",
"e74595b44d2aeadf"
],
"x": 135,
"y": 480,
"wires": [
[
"b96603747250fcbf"
]
]
},
{
"id": "dda1743752157f81",
"type": "server-state-changed",
"z": "",
"name": "Bedroom Motion?",
"server": "",
"version": 6,
"outputs": 2,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"binary_sensor.bedroom_motion"
],
"substring": [],
"regex": []
},
"outputInitially": true,
"stateType": "str",
"ifState": "on",
"ifStateType": "str",
"ifStateOperator": "is",
"outputOnlyOnStateChange": true,
"for": "0",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": true,
"ignoreCurrentStateUnavailable": true,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 1150,
"y": 1600,
"wires": [
[
"e5299593a3530629"
],
[
"d1baa71a0f7794a3"
]
]
},
{
"id": "48db6d24863e6b7c",
"type": "change",
"z": "",
"name": "Bedroom Generic Presence to TRUE",
"rules": [
{
"t": "set",
"p": "Bedroom_generic_presence",
"pt": "flow",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1810,
"y": 1580,
"wires": [
[]
]
},
{
"id": "37dbb30530ccb80f",
"type": "change",
"z": "",
"name": "Bedroom Generic Presence to FALSE",
"rules": [
{
"t": "set",
"p": "Bedroom_generic_presence",
"pt": "flow",
"to": "false",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1810,
"y": 1620,
"wires": [
[]
]
},
{
"id": "e5299593a3530629",
"type": "link out",
"z": "",
"name": "Garage Motion",
"mode": "link",
"links": [
"c71f32b96a9a749d",
"8ec7a48fb9ac101d",
"c0288a6036aef2c7"
],
"x": 1285,
"y": 1580,
"wires": []
},
{
"id": "d1baa71a0f7794a3",
"type": "link out",
"z": "",
"name": "Garage Motion Cleared",
"mode": "link",
"links": [
"5cfcdec76dfe56b4",
"4c98e36adf673711"
],
"x": 1285,
"y": 1620,
"wires": []
},
{
"id": "6599a7c273c49c11",
"type": "comment",
"z": "",
"name": "Bedroom Occupied",
"info": "",
"x": 1430,
"y": 1580,
"wires": []
},
{
"id": "f2a8c747e55585c3",
"type": "comment",
"z": "",
"name": "Bedroom Not Occupied",
"info": "",
"x": 1440,
"y": 1620,
"wires": []
},
{
"id": "c71f32b96a9a749d",
"type": "link in",
"z": "",
"name": "link in 41",
"links": [
"e5299593a3530629"
],
"x": 1615,
"y": 1580,
"wires": [
[
"48db6d24863e6b7c"
]
]
},
{
"id": "5cfcdec76dfe56b4",
"type": "link in",
"z": "",
"name": "link in 42",
"links": [
"d1baa71a0f7794a3"
],
"x": 1615,
"y": 1620,
"wires": [
[
"37dbb30530ccb80f"
]
]
},
{
"id": "8ec7a48fb9ac101d",
"type": "link in",
"z": "",
"name": "",
"links": [
"e5299593a3530629"
],
"x": 325,
"y": 2140,
"wires": [
[
"e31db382f4dbe304"
]
]
},
{
"id": "e31db382f4dbe304",
"type": "change",
"z": "",
"name": "Bedroom",
"rules": [
{
"t": "set",
"p": "room",
"pt": "msg",
"to": "Bedroom",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 460,
"y": 2140,
"wires": [
[
"7b4f2a2.719dfd4"
]
]
},
{
"id": "c71def14bbc8dc88",
"type": "comment",
"z": "",
"name": "Bedroom Occupied",
"info": "",
"x": 160,
"y": 2140,
"wires": []
},
{
"id": "370a63c1899b6f2c",
"type": "link out",
"z": "",
"name": "link out 90",
"mode": "link",
"links": [
"4ae96d1498756139",
"15ea49710908994f",
"575904114c55950b",
"a81529e82d19e178",
"14ad2074c86c4e40",
"7814ee55f186d3e1",
"e16de7e03ce1be65",
"ffe42bdc0c303198"
],
"x": 1705,
"y": 1960,
"wires": []
},
{
"id": "363d6b9bf33a4151",
"type": "api-current-state",
"z": "",
"name": "Empty?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Empty",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_select.bedroom_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1600,
"y": 2320,
"wires": [
[
"f1dde3274874f966"
],
[]
]
},
{
"id": "f1dde3274874f966",
"type": "function",
"z": "",
"name": "Someone",
"func": "// @ts-nocheck\nnewmsg = {};\nnewmsg.payload = { data: { \"option\": \"Someone\"} }; \nreturn newmsg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1760,
"y": 2320,
"wires": [
[
"084e031e45d25332"
]
]
},
{
"id": "084e031e45d25332",
"type": "link out",
"z": "",
"name": "link out 91",
"mode": "link",
"links": [
"abfc553db015513f",
"c0288a6036aef2c7"
],
"x": 1865,
"y": 2320,
"wires": []
},
{
"id": "c28b1aed36da990c",
"type": "comment",
"z": "",
"name": "Set Bedroom Presence",
"info": "",
"x": 2000,
"y": 2320,
"wires": []
},
{
"id": "6bb9b690727f4622",
"type": "api-current-state",
"z": "",
"name": "Asleep?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Sleeping",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_select.bedroom_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1485,
"y": 2320,
"wires": [
[],
[
"363d6b9bf33a4151"
]
],
"icon": "font-awesome/fa-moon-o",
"l": false
},
{
"id": "1ac6ed82b0230bc6",
"type": "change",
"z": "",
"name": "RESET",
"rules": [
{
"t": "set",
"p": "reset",
"pt": "msg",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 925,
"y": 5300,
"wires": [
[
"1ef628628256592b",
"c3e98852935fd6eb"
]
],
"icon": "node-red/timer.svg",
"l": false
},
{
"id": "1ef628628256592b",
"type": "trigger",
"z": "",
"name": "",
"op1": "",
"op2": "",
"op1type": "nul",
"op2type": "payl",
"duration": "15",
"extend": true,
"overrideDelay": false,
"units": "s",
"reset": "stop",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 995,
"y": 5320,
"wires": [
[
"c3e98852935fd6eb"
]
],
"l": false
},
{
"id": "234977093ae90704",
"type": "api-current-state",
"z": "",
"name": "Bedroom !Empty?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Empty",
"halt_if_type": "str",
"halt_if_compare": "is_not",
"entity_id": "input_select.bedroom_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 850,
"y": 5340,
"wires": [
[
"1ef628628256592b"
],
[]
]
},
{
"id": "a037172633e46c59",
"type": "comment",
"z": "",
"name": "Set Bedroom Presence",
"info": "",
"x": 1200,
"y": 5300,
"wires": []
},
{
"id": "ac9cf67b84610c57",
"type": "function",
"z": "",
"name": "Bedroom Pres.",
"func": "// @ts-nocheck\n//code modified from: https://community.home-assistant.io/t/examples-for-using-the-new-get-entities-node/85777/4\nconst globalHomeAssistant = global.get('homeassistant');\nconst ha = globalHomeAssistant.homeAssistant;\nconst groupEntity = ha.states['group.presence'];\nlet occupants = [];\n\n//*******Just change the room below to whichever room the flow is for*******\n\nroom = \"Bedroom\"; //Room should be whatever input_select.*room*_presence would be set to\n //eg Bedroom or Living Room (capitalised and with a space if required)\n//Next, set up the variable that is the flow variable indicating generic room presence - this is checked further down\ngeneric_room_presence = room.replace(\" \", \"_\") + \"_generic_presence\";\n\ngroupEntity.attributes.entity_id.forEach(i => {\n if(ha.states[i].state === room) {\n occupants.push(ha.states[i].attributes.friendly_name.replace(\" Home Presence\", \"\"));\n //The push bit adds the friendly name of any persons location input select which matches the state (ie Living Room)\n //The replace bit clears the Location part from the friendly name leaving just the initials. \n }\n});\n\n//the join function creates '+' separated string from the array.\noccupants = occupants.join(' + ');\n\n//If no BLE occupation is detected but Generic Room Presence is detected (motion/bed/TV etc.), set the room to Someone\n//Otherwise with no BLE or Generic Presence, set to Empty \nif (occupants === '') {\n if (flow.get(generic_room_presence) === true) {\n occupants = \"Someone\";\n } else {\n occupants = \"Empty\";\n }\n}\n\n//if (occupants === '') {\n// occupants = \"Empty\"\n//}\n\nmsg.payload = { data: { \"option\": occupants} };\n\n//Output to top channel by default but to bottom channel if room will be set to Empty\nif (occupants == \"Empty\") {\n return [ null, msg ];\n} else {\n return [ msg, null ];\n}",
"outputs": 2,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 620,
"y": 5320,
"wires": [
[
"2f8ec70d5c4a8922"
],
[
"15c7ab94d9b5b867"
]
]
},
{
"id": "c3e98852935fd6eb",
"type": "link out",
"z": "",
"name": "link out 92",
"mode": "link",
"links": [
"abfc553db015513f"
],
"x": 1055,
"y": 5300,
"wires": []
},
{
"id": "a3e8cbadb3c0b5f4",
"type": "trigger",
"z": "",
"name": "15s",
"op1": "",
"op2": "",
"op1type": "nul",
"op2type": "payl",
"duration": "15",
"extend": true,
"overrideDelay": false,
"units": "s",
"reset": "stop",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 830,
"y": 3340,
"wires": [
[
"7b494a1a1e9e4d4e"
]
]
},
{
"id": "58d12f4db155e274",
"type": "function",
"z": "",
"name": "Empty",
"func": "// @ts-nocheck\nnewmsg = {};\nnewmsg.payload = { data: { \"option\": \"Empty\"} }; \nreturn newmsg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1430,
"y": 3340,
"wires": [
[
"e74595b44d2aeadf"
]
]
},
{
"id": "8c0535e45b838cc9",
"type": "api-current-state",
"z": "",
"name": "Bedroom Someone?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Someone",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_select.bedroom_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 600,
"y": 3340,
"wires": [
[
"a3e8cbadb3c0b5f4"
],
[]
]
},
{
"id": "d902ac9685b50382",
"type": "trigger-state",
"z": "",
"name": "Bedroom !Someone",
"server": "",
"version": 5,
"inputs": 0,
"outputs": 2,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"input_select.bedroom_presence"
],
"substring": [],
"regex": []
},
"debugEnabled": false,
"constraints": [
{
"targetType": "this_entity",
"targetValue": "",
"propertyType": "current_state",
"propertyValue": "new_state.state",
"comparatorType": "is_not",
"comparatorValueDatatype": "str",
"comparatorValue": "Someone"
}
],
"customOutputs": [],
"outputInitially": true,
"stateType": "str",
"enableInput": false,
"exposeToHomeAssistant": false,
"haConfig": [
{
"property": "name",
"value": ""
},
{
"property": "icon",
"value": ""
}
],
"x": 590,
"y": 3380,
"wires": [
[
"231f13ed05398752"
],
[]
]
},
{
"id": "231f13ed05398752",
"type": "change",
"z": "",
"name": "RESET",
"rules": [
{
"t": "set",
"p": "reset",
"pt": "msg",
"to": "true",
"tot": "bool"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "stop",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 735,
"y": 3380,
"wires": [
[
"a3e8cbadb3c0b5f4"
]
],
"icon": "node-red/timer.svg",
"l": false
},
{
"id": "1bd3d0d788663172",
"type": "api-current-state",
"z": "",
"name": "Cont.?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "on",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_boolean.automations_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 455,
"y": 3340,
"wires": [
[
"8c0535e45b838cc9"
],
[]
],
"icon": "font-awesome/fa-question",
"l": false
},
{
"id": "cc65153fcea795f0",
"type": "comment",
"z": "",
"name": "Set Bedroom Presence",
"info": "",
"x": 1640,
"y": 3340,
"wires": []
},
{
"id": "93b93c8d993ea6f3",
"type": "comment",
"z": "",
"name": "Reset",
"info": "This yellow timer node resets the timer that it's linked too. In this case, no message will be passed through.\n\nIt's useful in cases where something is scheduled but should no longer happen. ie. the Bedroom is about to be set to \"Empty\" but then there is new motion in there.",
"x": 770,
"y": 3420,
"wires": []
},
{
"id": "53f8bab8d1811e32",
"type": "comment",
"z": "",
"name": "Bedroom Not Occupied",
"info": "",
"x": 200,
"y": 3340,
"wires": []
},
{
"id": "e74595b44d2aeadf",
"type": "link out",
"z": "",
"name": "link out 93",
"mode": "link",
"links": [
"abfc553db015513f"
],
"x": 1495,
"y": 3340,
"wires": []
},
{
"id": "96535f9f66d5917c",
"type": "link in",
"z": "",
"name": "Garage Empty",
"links": [
"19c7a5ce03745742",
"a7ee6651db14216b",
"958537e74f19a8d7",
"bdb56111ba0f5dc1",
"468156f32dff62fd",
"0329b34ecdc49d5b",
"e1beccd45eb10753",
"55f442e87f3c795a"
],
"x": 1345,
"y": 3380,
"wires": [
[
"58d12f4db155e274"
]
]
},
{
"id": "c0288a6036aef2c7",
"type": "link in",
"z": "",
"name": "Reset Garage to Empty Timer",
"links": [
"e5299593a3530629",
"084e031e45d25332"
],
"x": 675,
"y": 3420,
"wires": [
[
"231f13ed05398752"
]
]
},
{
"id": "4c98e36adf673711",
"type": "link in",
"z": "",
"name": "Garage Motion Reset",
"links": [
"d1baa71a0f7794a3",
"3413aeee8dc136c9"
],
"x": 395,
"y": 3340,
"wires": [
[
"1bd3d0d788663172"
]
]
},
{
"id": "0c8530a32eb8b18e",
"type": "api-current-state",
"z": "",
"name": "Guestroom Motion?",
"server": "",
"version": 3,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "binary_sensor.guestroom_motion",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "guestroom_motion",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "guestroom_motion_data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1225,
"y": 3720,
"wires": [
[
"658813bce58c19bb"
]
],
"icon": "font-awesome/fa-child",
"l": false
},
{
"id": "658813bce58c19bb",
"type": "api-current-state",
"z": "",
"name": "Livingroom Motion?",
"server": "",
"version": 3,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "binary_sensor.livingroom_motion",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "livingroom_motion",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "livingroom_motion_data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1285,
"y": 3760,
"wires": [
[
"9cafe079f6350f88"
]
],
"icon": "font-awesome/fa-child",
"l": false
},
{
"id": "3ebccd1be3ec0d92",
"type": "change",
"z": "",
"name": "Set Bedroom",
"rules": [
{
"t": "set",
"p": "new_room_to_set",
"pt": "msg",
"to": "Bedroom",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1530,
"y": 4460,
"wires": [
[
"b13da1bc59a8c4cf",
"f6b3f251b2be8419"
]
]
},
{
"id": "ea11d662b5f95384",
"type": "switch",
"z": "",
"name": "!In Bed?",
"property": "bed_presence",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "off/not automated",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 775,
"y": 4460,
"wires": [
[
"3592d7b7ef2987b1"
],
[
"e79f07cb5aa211fc"
]
],
"icon": "font-awesome/fa-bed",
"l": false
},
{
"id": "90e869a1efb3a898",
"type": "switch",
"z": "",
"name": "Bedroom !Set?",
"property": "person_location",
"propertyType": "msg",
"rules": [
{
"t": "neq",
"v": "Bedroom",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 420,
"y": 4460,
"wires": [
[
"7c4d4df172b9ecd2"
]
]
},
{
"id": "3592d7b7ef2987b1",
"type": "switch",
"z": "",
"name": "Bedroom Motion event <2min ago?",
"property": "bedroom_motion_data.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "lte",
"v": "120000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 960,
"y": 4460,
"wires": [
[
"56534c6a12ca8805"
],
[
"1b421c641c44e585"
]
]
},
{
"id": "1b421c641c44e585",
"type": "switch",
"z": "",
"name": "BLE Same for >2min?",
"property": "ble_room_data.new_state.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "gte",
"v": "120000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "false",
"repair": true,
"outputs": 2,
"x": 1280,
"y": 4500,
"wires": [
[
"07bd316521ad4a54"
],
[
"90fd74216728f27b"
]
]
},
{
"id": "90fd74216728f27b",
"type": "delay",
"z": "",
"name": "",
"pauseType": "delay",
"timeout": "30",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 1475,
"y": 4500,
"wires": [
[
"739764dac70c61c7"
]
],
"l": false
},
{
"id": "ab74afb34cf887b4",
"type": "link out",
"z": "",
"name": "link out 95",
"mode": "link",
"links": [
"d47ac6d0e6641e7a"
],
"x": 1575,
"y": 4500,
"wires": []
},
{
"id": "739764dac70c61c7",
"type": "api-current-state",
"z": "",
"name": "refresh",
"server": "",
"version": 3,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "{{id}}",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
},
{
"property": "id",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1525,
"y": 4500,
"wires": [
[
"ab74afb34cf887b4"
]
],
"icon": "font-awesome/fa-refresh",
"l": false
},
{
"id": "b13da1bc59a8c4cf",
"type": "change",
"z": "",
"name": "RESET",
"rules": [
{
"t": "set",
"p": "reset",
"pt": "msg",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1695,
"y": 4460,
"wires": [
[
"90fd74216728f27b"
]
],
"icon": "node-red/timer.svg",
"l": false
},
{
"id": "5138cb902d95da89",
"type": "api-current-state",
"z": "",
"name": "Asleep?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Sleeping",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_select.bedroom_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 455,
"y": 5320,
"wires": [
[],
[
"ac9cf67b84610c57"
]
],
"icon": "font-awesome/fa-moon-o",
"l": false
},
{
"id": "76bfa89da063588f",
"type": "api-current-state",
"z": "",
"name": "Asleep?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Sleeping",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_select.guestroom_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 955,
"y": 2860,
"wires": [
[],
[
"5e81c6670f3f1ffa"
]
],
"icon": "font-awesome/fa-moon-o",
"l": false
},
{
"id": "7b494a1a1e9e4d4e",
"type": "api-current-state",
"z": "",
"name": "Asleep?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Sleeping",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_select.bedroom_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 935,
"y": 3340,
"wires": [
[],
[
"7e04d2e1cf00ea30"
]
],
"icon": "font-awesome/fa-moon-o",
"l": false
},
{
"id": "4177bcd354409d33",
"type": "function",
"z": "",
"name": "Diningroom Pres.",
"func": "// @ts-nocheck\n//code modified from: https://community.home-assistant.io/t/examples-for-using-the-new-get-entities-node/85777/4\nconst globalHomeAssistant = global.get('homeassistant');\nconst ha = globalHomeAssistant.homeAssistant;\nconst groupEntity = ha.states['group.presence'];\nlet occupants = [];\n\n//*******Just change the room below to whichever room the flow is for*******\n\nroom = \"Diningroom\"; //Room should be whatever input_select.*room*_presence would be set to\n //eg Bedroom or Living Room (capitalised and with a space if required)\n//Next, set up the variable that is the flow variable indicating generic room presence - this is checked further down\ngeneric_room_presence = room.replace(\" \", \"_\") + \"_generic_presence\";\n\ngroupEntity.attributes.entity_id.forEach(i => {\n if(ha.states[i].state === room) {\n occupants.push(ha.states[i].attributes.friendly_name.replace(\" Home Presence\", \"\"));\n //The push bit adds the friendly name of any persons location input select which matches the state (ie Living Room)\n //The replace bit clears the Location part from the friendly name leaving just the initials. \n }\n});\n\n//the join function creates '+' separated string from the array.\noccupants = occupants.join(' + ');\n\n//If no BLE occupation is detected but Generic Room Presence is detected (motion/bed/TV etc.), set the room to Someone\n//Otherwise with no BLE or Generic Presence, set to Empty \nif (occupants === '') {\n if (flow.get(generic_room_presence) === true) {\n occupants = \"Someone\";\n } else {\n occupants = \"Empty\";\n }\n}\n\n//if (occupants === '') {\n// occupants = \"Empty\"\n//}\n\nmsg.payload = { data: { \"option\": occupants} };\n\n//Output to top channel by default but to bottom channel if room will be set to Empty\nif (occupants == \"Empty\") {\n return [ null, msg ];\n} else {\n return [ msg, null ];\n}",
"outputs": 2,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 610,
"y": 5400,
"wires": [
[
"18dcfa9b443f79d3"
],
[
"eda278fb1b607a04"
]
]
},
{
"id": "604425105eb1c89d",
"type": "switch",
"z": "",
"name": "BLE Same for >3min?",
"property": "ble_room_data.new_state.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "gte",
"v": "180000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 960,
"y": 4020,
"wires": [
[
"19471f1044f548b1"
],
[
"f8b2cc9ec4e75300"
]
]
},
{
"id": "d48fabbd6e78455e",
"type": "switch",
"z": "",
"name": "BLE Same for >3min?",
"property": "ble_room_data.new_state.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "gte",
"v": "180000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 960,
"y": 4100,
"wires": [
[
"4c33094280c346a2"
],
[
"76f8227fb7a0a0b5"
]
]
},
{
"id": "6005813ad765525c",
"type": "switch",
"z": "",
"name": "BLE Same for >3min?",
"property": "ble_room_data.new_state.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "gte",
"v": "180000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 960,
"y": 4180,
"wires": [
[
"579d46e456780a67"
],
[
"c2df9b0eab90bfbd"
]
]
},
{
"id": "d32f7a4d775abb10",
"type": "switch",
"z": "",
"name": "BLE Same for >3min?",
"property": "ble_room_data.new_state.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "gte",
"v": "180000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 960,
"y": 4260,
"wires": [
[
"c26ac73562c3acd5"
],
[
"abe3409c05a28aba"
]
]
},
{
"id": "a7c43a3666874d6d",
"type": "switch",
"z": "",
"name": "BLE Same for >3min?",
"property": "ble_room_data.new_state.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "gte",
"v": "180000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 960,
"y": 4340,
"wires": [
[
"2aed4311350660ab"
],
[
"a60d1677fc1652a4"
]
]
},
{
"id": "c081ab548422f61b",
"type": "switch",
"z": "",
"name": "BLE Same for >3min?",
"property": "ble_room_data.new_state.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "gte",
"v": "180000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 960,
"y": 4420,
"wires": [
[
"e2173851839010ef"
],
[
"1edf5dd6f9a21217"
]
]
},
{
"id": "29c576c486a5c984",
"type": "switch",
"z": "",
"name": "BLE Same for >3min?",
"property": "ble_room_data.new_state.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "gte",
"v": "180000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 960,
"y": 4500,
"wires": [
[
"56534c6a12ca8805"
],
[
"1cb55a67473f509c"
]
]
},
{
"id": "5e81c6670f3f1ffa",
"type": "api-current-state",
"z": "",
"name": "Door Closed?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "off",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "binary_sensor.guestroom_door",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1025,
"y": 2860,
"wires": [
[
"35cd2104cdcb5f1a"
],
[
"4a5c2aa4f917e5ee"
]
],
"outputLabels": [
"closed",
"open"
],
"l": false
},
{
"id": "bb96eaab49174dc7",
"type": "api-current-state",
"z": "",
"name": "Door Closed?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "off",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "binary_sensor.master_bedroom_door",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1125,
"y": 2500,
"wires": [
[
"c397f16031290c49"
],
[
"de2e2047.7dbea"
]
],
"l": false
},
{
"id": "7e04d2e1cf00ea30",
"type": "api-current-state",
"z": "",
"name": "Door Closed?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "off",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "binary_sensor.bedroom_door",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1005,
"y": 3340,
"wires": [
[
"3413aeee8dc136c9"
],
[
"58d12f4db155e274"
]
],
"outputLabels": [
"closed",
"open"
],
"l": false
},
{
"id": "0591cf386849a9f6",
"type": "api-current-state",
"z": "",
"name": "Door Closed?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "off",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "binary_sensor.office_door",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 915,
"y": 2740,
"wires": [
[
"e010d82ba4bbb374"
],
[
"0fe0e5bb346c15bd"
]
],
"outputLabels": [
"closed",
"open"
],
"l": false
},
{
"id": "c397f16031290c49",
"type": "link out",
"z": "",
"name": "link out 127",
"mode": "link",
"links": [
"8afc3ce7.b5a0c"
],
"x": 1175,
"y": 2460,
"wires": []
},
{
"id": "e010d82ba4bbb374",
"type": "link out",
"z": "",
"name": "link out 128",
"mode": "link",
"links": [
"9db72a58.bc21d8"
],
"x": 965,
"y": 2700,
"wires": []
},
{
"id": "35cd2104cdcb5f1a",
"type": "link out",
"z": "",
"name": "link out 129",
"mode": "link",
"links": [
"4f3fa80473da1a07"
],
"x": 1075,
"y": 2820,
"wires": []
},
{
"id": "3413aeee8dc136c9",
"type": "link out",
"z": "",
"name": "link out 130",
"mode": "link",
"links": [
"4c98e36adf673711"
],
"x": 1055,
"y": 3300,
"wires": []
},
{
"id": "b11f54b8bc619cb9",
"type": "api-call-service",
"z": "",
"name": "Set Diningroom Pres.",
"server": "",
"version": 7,
"debugenabled": false,
"action": "input_select.select_option",
"floorId": [],
"areaId": [],
"deviceId": [],
"entityId": [
"input_select.diningroom_presence"
],
"labelId": [],
"data": "",
"dataType": "json",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "data"
}
],
"queue": "none",
"blockInputOverrides": false,
"domain": "input_select",
"service": "select_option",
"output_location": "payload",
"output_location_type": "msg",
"x": 280,
"y": 440,
"wires": [
[]
]
},
{
"id": "b8d9534337c807db",
"type": "link in",
"z": "",
"name": "Set Garage Presence",
"links": [
"dfd5a8d1370aeb4f",
"10b4d2ccee767326",
"e7963cd29bcd20d1"
],
"x": 135,
"y": 440,
"wires": [
[
"b11f54b8bc619cb9"
]
]
},
{
"id": "0828ca9cf5b10ad9",
"type": "change",
"z": "",
"name": "RESET",
"rules": [
{
"t": "set",
"p": "reset",
"pt": "msg",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 925,
"y": 5380,
"wires": [
[
"edfcab30c2db4b17",
"dfd5a8d1370aeb4f"
]
],
"icon": "node-red/timer.svg",
"l": false
},
{
"id": "edfcab30c2db4b17",
"type": "trigger",
"z": "",
"name": "",
"op1": "",
"op2": "",
"op1type": "nul",
"op2type": "payl",
"duration": "15",
"extend": true,
"overrideDelay": false,
"units": "s",
"reset": "stop",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 995,
"y": 5400,
"wires": [
[
"dfd5a8d1370aeb4f"
]
],
"l": false
},
{
"id": "eda278fb1b607a04",
"type": "api-current-state",
"z": "",
"name": "Diningroom !Empty?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Empty",
"halt_if_type": "str",
"halt_if_compare": "is_not",
"entity_id": "input_select.diningroom_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 840,
"y": 5420,
"wires": [
[
"edfcab30c2db4b17"
],
[]
]
},
{
"id": "9c26ec1a1610f898",
"type": "comment",
"z": "",
"name": "Set Diningroom Presence",
"info": "",
"x": 1210,
"y": 5380,
"wires": []
},
{
"id": "dfd5a8d1370aeb4f",
"type": "link out",
"z": "",
"name": "link out 131",
"mode": "link",
"links": [
"b8d9534337c807db"
],
"x": 1055,
"y": 5380,
"wires": []
},
{
"id": "17f7c894f32361bf",
"type": "change",
"z": "",
"name": "Set Diningroom",
"rules": [
{
"t": "set",
"p": "new_room_to_set",
"pt": "msg",
"to": "Diningroom",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1540,
"y": 4540,
"wires": [
[
"583254a9f66ecf59",
"f113e406508b9574"
]
]
},
{
"id": "5640ae7079429841",
"type": "switch",
"z": "",
"name": "!In Bed?",
"property": "bed_presence",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "off/not automated",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 775,
"y": 4540,
"wires": [
[
"ad7d3fcc1610b4ba"
],
[
"9c0c124a07340d77"
]
],
"icon": "font-awesome/fa-bed",
"l": false
},
{
"id": "7642c5a95a6e9c9b",
"type": "switch",
"z": "",
"name": "Diningroom !Set?",
"property": "person_location",
"propertyType": "msg",
"rules": [
{
"t": "neq",
"v": "Diningroom",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 430,
"y": 4540,
"wires": [
[
"e7cff0179d227e01"
]
]
},
{
"id": "ad7d3fcc1610b4ba",
"type": "switch",
"z": "",
"name": "Diningroom Motion event <2min ago?",
"property": "diningroom_motion_data.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "lte",
"v": "120000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 970,
"y": 4540,
"wires": [
[
"b27f9c362b610c51"
],
[
"c4722f16f18333f6"
]
]
},
{
"id": "c4722f16f18333f6",
"type": "switch",
"z": "",
"name": "BLE Same for >2min?",
"property": "ble_room_data.new_state.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "gte",
"v": "120000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "false",
"repair": true,
"outputs": 2,
"x": 1280,
"y": 4580,
"wires": [
[
"db0c5b790e0ee45d"
],
[
"c7540dd8932c103b"
]
]
},
{
"id": "c7540dd8932c103b",
"type": "delay",
"z": "",
"name": "",
"pauseType": "delay",
"timeout": "30",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 1475,
"y": 4580,
"wires": [
[
"bf5934a76a22eb8c"
]
],
"l": false
},
{
"id": "6849b656a9f2f37d",
"type": "link out",
"z": "",
"name": "link out 132",
"mode": "link",
"links": [
"d47ac6d0e6641e7a"
],
"x": 1575,
"y": 4580,
"wires": []
},
{
"id": "bf5934a76a22eb8c",
"type": "api-current-state",
"z": "",
"name": "refresh",
"server": "",
"version": 3,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "{{id}}",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
},
{
"property": "id",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1525,
"y": 4580,
"wires": [
[
"6849b656a9f2f37d"
]
],
"icon": "font-awesome/fa-refresh",
"l": false
},
{
"id": "583254a9f66ecf59",
"type": "change",
"z": "",
"name": "RESET",
"rules": [
{
"t": "set",
"p": "reset",
"pt": "msg",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1695,
"y": 4540,
"wires": [
[
"c7540dd8932c103b"
]
],
"icon": "node-red/timer.svg",
"l": false
},
{
"id": "0cdea4d07e238778",
"type": "switch",
"z": "",
"name": "BLE Same for >3min?",
"property": "ble_room_data.new_state.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "gte",
"v": "180000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 960,
"y": 4580,
"wires": [
[
"b27f9c362b610c51"
],
[
"d58e1c1d1911a075"
]
]
},
{
"id": "0ed857ebc9690161",
"type": "api-current-state",
"z": "",
"name": "Master Door?",
"server": "",
"version": 3,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "binary_sensor.master_bedroom_door",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "master_door",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "master_door_data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 625,
"y": 3720,
"wires": [
[
"bd8b13ee9e9a3cb3"
]
],
"l": false
},
{
"id": "bd8b13ee9e9a3cb3",
"type": "api-current-state",
"z": "",
"name": "Bedroom Door?",
"server": "",
"version": 3,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "binary_sensor.bedroom_door",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "bedroom_door",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "bedroom_door_data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 685,
"y": 3760,
"wires": [
[
"685b37b9e5f81e40"
]
],
"l": false
},
{
"id": "685b37b9e5f81e40",
"type": "api-current-state",
"z": "",
"name": "Guestroom Door?",
"server": "",
"version": 3,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "binary_sensor.guestroom_door",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "guestroom_door",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "guestroom_door_data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 745,
"y": 3720,
"wires": [
[
"01a025849a7498a4"
]
],
"l": false
},
{
"id": "3e9c06510dd2bb6c",
"type": "switch",
"z": "",
"name": "Current Room Door Open?",
"property": "current_room_door",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "on",
"vt": "str"
},
{
"t": "eq",
"v": "off",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 3,
"x": 565,
"y": 3900,
"wires": [
[
"1c9e22d463646c4a"
],
[
"84d6c942e97780df"
],
[
"1c9e22d463646c4a"
]
],
"outputLabels": [
"open",
"closed",
""
],
"icon": "node-red-contrib-home-assistant-websocket/ha-current-state.svg",
"l": false
},
{
"id": "01a025849a7498a4",
"type": "api-current-state",
"z": "",
"name": "Office Door?",
"server": "",
"version": 3,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "binary_sensor.office_door",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "office_door",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "office_door_data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 805,
"y": 3760,
"wires": [
[
"f44a6616.660158"
]
],
"l": false
},
{
"id": "2b2d24243c57bff2",
"type": "switch",
"z": "",
"name": "Current Room Door Open?",
"property": "current_room_door",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "on",
"vt": "str"
},
{
"t": "eq",
"v": "off",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 3,
"x": 565,
"y": 3980,
"wires": [
[
"28a3b31c7480b356"
],
[
"3dfe94f96fb8c82b"
],
[
"28a3b31c7480b356"
]
],
"outputLabels": [
"open",
"closed",
""
],
"icon": "node-red-contrib-home-assistant-websocket/ha-current-state.svg",
"l": false
},
{
"id": "355501a58a94be7a",
"type": "switch",
"z": "",
"name": "Current Room Door Open?",
"property": "current_room_door",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "on",
"vt": "str"
},
{
"t": "eq",
"v": "off",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 3,
"x": 565,
"y": 4060,
"wires": [
[
"5cb0980a033c79a6"
],
[
"0d944f2028c27d53"
],
[
"5cb0980a033c79a6"
]
],
"outputLabels": [
"open",
"closed",
""
],
"icon": "node-red-contrib-home-assistant-websocket/ha-current-state.svg",
"l": false
},
{
"id": "e8f1bdd5510ca153",
"type": "switch",
"z": "",
"name": "Current Room Door Open?",
"property": "current_room_door",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "on",
"vt": "str"
},
{
"t": "eq",
"v": "off",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 3,
"x": 565,
"y": 4140,
"wires": [
[
"09daa87dcb8b961f"
],
[
"f1a2bbb74298a639"
],
[
"09daa87dcb8b961f"
]
],
"outputLabels": [
"open",
"closed",
""
],
"icon": "node-red-contrib-home-assistant-websocket/ha-current-state.svg",
"l": false
},
{
"id": "6ee57080b54b5467",
"type": "switch",
"z": "",
"name": "Current Room Door Open?",
"property": "current_room_door",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "on",
"vt": "str"
},
{
"t": "eq",
"v": "off",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 3,
"x": 565,
"y": 4220,
"wires": [
[
"5a0c14a9de811604"
],
[
"ecb26931da575516"
],
[
"5a0c14a9de811604"
]
],
"outputLabels": [
"open",
"closed",
""
],
"icon": "node-red-contrib-home-assistant-websocket/ha-current-state.svg",
"l": false
},
{
"id": "6b59cb93cb6ea096",
"type": "switch",
"z": "",
"name": "Current Room Door Open?",
"property": "current_room_door",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "on",
"vt": "str"
},
{
"t": "eq",
"v": "off",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 3,
"x": 565,
"y": 4300,
"wires": [
[
"bbff812315c5291e"
],
[
"540f93cc7393602f"
],
[
"bbff812315c5291e"
]
],
"outputLabels": [
"open",
"closed",
""
],
"icon": "node-red-contrib-home-assistant-websocket/ha-current-state.svg",
"l": false
},
{
"id": "badc07f9fe505cea",
"type": "switch",
"z": "",
"name": "Current Room Door Open?",
"property": "current_room_door",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "on",
"vt": "str"
},
{
"t": "eq",
"v": "off",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 3,
"x": 565,
"y": 4380,
"wires": [
[
"b347e014756cd322"
],
[
"e0dff325fc48c753"
],
[
"b347e014756cd322"
]
],
"outputLabels": [
"open",
"closed",
""
],
"icon": "node-red-contrib-home-assistant-websocket/ha-current-state.svg",
"l": false
},
{
"id": "7c4d4df172b9ecd2",
"type": "switch",
"z": "",
"name": "Current Room Door Open?",
"property": "current_room_door",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "on",
"vt": "str"
},
{
"t": "eq",
"v": "off",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 3,
"x": 565,
"y": 4460,
"wires": [
[
"6bba5ec41bf28105"
],
[
"9673ef7cb31516f7"
],
[
"6bba5ec41bf28105"
]
],
"outputLabels": [
"open",
"closed",
""
],
"icon": "node-red-contrib-home-assistant-websocket/ha-current-state.svg",
"l": false
},
{
"id": "e7cff0179d227e01",
"type": "switch",
"z": "",
"name": "Current Room Door Open?",
"property": "current_room_door",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "on",
"vt": "str"
},
{
"t": "eq",
"v": "off",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 3,
"x": 565,
"y": 4540,
"wires": [
[
"84e30fdb7b1a5189"
],
[
"8478d1a772ac8b23"
],
[
"84e30fdb7b1a5189"
]
],
"outputLabels": [
"open",
"closed",
""
],
"icon": "node-red-contrib-home-assistant-websocket/ha-current-state.svg",
"l": false
},
{
"id": "7323cc0b69ee472f",
"type": "function",
"z": "",
"name": "Current Door",
"func": "// @ts-nocheck\nconst globalHomeAssistant = global.get('homeassistant');\nconst ha = globalHomeAssistant.homeAssistant; //Generic bits to get HA states\nconst person = msg.person;\nconst currentRoom = msg.person_location;\n\n// Handle case where current_room is missing\nif (!currentRoom) {\n return msg;\n}\n\n// If current room is Garage, return empty message\nif (currentRoom === \"Garage\") {\n msg.current_room_door_data = \"\";\n msg.current_room_door = \"\";\n return msg;\n}\n\n// Handle case where the current room is Master Bedroom\nif (currentRoom == \"Master Bedroom\") {\n currentRoomDoorName = \"master_door\";\n} else {\n currentRoomDoorName = currentRoom.toLowerCase() + \"_door\";\n}\n\nconst currentRoomDoorState = msg[currentRoomDoorName];\nconst currentRoomDoorData = msg[currentRoomDoorName + \"_data\"];\n\nlet currentRoomDoor = \"on\"; // Default state if not 'off'\n\nif (currentRoomDoorState === \"off\") {\n currentRoomDoor = \"off\";\n}\n\nmsg.current_room_door_data = currentRoomDoorData;\nmsg.current_room_door = currentRoomDoor;\n//msg.current_room = currentRoomDoorName + \"_data\";\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1730,
"y": 3740,
"wires": [
[
"7261551f.c1283c",
"24517186ec77fa7d"
]
]
},
{
"id": "a81e20fde94857eb",
"type": "comment",
"z": "",
"name": "Door check",
"info": "",
"x": 690,
"y": 3660,
"wires": []
},
{
"id": "7a88eae7e8625961",
"type": "switch",
"z": "",
"name": "New Room Door Open?",
"property": "master_door",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "on",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 725,
"y": 3900,
"wires": [
[
"a7b720af.d1d5d"
],
[
"4c11f06d2561c7b1"
]
],
"outputLabels": [
"open",
"closed"
],
"l": false
},
{
"id": "4c11f06d2561c7b1",
"type": "switch",
"z": "",
"name": "Door Closed <60s ago?",
"property": "master_door_data.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "lte",
"v": "60000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 775,
"y": 3920,
"wires": [
[
"a7b720af.d1d5d"
],
[
"402d3a3a1aea098a"
]
],
"l": false
},
{
"id": "09daa87dcb8b961f",
"type": "switch",
"z": "",
"name": "New Room Door Open?",
"property": "guestroom_door",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "on",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 675,
"y": 4140,
"wires": [
[
"fe9d6a1.7be2398"
],
[
"a41d0b071b1f33b5"
]
],
"outputLabels": [
"open",
"closed"
],
"l": false
},
{
"id": "6bba5ec41bf28105",
"type": "switch",
"z": "",
"name": "New Room Door Open?",
"property": "bedroom_door",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "on",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 675,
"y": 4460,
"wires": [
[
"ea11d662b5f95384"
],
[
"3ca6ad6861aa4b0c"
]
],
"outputLabels": [
"open",
"closed"
],
"l": false
},
{
"id": "5cb0980a033c79a6",
"type": "switch",
"z": "",
"name": "New Room Door Open?",
"property": "office_door",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "on",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 675,
"y": 4060,
"wires": [
[
"60da4519.0537ec"
],
[
"04919cdddda23a0b"
]
],
"outputLabels": [
"open",
"closed"
],
"l": false
},
{
"id": "04919cdddda23a0b",
"type": "switch",
"z": "",
"name": "Door Closed <60s ago?",
"property": "office_door_data.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "lte",
"v": "60000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 725,
"y": 4080,
"wires": [
[
"60da4519.0537ec"
],
[
"c12009828276ba33"
]
],
"l": false
},
{
"id": "3ca6ad6861aa4b0c",
"type": "switch",
"z": "",
"name": "Door Closed <60s ago?",
"property": "bedroom_door_data.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "lte",
"v": "60000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 725,
"y": 4480,
"wires": [
[
"ea11d662b5f95384"
],
[
"e79f07cb5aa211fc"
]
],
"l": false
},
{
"id": "a41d0b071b1f33b5",
"type": "switch",
"z": "",
"name": "Door Closed <60s ago?",
"property": "guestroom_door_data.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "lte",
"v": "60000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 725,
"y": 4160,
"wires": [
[
"fe9d6a1.7be2398"
],
[
"7ba493d398bfa7f7"
]
],
"l": false
},
{
"id": "84d6c942e97780df",
"type": "switch",
"z": "",
"name": "Door Closed <60s ago?",
"property": "current_room_door_data.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "lte",
"v": "60000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 625,
"y": 3940,
"wires": [
[
"1c9e22d463646c4a"
],
[
"402d3a3a1aea098a"
]
],
"l": false
},
{
"id": "3dfe94f96fb8c82b",
"type": "switch",
"z": "",
"name": "Door Closed <60s ago?",
"property": "current_room_door_data.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "lte",
"v": "60000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 625,
"y": 4020,
"wires": [
[
"28a3b31c7480b356"
],
[
"82247a947d27557d"
]
],
"l": false
},
{
"id": "0d944f2028c27d53",
"type": "switch",
"z": "",
"name": "Door Closed <60s ago?",
"property": "current_room_door_data.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "lte",
"v": "60000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 625,
"y": 4100,
"wires": [
[
"5cb0980a033c79a6"
],
[
"c12009828276ba33"
]
],
"l": false
},
{
"id": "f1a2bbb74298a639",
"type": "switch",
"z": "",
"name": "Door Closed <60s ago?",
"property": "current_room_door_data.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "lte",
"v": "60000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 625,
"y": 4180,
"wires": [
[
"09daa87dcb8b961f"
],
[
"7ba493d398bfa7f7"
]
],
"l": false
},
{
"id": "ecb26931da575516",
"type": "switch",
"z": "",
"name": "Door Closed <60s ago?",
"property": "current_room_door_data.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "lte",
"v": "60000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 625,
"y": 4260,
"wires": [
[
"5a0c14a9de811604"
],
[
"8584bbc94651bca1"
]
],
"l": false
},
{
"id": "540f93cc7393602f",
"type": "switch",
"z": "",
"name": "Door Closed <60s ago?",
"property": "current_room_door_data.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "lte",
"v": "60000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 625,
"y": 4340,
"wires": [
[
"bbff812315c5291e"
],
[
"fdfb547d4756f818"
]
],
"l": false
},
{
"id": "e0dff325fc48c753",
"type": "switch",
"z": "",
"name": "Door Closed <60s ago?",
"property": "current_room_door_data.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "lte",
"v": "60000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 625,
"y": 4420,
"wires": [
[
"b347e014756cd322"
],
[
"c4862776e5afda51"
]
],
"l": false
},
{
"id": "9673ef7cb31516f7",
"type": "switch",
"z": "",
"name": "Door Closed <60s ago?",
"property": "current_room_door_data.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "lte",
"v": "60000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 625,
"y": 4500,
"wires": [
[
"6bba5ec41bf28105"
],
[
"e79f07cb5aa211fc"
]
],
"l": false
},
{
"id": "8478d1a772ac8b23",
"type": "switch",
"z": "",
"name": "Door Closed <60s ago?",
"property": "current_room_door_data.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "lte",
"v": "60000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 625,
"y": 4580,
"wires": [
[
"84e30fdb7b1a5189"
],
[
"9c0c124a07340d77"
]
],
"l": false
},
{
"id": "27f4dc0504fea7d9",
"type": "server-state-changed",
"z": "",
"name": "TV ON",
"server": "",
"version": 6,
"outputs": 2,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"media_player.familyroom_tv_group",
"switch.familyroom_tv"
],
"substring": [],
"regex": []
},
"outputInitially": false,
"stateType": "str",
"ifState": "on",
"ifStateType": "str",
"ifStateOperator": "is",
"outputOnlyOnStateChange": true,
"for": "0",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": true,
"ignoreCurrentStateUnavailable": true,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 210,
"y": 1480,
"wires": [
[
"c01abdb.896b44"
],
[
"3a4622e7.23d09e"
]
]
},
{
"id": "15c71c0499538cee",
"type": "server-state-changed",
"z": "",
"name": "PC Active",
"server": "",
"version": 6,
"outputs": 2,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"binary_sensor.pc_activity",
"binary_sensor.pc_in_use"
],
"substring": [],
"regex": []
},
"outputInitially": false,
"stateType": "str",
"ifState": "on",
"ifStateType": "str",
"ifStateOperator": "includes",
"outputOnlyOnStateChange": true,
"for": "0",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": true,
"ignoreCurrentStateUnavailable": true,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 200,
"y": 1580,
"wires": [
[
"e1032116.6609a"
],
[
"348a1cb2.6a0394"
]
]
},
{
"id": "f40f2a3975075338",
"type": "server-state-changed",
"z": "",
"d": true,
"name": "Door Closed",
"server": "",
"version": 6,
"outputs": 2,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"binary_sensor.master_bedroom_door"
],
"substring": [],
"regex": []
},
"outputInitially": false,
"stateType": "str",
"ifState": "off",
"ifStateType": "str",
"ifStateOperator": "includes",
"outputOnlyOnStateChange": true,
"for": "0",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": true,
"ignoreCurrentStateUnavailable": true,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 190,
"y": 1280,
"wires": [
[
"a423cbf9.f121d8"
],
[]
],
"outputLabels": [
"closed",
"opened"
]
},
{
"id": "5c5adaf4038d35da",
"type": "server-state-changed",
"z": "",
"d": true,
"name": "Door Closed",
"server": "",
"version": 6,
"outputs": 2,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"binary_sensor.guestroom_door"
],
"substring": [],
"regex": []
},
"outputInitially": false,
"stateType": "str",
"ifState": "off",
"ifStateType": "str",
"ifStateOperator": "includes",
"outputOnlyOnStateChange": true,
"for": "0",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": true,
"ignoreCurrentStateUnavailable": true,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 1170,
"y": 1360,
"wires": [
[
"40799341cb2b3d89"
],
[]
],
"outputLabels": [
"closed",
"opened"
]
},
{
"id": "2ec8d48c76bbc970",
"type": "server-state-changed",
"z": "",
"d": true,
"name": "Door Closed",
"server": "",
"version": 6,
"outputs": 2,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"binary_sensor.bedroom_door"
],
"substring": [],
"regex": []
},
"outputInitially": false,
"stateType": "str",
"ifState": "off",
"ifStateType": "str",
"ifStateOperator": "includes",
"outputOnlyOnStateChange": true,
"for": "0",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": true,
"ignoreCurrentStateUnavailable": true,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 1170,
"y": 1560,
"wires": [
[
"e5299593a3530629"
],
[]
],
"outputLabels": [
"closed",
"opened"
]
},
{
"id": "e2de770dbe9b3a0a",
"type": "server-state-changed",
"z": "",
"name": "Diningroom Motion?",
"server": "",
"version": 6,
"outputs": 2,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"binary_sensor.diningroom_motion"
],
"substring": [],
"regex": []
},
"outputInitially": true,
"stateType": "str",
"ifState": "on",
"ifStateType": "str",
"ifStateOperator": "is",
"outputOnlyOnStateChange": true,
"for": "0",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": true,
"ignoreCurrentStateUnavailable": true,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "eventData"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"x": 1150,
"y": 1700,
"wires": [
[
"79d31ecf9a7c7fff"
],
[
"4463630e4ebc617e"
]
]
},
{
"id": "1bc72997b05faead",
"type": "change",
"z": "",
"name": "Diningroom Generic Presence to TRUE",
"rules": [
{
"t": "set",
"p": "Diningroom_generic_presence",
"pt": "flow",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1820,
"y": 1680,
"wires": [
[]
]
},
{
"id": "35afb6d1b29449a5",
"type": "change",
"z": "",
"name": "Diningroom Generic Presence to FALSE",
"rules": [
{
"t": "set",
"p": "Diningroom_generic_presence",
"pt": "flow",
"to": "false",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1820,
"y": 1720,
"wires": [
[]
]
},
{
"id": "79d31ecf9a7c7fff",
"type": "link out",
"z": "",
"name": "Garage Motion",
"mode": "link",
"links": [
"bdb42994d28a99c0",
"201d2c5075e868ef",
"760db9ecfe40fb82"
],
"x": 1285,
"y": 1680,
"wires": []
},
{
"id": "4463630e4ebc617e",
"type": "link out",
"z": "",
"name": "Garage Motion Cleared",
"mode": "link",
"links": [
"02c6398a52e2e563",
"cbf8dc46b7bc1230"
],
"x": 1285,
"y": 1720,
"wires": []
},
{
"id": "8bf6df4e93bb71c1",
"type": "comment",
"z": "",
"name": "Diningroom Occupied",
"info": "",
"x": 1440,
"y": 1680,
"wires": []
},
{
"id": "f64fa6a8d42d5872",
"type": "comment",
"z": "",
"name": "Diningroom Not Occupied",
"info": "",
"x": 1450,
"y": 1720,
"wires": []
},
{
"id": "bdb42994d28a99c0",
"type": "link in",
"z": "",
"name": "link in 60",
"links": [
"79d31ecf9a7c7fff"
],
"x": 1615,
"y": 1680,
"wires": [
[
"1bc72997b05faead"
]
]
},
{
"id": "02c6398a52e2e563",
"type": "link in",
"z": "",
"name": "link in 61",
"links": [
"4463630e4ebc617e"
],
"x": 1615,
"y": 1720,
"wires": [
[
"35afb6d1b29449a5"
]
]
},
{
"id": "760db9ecfe40fb82",
"type": "link in",
"z": "",
"name": "",
"links": [
"79d31ecf9a7c7fff"
],
"x": 325,
"y": 2180,
"wires": [
[
"3ea263a363baa2af"
]
]
},
{
"id": "3ea263a363baa2af",
"type": "change",
"z": "",
"name": "Diningroom",
"rules": [
{
"t": "set",
"p": "room",
"pt": "msg",
"to": "Diningroom",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 450,
"y": 2180,
"wires": [
[
"7b4f2a2.719dfd4"
]
]
},
{
"id": "e5497e2fdee9490c",
"type": "comment",
"z": "",
"name": "Diningroom Occupied",
"info": "",
"x": 170,
"y": 2180,
"wires": []
},
{
"id": "55f442e87f3c795a",
"type": "link out",
"z": "",
"name": "link out 136",
"mode": "link",
"links": [
"4ae96d1498756139",
"15ea49710908994f",
"575904114c55950b",
"a81529e82d19e178",
"14ad2074c86c4e40",
"7814ee55f186d3e1",
"e16de7e03ce1be65",
"96535f9f66d5917c"
],
"x": 1745,
"y": 1980,
"wires": []
},
{
"id": "9dcc26963cc5e458",
"type": "api-current-state",
"z": "",
"name": "Empty?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Empty",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_select.diningroom_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1600,
"y": 2360,
"wires": [
[
"6ce15d169f15aeeb"
],
[]
]
},
{
"id": "6ce15d169f15aeeb",
"type": "function",
"z": "",
"name": "Someone",
"func": "// @ts-nocheck\nnewmsg = {};\nnewmsg.payload = { data: { \"option\": \"Someone\"} }; \nreturn newmsg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1760,
"y": 2360,
"wires": [
[
"10b4d2ccee767326"
]
]
},
{
"id": "10b4d2ccee767326",
"type": "link out",
"z": "",
"name": "link out 137",
"mode": "link",
"links": [
"b8d9534337c807db",
"201d2c5075e868ef"
],
"x": 1865,
"y": 2360,
"wires": []
},
{
"id": "dd0cd293f6211941",
"type": "comment",
"z": "",
"name": "Set Diningroom Presence",
"info": "",
"x": 2010,
"y": 2360,
"wires": []
},
{
"id": "0bb16fe35230b023",
"type": "trigger",
"z": "",
"name": "15s",
"op1": "",
"op2": "",
"op1type": "nul",
"op2type": "payl",
"duration": "15",
"extend": true,
"overrideDelay": false,
"units": "s",
"reset": "stop",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 850,
"y": 3460,
"wires": [
[
"e064b19ea22a23bd"
]
]
},
{
"id": "e064b19ea22a23bd",
"type": "function",
"z": "",
"name": "Empty",
"func": "// @ts-nocheck\nnewmsg = {};\nnewmsg.payload = { data: { \"option\": \"Empty\"} }; \nreturn newmsg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1430,
"y": 3460,
"wires": [
[
"e7963cd29bcd20d1"
]
]
},
{
"id": "8a380dd668b441cc",
"type": "api-current-state",
"z": "",
"name": "Diningroom Someone?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Someone",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_select.diningroom_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 600,
"y": 3460,
"wires": [
[
"0bb16fe35230b023"
],
[]
]
},
{
"id": "a43c62904e5d016c",
"type": "trigger-state",
"z": "",
"name": "Diningroom !Someone",
"server": "",
"version": 5,
"inputs": 0,
"outputs": 2,
"exposeAsEntityConfig": "",
"entities": {
"entity": [
"input_select.diningroom_presence"
],
"substring": [],
"regex": []
},
"debugEnabled": false,
"constraints": [
{
"targetType": "this_entity",
"targetValue": "",
"propertyType": "current_state",
"propertyValue": "new_state.state",
"comparatorType": "is_not",
"comparatorValueDatatype": "str",
"comparatorValue": "Someone"
}
],
"customOutputs": [],
"outputInitially": true,
"stateType": "str",
"enableInput": false,
"exposeToHomeAssistant": false,
"haConfig": [
{
"property": "name",
"value": ""
},
{
"property": "icon",
"value": ""
}
],
"x": 600,
"y": 3500,
"wires": [
[
"b575e2f51510a8bf"
],
[]
]
},
{
"id": "b575e2f51510a8bf",
"type": "change",
"z": "",
"name": "RESET",
"rules": [
{
"t": "set",
"p": "reset",
"pt": "msg",
"to": "true",
"tot": "bool"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "stop",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 755,
"y": 3500,
"wires": [
[
"0bb16fe35230b023"
]
],
"icon": "node-red/timer.svg",
"l": false
},
{
"id": "809825871246aed1",
"type": "api-current-state",
"z": "",
"name": "Cont.?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "on",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "input_boolean.automations_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 455,
"y": 3460,
"wires": [
[
"8a380dd668b441cc"
],
[]
],
"icon": "font-awesome/fa-question",
"l": false
},
{
"id": "becc84d9e60e93ce",
"type": "comment",
"z": "",
"name": "Set Diningroom Presence",
"info": "",
"x": 1650,
"y": 3460,
"wires": []
},
{
"id": "f911cf0dd8409f4b",
"type": "comment",
"z": "",
"name": "Reset",
"info": "This yellow timer node resets the timer that it's linked too. In this case, no message will be passed through.\n\nIt's useful in cases where something is scheduled but should no longer happen. ie. the Bedroom is about to be set to \"Empty\" but then there is new motion in there.",
"x": 790,
"y": 3540,
"wires": []
},
{
"id": "7b0293243c9fb1db",
"type": "comment",
"z": "",
"name": "Diningroom Not Occupied",
"info": "",
"x": 210,
"y": 3460,
"wires": []
},
{
"id": "e7963cd29bcd20d1",
"type": "link out",
"z": "",
"name": "link out 138",
"mode": "link",
"links": [
"b8d9534337c807db"
],
"x": 1495,
"y": 3460,
"wires": []
},
{
"id": "ffe42bdc0c303198",
"type": "link in",
"z": "",
"name": "Garage Empty",
"links": [
"19c7a5ce03745742",
"a7ee6651db14216b",
"958537e74f19a8d7",
"bdb56111ba0f5dc1",
"468156f32dff62fd",
"0329b34ecdc49d5b",
"370a63c1899b6f2c",
"e1beccd45eb10753"
],
"x": 1345,
"y": 3500,
"wires": [
[
"e064b19ea22a23bd"
]
]
},
{
"id": "201d2c5075e868ef",
"type": "link in",
"z": "",
"name": "Reset Garage to Empty Timer",
"links": [
"10b4d2ccee767326",
"79d31ecf9a7c7fff"
],
"x": 685,
"y": 3540,
"wires": [
[
"b575e2f51510a8bf"
]
]
},
{
"id": "cbf8dc46b7bc1230",
"type": "link in",
"z": "",
"name": "Garage Motion Reset",
"links": [
"4463630e4ebc617e"
],
"x": 395,
"y": 3460,
"wires": [
[
"809825871246aed1"
]
]
},
{
"id": "9cafe079f6350f88",
"type": "api-current-state",
"z": "",
"name": "Diningroom Motion?",
"server": "",
"version": 3,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "binary_sensor.diningroom_motion",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "diningroom_motion",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "diningroom_motion_data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1345,
"y": 3720,
"wires": [
[
"fd3314cc.1c3678"
]
],
"icon": "font-awesome/fa-child",
"l": false
},
{
"id": "31b6fbe9d6e3a314",
"type": "function",
"z": "",
"name": "Diningroom Pres.",
"func": "// @ts-nocheck\n//code modified from: https://community.home-assistant.io/t/examples-for-using-the-new-get-entities-node/85777/4\nconst globalHomeAssistant = global.get('homeassistant');\nconst ha = globalHomeAssistant.homeAssistant;\nconst groupEntity = ha.states['group.presence'];\nlet occupants = [];\n\n//*******Just change the room below to whichever room the flow is for*******\n\nroom = \"Diningroom\"; //Room should be whatever input_select.*room*_presence would be set to\n //eg Bedroom or Living Room (capitalised and with a space if required)\n\ngroupEntity.attributes.entity_id.forEach(i => {\n if(ha.states[i].state === room) {\n occupants.push(ha.states[i].attributes.friendly_name.replace(\" Home Presence\", \"\"));\n //The push bit adds the friendly name of any persons location input select which matches the state (ie Living Room)\n //The replace bit clears the Location part from the friendly name leaving just the initials. \n }\n});\n\n//the join function creates '+' separated string from the array.\noccupants = occupants.join(' + ');\n\nif (occupants === '') {\n //If no occupation is detected, set the room to Empty\n occupants = \"Empty\";\n}\n\nmsg.payload = { data: { \"option\": occupants} };\n\n//Output to top channel by default but to bottom channel if room will be set to Empty\nif (occupants == \"Empty\") {\n return [ null, msg ];\n} else {\n return [ msg, null ];\n}",
"outputs": 2,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 230,
"y": 5400,
"wires": [
[],
[]
]
},
{
"id": "0fe0e5bb346c15bd",
"type": "api-current-state",
"z": "",
"name": "PC Active?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "on",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "binary_sensor.pc_activity",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 985,
"y": 2740,
"wires": [
[
"7c56b29c17231cdd"
],
[
"622fa81789734c15"
]
],
"icon": "font-awesome/fa-tv",
"l": false
},
{
"id": "7c56b29c17231cdd",
"type": "link out",
"z": "",
"name": "link out 142",
"mode": "link",
"links": [
"9db72a58.bc21d8"
],
"x": 1035,
"y": 2700,
"wires": []
},
{
"id": "622fa81789734c15",
"type": "api-current-state",
"z": "",
"name": "PC in use?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "on",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "binary_sensor.pc_in_use",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1055,
"y": 2740,
"wires": [
[
"4413c1f665a5358a"
],
[
"75ca2147.932f3"
]
],
"icon": "font-awesome/fa-tv",
"l": false
},
{
"id": "4413c1f665a5358a",
"type": "link out",
"z": "",
"name": "link out 143",
"mode": "link",
"links": [
"9db72a58.bc21d8"
],
"x": 1105,
"y": 2700,
"wires": []
},
{
"id": "137931cfacf70b4a",
"type": "api-current-state",
"z": "",
"name": "Motion?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "on",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "binary_sensor.familyroom_motion",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1005,
"y": 2620,
"wires": [
[
"85ccf169ad5d820a"
],
[
"aaf1e470.b1aac8"
]
],
"icon": "font-awesome/fa-child",
"l": false
},
{
"id": "85ccf169ad5d820a",
"type": "link out",
"z": "",
"name": "",
"mode": "link",
"links": [
"e9b8aff7.2651f"
],
"x": 1055,
"y": 2580,
"wires": []
},
{
"id": "719b9ee7f45e9136",
"type": "switch",
"z": "",
"name": "BLE Same for >3min?",
"property": "ble_room_data.new_state.timeSinceChangedMs",
"propertyType": "msg",
"rules": [
{
"t": "gte",
"v": "180000",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 960,
"y": 3940,
"wires": [
[
"93469d5aef55b158"
],
[
"d212f7349a1d042d"
]
]
},
{
"id": "24517186ec77fa7d",
"type": "debug",
"z": "",
"name": "debug 9",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1855,
"y": 3760,
"wires": [],
"l": false
},
{
"id": "a1856431563e8688",
"type": "api-current-state",
"z": "",
"name": "Status?",
"server": "",
"version": 3,
"outputs": 2,
"halt_if": "Master Bedroom,Livingroom,Office,Guestroom,Diningroom,Garage,Kitchen,Familyroom,Bedroom",
"halt_if_type": "str",
"halt_if_compare": "does_not_include",
"entity_id": "input_select.{{topic}}",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1240,
"y": 820,
"wires": [
[
"63fff231.9c8d7c"
],
[]
]
},
{
"id": "2124fa7df16b0343",
"type": "inject",
"z": "",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 1475,
"y": 3840,
"wires": [
[
"588af80058e76852"
]
],
"l": false
},
{
"id": "588af80058e76852",
"type": "api-current-state",
"z": "",
"name": "refresh",
"server": "",
"version": 3,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "sensor.person1_room_presence",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
},
{
"property": "topic",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
},
{
"property": "id",
"propertyType": "msg",
"value": "",
"valueType": "triggerId"
}
],
"for": 0,
"forType": "num",
"forUnits": "minutes",
"x": 1525,
"y": 3840,
"wires": [
[
"2f66928c3ec341d0"
]
],
"icon": "font-awesome/fa-refresh",
"l": false
},
{
"id": "2f66928c3ec341d0",
"type": "link out",
"z": "",
"name": "link out 191",
"mode": "link",
"links": [
"d47ac6d0e6641e7a"
],
"x": 1575,
"y": 3840,
"wires": []
},
{
"id": "68ab3429ed628c98",
"type": "comment",
"z": "",
"name": "Motion check",
"info": "",
"x": 930,
"y": 3660,
"wires": []
},
{
"id": "",
"type": "server",
"name": "Home Assistant",
"version": 5,
"addon": false,
"rejectUnauthorizedCerts": true,
"ha_boolean": "y|yes|true|on|home|open",
"connectionDelay": true,
"cacheJson": true,
"heartbeat": true,
"heartbeatInterval": "30",
"areaSelector": "friendlyName",
"deviceSelector": "friendlyName",
"entitySelector": "friendlyName",
"statusSeparator": "at: ",
"statusYear": "hidden",
"statusMonth": "short",
"statusDay": "numeric",
"statusHourCycle": "h23",
"statusTimeFormat": "h:m",
"enableGlobalContextStore": true
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment