Using Bluecharm BLE iBeacons for Presence (in lieu of cellphone)

My last SmartThings presence sensor has finally bitten the dust, so I’ve been forced to find an alternative, and as most people are painfully aware, trying to use an iphone is just not reliable within SmartThings. For whatever reason my own phone is not bad, but my wife’s is terribly unreliable. I don’t know why, but I know the fact that she doesn’t periodically open the SmartThings app can exacerbate things.

My phone tracker solution using edgebridge running on a Pi is more reliable - very much so for arrivals, but there are still instances where the iphone can go to sleep and appear to be away when it is not.

And so, I’m going down the rabbithole of iBeacons from Bluecharm. I’ve gotten a gateway and beacon in the hopes that I can either leave the beacon in the car or keep it on a keychain. I want everything to be local, so I created a Bluecharm driver and it seems to be working reasonably well. The Bluecharm gateway can send out adverts either via wifi or MQTT, so I went the MQTT route, since I already have a broker running on a Pi for other things. So the whole thing was pretty easy to get up and running.

I think there will be some learning and tuning to be done to figure out the best combination of settings for it to work how I’d like, but it seems like a workable solution so far.

So if anyone is interested, I’m happy to share the driver. Using edgebridge as an alternative to MQTT is a possibility, so if anyone is interested, I could come up with that with some work.

I’d also welcome any learnings others have had regarding using these Bluecharm devices. Right now my driver is supporting just the one multiBeacon device I bought (BC021), which provides not only presence, but motion, button presses, and other info such has device temp and signal strength. If there are requests to add support for other Bluecharm products (contact sensor, temp&humidity, etc.), I can entertain them.

Reference: iBeacons+iOS+SmartThings (UK) presence [updated in 2023]

Reference: FAQ: IBeacon Short FAQ (2024) (US AND UK)

2 Likes

Awesome! :smiling_face_with_sunglasses:

I’m still using mine via Geofency which I find works well for me, but I may switch over to MQTT eventually.

1 Like

I’m finding that I’m probably going to need to run multiple gateways in my home. The reliable range seems to be limited to one or two rooms.

I don’t want to crank up the transmit power too much for concern over rapid battery depletion.

1 Like

The Blue Charm BC-011 will reliably broadcast up to 90 meters (295 feet) at its default settings if your scanner/smartphone is BLE 5.0 compatible. If your scanner/smartphone is only BLE 4.0 compatible, then it will broadcast up to 50 meters (165 feet). Of course, as with all Bluetooth equipment, obstacles will shorten this distance.

so the first question is whether you are using BLE 4.0 or BLE 5.0.

If it’s 4.0, you will probably get around 45 m through clear air, but every obstacle will reduce it, including walls, furniture, and even people walking through the space.

For my use case, the whole point of using iBeacons was to get a short range so I could limit the detection area to the length of the wheelchair ramp at the front door. Under 10 m. For touchfree recognition, I find Bluetooth really good for short distances. But I don’t use it for longer ones. :man_shrugging:t2:

@TAustin Nice to see you again! On the subject of gateways I need 4 (ESP32) to reliably cover a small (70m2) single level house for BLE.

The advantage of course is that I can then use this setup to bring in Shelly and Switchbot BLE sensors, MiFlora plant sensors and even a Xiaomi bathroom scales.

Using a Tile tag it’s very precise when coming and going as @JDRoberts points out.

My setup uses Openmqtt in Node-red on an iHost which then comes into Smartthings via Matter.

2 Likes

What exactly are your gateway devices? Something you purchased somewhere? I’ve only tried Bluecharm’s little usb gateway. Just ordered a second one and will have to modify my driver to support multiple. The beacon will be kept on a keychain so really only need to cover from garage to master bath area.

ESP32 Development Board WiFi+Bluetooth ESP32-WROOM bought on Aliexpres for 4-5€.

These are flashed with Openmqtt here which handles a range of devices including iBeacons.

Once found their UUID and given the instruction “{“hasspresence”:true} {“save”:true}” (HA is not needed!), they show as presence on MQTT .

…….where I use Node-red.

Flow 4 or 1 presence sensors

[
{
“id”: “832bed470c7efbf0”,
“type”: “mqtt in”,
“z”: “34c7757dbe47e866”,
“name”: “”,
“topic”: “home/presence/OMG_ESP32_BLE2”,
“qos”: “2”,
“datatype”: “auto-detect”,
“broker”: “3bcf20bbba8064e7”,
“nl”: false,
“rap”: true,
“rh”: 0,
“inputs”: 0,
“x”: 190,
“y”: 680,
“wires”: [
[
“2f720d975e3d898c”
]
]
},
{
“id”: “5c6dbc639eb50699”,
“type”: “mqtt in”,
“z”: “34c7757dbe47e866”,
“name”: “”,
“topic”: “home/presence/OMG_ESP32_BLE”,
“qos”: “2”,
“datatype”: “auto-detect”,
“broker”: “3bcf20bbba8064e7”,
“nl”: false,
“rap”: true,
“rh”: 0,
“inputs”: 0,
“x”: 200,
“y”: 460,
“wires”: [
[
“dddcc7ab47925771”
]
]
},
{
“id”: “acf445b8fafc55f3”,
“type”: “mqtt in”,
“z”: “34c7757dbe47e866”,
“name”: “”,
“topic”: “home/presence/OMG_ESP32_BLE3”,
“qos”: “2”,
“datatype”: “auto-detect”,
“broker”: “3bcf20bbba8064e7”,
“nl”: false,
“rap”: true,
“rh”: 0,
“inputs”: 0,
“x”: 180,
“y”: 1175,
“wires”: [
[
“e64d7ab03976023c”
]
]
},
{
“id”: “2f720d975e3d898c”,
“type”: “switch”,
“z”: “34c7757dbe47e866”,
“name”: “uuid”,
“property”: “payload.id”,
“propertyType”: “msg”,
“rules”: [
{
“t”: “eq”,
“v”: “DB:FB:F3:44:25:75”,
“vt”: “str”
}
],
“checkall”: “true”,
“repair”: false,
“outputs”: 1,
“x”: 530,
“y”: 680,
“wires”: [
[
“a62956d2d170e9e0”,
“1e9bf8ad335c7d1f”
]
]
},
{
“id”: “dddcc7ab47925771”,
“type”: “switch”,
“z”: “34c7757dbe47e866”,
“name”: “uuid”,
“property”: “payload.id”,
“propertyType”: “msg”,
“rules”: [
{
“t”: “eq”,
“v”: “DB:FB:F3:44:25:75”,
“vt”: “str”
}
],
“checkall”: “true”,
“repair”: false,
“outputs”: 1,
“x”: 190,
“y”: 620,
“wires”: [
[
“7f0c48328309a114”,
“4909eeba5c08b283”
]
]
},
{
“id”: “e64d7ab03976023c”,
“type”: “switch”,
“z”: “34c7757dbe47e866”,
“name”: “uuid”,
“property”: “payload.id”,
“propertyType”: “msg”,
“rules”: [
{
“t”: “eq”,
“v”: “DB:FB:F3:44:25:75”,
“vt”: “str”
}
],
“checkall”: “true”,
“repair”: false,
“outputs”: 1,
“x”: 125,
“y”: 1235,
“wires”: [
[
“d67b7d9dedcda338”,
“7d8ecbe1b0f6b499”
]
]
},
{
“id”: “7d8ecbe1b0f6b499”,
“type”: “change”,
“z”: “34c7757dbe47e866”,
“name”: “”,
“rules”: [
{
“t”: “set”,
“p”: “payload”,
“pt”: “msg”,
“to”: “true”,
“tot”: “bool”
}
],
“action”: “”,
“property”: “”,
“from”: “”,
“to”: “”,
“reg”: false,
“x”: 230,
“y”: 1345,
“wires”: [
[
“8f5b1f16a52970df”
]
]
},
{
“id”: “d67b7d9dedcda338”,
“type”: “trigger”,
“z”: “34c7757dbe47e866”,
“name”: “No msg Not Present”,
“op1”: “”,
“op2”: “false”,
“op1type”: “nul”,
“op2type”: “bool”,
“duration”: “30”,
“extend”: true,
“overrideDelay”: false,
“units”: “s”,
“reset”: “”,
“bytopic”: “all”,
“topic”: “topic”,
“outputs”: 1,
“x”: 230,
“y”: 1285,
“wires”: [
[
“8f5b1f16a52970df”
]
]
},
{
“id”: “818aac5981663e8d”,
“type”: “switch”,
“z”: “34c7757dbe47e866”,
“name”: “”,
“property”: “payload”,
“propertyType”: “msg”,
“rules”: [
{
“t”: “true”
},
{
“t”: “false”
}
],
“checkall”: “true”,
“repair”: false,
“outputs”: 2,
“x”: 580,
“y”: 1305,
“wires”: [
[
“58f1cfc0958e2018”,
“d9bf267fbfc26da7”
],
[
“f270ba3e0654f9c2”,
“f622593818c3313e”
]
]
},
{
“id”: “c4e53ad53f76ef3f”,
“type”: “debug”,
“z”: “34c7757dbe47e866”,
“name”: “3 - Cocina”,
“active”: false,
“tosidebar”: true,
“console”: false,
“tostatus”: true,
“complete”: “payload”,
“targetType”: “msg”,
“statusVal”: “msg.payload &" at: " & $moment().tz(‘Europe/Madrid’).format(‘hh:mm:ss, DD/MM’)”,
“statusType”: “jsonata”,
“x”: 780,
“y”: 1285,
“wires”:
},
{
“id”: “7f0c48328309a114”,
“type”: “trigger”,
“z”: “34c7757dbe47e866”,
“name”: “No msg Not Present”,
“op1”: “”,
“op2”: “false”,
“op1type”: “nul”,
“op2type”: “bool”,
“duration”: “30”,
“extend”: true,
“overrideDelay”: false,
“units”: “s”,
“reset”: “”,
“bytopic”: “all”,
“topic”: “topic”,
“outputs”: 1,
“x”: 280,
“y”: 560,
“wires”: [
[
“35d889ea77aeb5e7”
]
]
},
{
“id”: “4909eeba5c08b283”,
“type”: “change”,
“z”: “34c7757dbe47e866”,
“name”: “”,
“rules”: [
{
“t”: “set”,
“p”: “payload”,
“pt”: “msg”,
“to”: “true”,
“tot”: “bool”
}
],
“action”: “”,
“property”: “”,
“from”: “”,
“to”: “”,
“reg”: false,
“x”: 280,
“y”: 520,
“wires”: [
[
“35d889ea77aeb5e7”
]
]
},
{
“id”: “d6b95320df20e040”,
“type”: “switch”,
“z”: “34c7757dbe47e866”,
“name”: “”,
“property”: “payload”,
“propertyType”: “msg”,
“rules”: [
{
“t”: “true”
},
{
“t”: “false”
}
],
“checkall”: “true”,
“repair”: false,
“outputs”: 2,
“x”: 630,
“y”: 540,
“wires”: [
[
“c1405b3b7e0e3266”,
“a5f284cb83099504”
],
[
“c300b9d8b71bebb0”,
“77c6c90a3a44b8fc”
]
]
},
{
“id”: “1b387c238cdfb2af”,
“type”: “debug”,
“z”: “34c7757dbe47e866”,
“name”: “1 -Hall”,
“active”: false,
“tosidebar”: true,
“console”: false,
“tostatus”: true,
“complete”: “payload”,
“targetType”: “msg”,
“statusVal”: “msg.payload &" at: " & $moment().tz(‘Europe/Madrid’).format(‘hh:mm:ss, DD/MM’)”,
“statusType”: “jsonata”,
“x”: 810,
“y”: 480,
“wires”:
},
{
“id”: “a62956d2d170e9e0”,
“type”: “trigger”,
“z”: “34c7757dbe47e866”,
“name”: “No msg Not Present”,
“op1”: “”,
“op2”: “false”,
“op1type”: “nul”,
“op2type”: “bool”,
“duration”: “30”,
“extend”: true,
“overrideDelay”: false,
“units”: “s”,
“reset”: “”,
“bytopic”: “all”,
“topic”: “topic”,
“outputs”: 1,
“x”: 260,
“y”: 860,
“wires”: [
[
“05a9bff6cb7c3460”
]
]
},
{
“id”: “1e9bf8ad335c7d1f”,
“type”: “change”,
“z”: “34c7757dbe47e866”,
“name”: “”,
“rules”: [
{
“t”: “set”,
“p”: “payload”,
“pt”: “msg”,
“to”: “true”,
“tot”: “bool”
}
],
“action”: “”,
“property”: “”,
“from”: “”,
“to”: “”,
“reg”: false,
“x”: 260,
“y”: 800,
“wires”: [
[
“05a9bff6cb7c3460”
]
]
},
{
“id”: “238a0e87dc86be56”,
“type”: “switch”,
“z”: “34c7757dbe47e866”,
“name”: “”,
“property”: “payload”,
“propertyType”: “msg”,
“rules”: [
{
“t”: “true”
},
{
“t”: “false”
}
],
“checkall”: “true”,
“repair”: false,
“outputs”: 2,
“x”: 610,
“y”: 820,
“wires”: [
[
“5e1f72f0c354dabe”,
“34224fb44146b799”
],
[
“1d357dad9a103168”,
“e1e22f3240b03ef5”
]
]
},
{
“id”: “fe8c472fd59049c4”,
“type”: “debug”,
“z”: “34c7757dbe47e866”,
“name”: “2 - Oficina”,
“active”: false,
“tosidebar”: true,
“console”: false,
“tostatus”: true,
“complete”: “payload”,
“targetType”: “msg”,
“statusVal”: “msg.payload &" at: " & $moment().tz(‘Europe/Madrid’).format(‘hh:mm:ss, DD/MM’)”,
“statusType”: “jsonata”,
“x”: 810,
“y”: 800,
“wires”:
},
{
“id”: “f270ba3e0654f9c2”,
“type”: “change”,
“z”: “34c7757dbe47e866”,
“name”: “msg”,
“rules”: [
{
“t”: “set”,
“p”: “payload”,
“pt”: “msg”,
“to”: “notpresent”,
“tot”: “str”
}
],
“action”: “”,
“property”: “”,
“from”: “”,
“to”: “”,
“reg”: false,
“x”: 580,
“y”: 1365,
“wires”: [
[
“c4e53ad53f76ef3f”,
“e7f3e2fab1f63ed9”,
“3560cd15fc86e79d”
]
]
},
{
“id”: “58f1cfc0958e2018”,
“type”: “change”,
“z”: “34c7757dbe47e866”,
“name”: “msg”,
“rules”: [
{
“t”: “set”,
“p”: “payload”,
“pt”: “msg”,
“to”: “present”,
“tot”: “str”
}
],
“action”: “”,
“property”: “”,
“from”: “”,
“to”: “”,
“reg”: false,
“x”: 580,
“y”: 1245,
“wires”: [
[
“c4e53ad53f76ef3f”,
“e7f3e2fab1f63ed9”,
“8b8ef0304b77bad5”
]
]
},
{
“id”: “c1405b3b7e0e3266”,
“type”: “change”,
“z”: “34c7757dbe47e866”,
“name”: “msg”,
“rules”: [
{
“t”: “set”,
“p”: “payload”,
“pt”: “msg”,
“to”: “present”,
“tot”: “str”
}
],
“action”: “”,
“property”: “”,
“from”: “”,
“to”: “”,
“reg”: false,
“x”: 630,
“y”: 480,
“wires”: [
[
“1b387c238cdfb2af”,
“7df7be4f05265e8a”,
“31c65ad69210c2cc”
]
]
},
{
“id”: “5e1f72f0c354dabe”,
“type”: “change”,
“z”: “34c7757dbe47e866”,
“name”: “msg”,
“rules”: [
{
“t”: “set”,
“p”: “payload”,
“pt”: “msg”,
“to”: “present”,
“tot”: “str”
}
],
“action”: “”,
“property”: “”,
“from”: “”,
“to”: “”,
“reg”: false,
“x”: 610,
“y”: 760,
“wires”: [
[
“fe8c472fd59049c4”,
“fa3430ea61e571a2”,
“2a2ba05b7a0d89ef”
]
]
},
{
“id”: “c300b9d8b71bebb0”,
“type”: “change”,
“z”: “34c7757dbe47e866”,
“name”: “msg”,
“rules”: [
{
“t”: “set”,
“p”: “payload”,
“pt”: “msg”,
“to”: “notpresent”,
“tot”: “str”
}
],
“action”: “”,
“property”: “”,
“from”: “”,
“to”: “”,
“reg”: false,
“x”: 630,
“y”: 600,
“wires”: [
[
“1b387c238cdfb2af”,
“7df7be4f05265e8a”,
“c74e7caaac99565c”
]
]
},
{
“id”: “1d357dad9a103168”,
“type”: “change”,
“z”: “34c7757dbe47e866”,
“name”: “msg”,
“rules”: [
{
“t”: “set”,
“p”: “payload”,
“pt”: “msg”,
“to”: “notpresent”,
“tot”: “str”
}
],
“action”: “”,
“property”: “”,
“from”: “”,
“to”: “”,
“reg”: false,
“x”: 610,
“y”: 880,
“wires”: [
[
“fe8c472fd59049c4”,
“fa3430ea61e571a2”,
“5adeaab424dd815f”
]
]
},
{
“id”: “7df7be4f05265e8a”,
“type”: “mqtt out”,
“z”: “34c7757dbe47e866”,
“name”: “Hub”,
“topic”: “smartthings/MQTTPresence1”,
“qos”: “0”,
“retain”: “”,
“respTopic”: “”,
“contentType”: “”,
“userProps”: “”,
“correl”: “”,
“expiry”: “”,
“broker”: “3bcf20bbba8064e7”,
“x”: 810,
“y”: 560,
“wires”:
},
{
“id”: “fa3430ea61e571a2”,
“type”: “mqtt out”,
“z”: “34c7757dbe47e866”,
“name”: “Hub”,
“topic”: “smartthings/MQTTPresence2”,
“qos”: “0”,
“retain”: “”,
“respTopic”: “”,
“contentType”: “”,
“userProps”: “”,
“correl”: “”,
“expiry”: “”,
“broker”: “3bcf20bbba8064e7”,
“x”: 790,
“y”: 860,
“wires”:
},
{
“id”: “e7f3e2fab1f63ed9”,
“type”: “mqtt out”,
“z”: “34c7757dbe47e866”,
“name”: “Hub”,
“topic”: “smartthings/MQTTPresence3”,
“qos”: “0”,
“retain”: “”,
“respTopic”: “”,
“contentType”: “”,
“userProps”: “”,
“correl”: “”,
“expiry”: “”,
“broker”: “3bcf20bbba8064e7”,
“x”: 760,
“y”: 1345,
“wires”:
},
{
“id”: “31c65ad69210c2cc”,
“type”: “change”,
“z”: “34c7757dbe47e866”,
“name”: “”,
“rules”: [
{
“t”: “set”,
“p”: “payload”,
“pt”: “msg”,
“to”: “{ “detect”: { “detected”: true } }”,
“tot”: “json”
}
],
“action”: “”,
“property”: “”,
“from”: “”,
“to”: “”,
“reg”: false,
“x”: 840,
“y”: 440,
“wires”: [
[
“cd01dcbeb4850929”
]
]
},
{
“id”: “c74e7caaac99565c”,
“type”: “change”,
“z”: “34c7757dbe47e866”,
“name”: “”,
“rules”: [
{
“t”: “set”,
“p”: “payload”,
“pt”: “msg”,
“to”: “{“detect”:{“detected”:false}}”,
“tot”: “json”
}
],
“action”: “”,
“property”: “”,
“from”: “”,
“to”: “”,
“reg”: false,
“x”: 840,
“y”: 620,
“wires”: [
[
“cd01dcbeb4850929”
]
]
},
{
“id”: “2a2ba05b7a0d89ef”,
“type”: “change”,
“z”: “34c7757dbe47e866”,
“name”: “”,
“rules”: [
{
“t”: “set”,
“p”: “payload”,
“pt”: “msg”,
“to”: “{ “detect”: { “detected”: true } }”,
“tot”: “json”
}
],
“action”: “”,
“property”: “”,
“from”: “”,
“to”: “”,
“reg”: false,
“x”: 820,
“y”: 740,
“wires”: [
[
“5b7cb5a1f07b4e85”
]
]
},
{
“id”: “8b8ef0304b77bad5”,
“type”: “change”,
“z”: “34c7757dbe47e866”,
“name”: “”,
“rules”: [
{
“t”: “set”,
“p”: “payload”,
“pt”: “msg”,
“to”: “{ “detect”: { “detected”: true } }”,
“tot”: “json”
}
],
“action”: “”,
“property”: “”,
“from”: “”,
“to”: “”,
“reg”: false,
“x”: 790,
“y”: 1225,
“wires”: [
[
“b1c3b8a632ddbfdc”
]
]
},
{
“id”: “5adeaab424dd815f”,
“type”: “change”,
“z”: “34c7757dbe47e866”,
“name”: “”,
“rules”: [
{
“t”: “set”,
“p”: “payload”,
“pt”: “msg”,
“to”: “{“detect”:{“detected”:false}}”,
“tot”: “json”
}
],
“action”: “”,
“property”: “”,
“from”: “”,
“to”: “”,
“reg”: false,
“x”: 820,
“y”: 920,
“wires”: [
[
“5b7cb5a1f07b4e85”
]
]
},
{
“id”: “3560cd15fc86e79d”,
“type”: “change”,
“z”: “34c7757dbe47e866”,
“name”: “”,
“rules”: [
{
“t”: “set”,
“p”: “payload”,
“pt”: “msg”,
“to”: “{“detect”:{“detected”:false}}”,
“tot”: “json”
}
],
“action”: “”,
“property”: “”,
“from”: “”,
“to”: “”,
“reg”: false,
“x”: 790,
“y”: 1405,
“wires”: [
[
“b1c3b8a632ddbfdc”
]
]
},
{
“id”: “a5f284cb83099504”,
“type”: “function”,
“z”: “34c7757dbe47e866”,
“name”: “Set “ha” Hall presence var”,
“func”: “flow.set(“ha”,msg.payload);\nglobal.set(“ha”,msg.payload);\nreturn msg;”,
“outputs”: 1,
“timeout”: 0,
“noerr”: 0,
“initialize”: “”,
“finalize”: “”,
“libs”: ,
“x”: 1090,
“y”: 500,
“wires”: [
[
“a1c321f5711f7032”
]
]
},
{
“id”: “77c6c90a3a44b8fc”,
“type”: “function”,
“z”: “34c7757dbe47e866”,
“name”: “Set “ha” Hall presence var”,
“func”: “flow.set(“ha”,msg.payload);\nglobal.set(“ha”,msg.payload);\nreturn msg;”,
“outputs”: 1,
“timeout”: 0,
“noerr”: 0,
“initialize”: “”,
“finalize”: “”,
“libs”: ,
“x”: 1090,
“y”: 590,
“wires”: [
[
“a1c321f5711f7032”
]
]
},
{
“id”: “34224fb44146b799”,
“type”: “function”,
“z”: “34c7757dbe47e866”,
“name”: “Set “jo” Office presence var”,
“func”: “flow.set(“jo”,msg.payload);\nreturn msg;”,
“outputs”: 1,
“timeout”: 0,
“noerr”: 0,
“initialize”: “”,
“finalize”: “”,
“libs”: ,
“x”: 1080,
“y”: 755,
“wires”: [
[
“a1c321f5711f7032”
]
]
},
{
“id”: “e1e22f3240b03ef5”,
“type”: “function”,
“z”: “34c7757dbe47e866”,
“name”: “Set “jo” Office presence var”,
“func”: “flow.set(“jo”,msg.payload);\nreturn msg;”,
“outputs”: 1,
“timeout”: 0,
“noerr”: 0,
“initialize”: “”,
“finalize”: “”,
“libs”: ,
“x”: 1080,
“y”: 910,
“wires”: [
[
“a1c321f5711f7032”
]
]
},
{
“id”: “d9bf267fbfc26da7”,
“type”: “function”,
“z”: “34c7757dbe47e866”,
“name”: “Set “ki” Cocina presence var”,
“func”: “flow.set(“ki”,msg.payload);\nglobal.set(“ki”,msg.payload);\nreturn msg;”,
“outputs”: 1,
“timeout”: 0,
“noerr”: 0,
“initialize”: “”,
“finalize”: “”,
“libs”: ,
“x”: 1080,
“y”: 1250,
“wires”: [
[
“a1c321f5711f7032”
]
]
},
{
“id”: “f622593818c3313e”,
“type”: “function”,
“z”: “34c7757dbe47e866”,
“name”: “Set “ki” Cocina presence var”,
“func”: “flow.set(“ki”,msg.payload);\nglobal.set(“ki”, msg.payload);\nreturn msg;”,
“outputs”: 1,
“timeout”: 0,
“noerr”: 0,
“initialize”: “”,
“finalize”: “”,
“libs”: ,
“x”: 1080,
“y”: 1355,
“wires”: [
[
“a1c321f5711f7032”
]
]
},
{
“id”: “a1c321f5711f7032”,
“type”: “function”,
“z”: “34c7757dbe47e866”,
“name”: “function 14”,
“func”: “var ha = flow.get(“ha”) || 0;\nvar jo = flow.get(“jo”) || 0;\nvar sa = flow.get(“sa”) || 0;\nvar ki = flow.get(“ki”) || 0;\n\nif (ha == true || jo == true || sa == true || ki == true) {\n var pr=true;\n msg.payload=pr;\n}\nif (ha == false && jo == false && sa == false && ki == false) {\n var pr = false;\n msg.payload = pr;\n}\nelse {\n var pr = true;\n msg.payload = pr;\n}\nreturn msg;”,
“outputs”: 1,
“timeout”: 0,
“noerr”: 0,
“initialize”: “”,
“finalize”: “”,
“libs”: ,
“x”: 1370,
“y”: 860,
“wires”: [
[
“393bbfaaf9674dbb”
]
]
},
{
“id”: “3ccd0080c15019eb”,
“type”: “switch”,
“z”: “34c7757dbe47e866”,
“name”: “”,
“property”: “payload”,
“propertyType”: “msg”,
“rules”: [
{
“t”: “true”
},
{
“t”: “false”
}
],
“checkall”: “true”,
“repair”: false,
“outputs”: 2,
“x”: 1010,
“y”: 1500,
“wires”: [
[
“13c25c7d4bb8ec0b”
],
[
“4c07a7a0507a55e8”
]
]
},
{
“id”: “cd01dcbeb4850929”,
“type”: “put-device-state”,
“z”: “34c7757dbe47e866”,
“name”: “Presence 1 Hall”,
“server”: “7645b9a88fbe034c”,
“category”: “motionSensor”,
“device”: “458a6fcf-b8fd-4344-bdbc-c05f918e64fd”,
“state”: “”,
“number”: “6f35bb82-fa4b-11ee-a951-0242ac120002”,
“x”: 1120,
“y”: 540,
“wires”: [

]
},
{
“id”: “5b7cb5a1f07b4e85”,
“type”: “put-device-state”,
“z”: “34c7757dbe47e866”,
“name”: “Presence 2 Oficina”,
“server”: “7645b9a88fbe034c”,
“category”: “motionSensor”,
“device”: “1fbdef6d-059d-4312-a28e-99a7f80e951d”,
“state”: “”,
“number”: “04984b62-fb29-11ee-a951-0242ac120002”,
“x”: 1110,
“y”: 815,
“wires”: [

]
},
{
“id”: “b1c3b8a632ddbfdc”,
“type”: “put-device-state”,
“z”: “34c7757dbe47e866”,
“name”: “Presence 3 Cocina”,
“server”: “7645b9a88fbe034c”,
“category”: “motionSensor”,
“device”: “32b62777-bc03-4a3e-9510-1ceaf302098f”,
“state”: “”,
“number”: “34f756f4-fb29-11ee-a951-0242ac120002”,
“x”: 1110,
“y”: 1300,
“wires”: [

]
},
{
“id”: “8f5b1f16a52970df”,
“type”: “toggle”,
“z”: “34c7757dbe47e866”,
“name”: “Toggle 3”,
“onOffTopic”: “”,
“onValue”: “true”,
“onType”: “bool”,
“offValue”: “false”,
“offType”: “bool”,
“toggleTopic”: “”,
“toggleValue”: “”,
“toggleType”: “str”,
“passOnOff”: “ifChanged”,
“x”: 440,
“y”: 1305,
“wires”: [
[
“818aac5981663e8d”
]
]
},
{
“id”: “35d889ea77aeb5e7”,
“type”: “toggle”,
“z”: “34c7757dbe47e866”,
“name”: “Toggle 1”,
“onOffTopic”: “”,
“onValue”: “true”,
“onType”: “bool”,
“offValue”: “false”,
“offType”: “bool”,
“toggleTopic”: “”,
“toggleValue”: “”,
“toggleType”: “str”,
“passOnOff”: “ifChanged”,
“x”: 460,
“y”: 620,
“wires”: [
[
“d6b95320df20e040”
]
]
},
{
“id”: “05a9bff6cb7c3460”,
“type”: “toggle”,
“z”: “34c7757dbe47e866”,
“name”: “Toggle 2”,
“onOffTopic”: “”,
“onValue”: “true”,
“onType”: “bool”,
“offValue”: “false”,
“offType”: “bool”,
“toggleTopic”: “”,
“toggleValue”: “”,
“toggleType”: “str”,
“passOnOff”: “ifChanged”,
“x”: 460,
“y”: 820,
“wires”: [
[
“238a0e87dc86be56”
]
]
},
{
“id”: “393bbfaaf9674dbb”,
“type”: “toggle”,
“z”: “34c7757dbe47e866”,
“name”: “Toggle 2”,
“onOffTopic”: “”,
“onValue”: “true”,
“onType”: “bool”,
“offValue”: “false”,
“offType”: “bool”,
“toggleTopic”: “”,
“toggleValue”: “”,
“toggleType”: “str”,
“passOnOff”: “ifChanged”,
“x”: 980,
“y”: 1580,
“wires”: [
[
“3ccd0080c15019eb”
]
]
},
{
“id”: “5a7eee2501fc3fce”,
“type”: “put-device-state”,
“z”: “34c7757dbe47e866”,
“name”: “NRPresence ON”,
“server”: “7645b9a88fbe034c”,
“category”: “motionSensor”,
“device”: “23fd0bbc-23fd-44c5-904e-b8ebdd34c691”,
“state”: “”,
“number”: “6f35bb82-fa4b-11ee-a951-0242ac120002”,
“x”: 1370,
“y”: 1500,
“wires”: [

]
},
{
“id”: “13c25c7d4bb8ec0b”,
“type”: “change”,
“z”: “34c7757dbe47e866”,
“name”: “”,
“rules”: [
{
“t”: “set”,
“p”: “payload”,
“pt”: “msg”,
“to”: “{“detect”:{“detected”:true}}”,
“tot”: “json”
}
],
“action”: “”,
“property”: “”,
“from”: “”,
“to”: “”,
“reg”: false,
“x”: 1180,
“y”: 1520,
“wires”: [
[
“5a7eee2501fc3fce”
]
]
},
{
“id”: “4cb33e7c7a67f45a”,
“type”: “put-device-state”,
“z”: “34c7757dbe47e866”,
“name”: “NRPresence OFF”,
“server”: “7645b9a88fbe034c”,
“category”: “motionSensor”,
“device”: “23fd0bbc-23fd-44c5-904e-b8ebdd34c691”,
“state”: “”,
“number”: “6f35bb82-fa4b-11ee-a951-0242ac120002”,
“x”: 1370,
“y”: 1580,
“wires”: [

]
},
{
“id”: “4c07a7a0507a55e8”,
“type”: “change”,
“z”: “34c7757dbe47e866”,
“name”: “”,
“rules”: [
{
“t”: “set”,
“p”: “payload”,
“pt”: “msg”,
“to”: “{“detect”:{“detected”:false}}”,
“tot”: “json”
}
],
“action”: “”,
“property”: “”,
“from”: “”,
“to”: “”,
“reg”: false,
“x”: 1180,
“y”: 1565,
“wires”: [
[
“4cb33e7c7a67f45a”
]
]
},
{
“id”: “1446f3140185193d”,
“type”: “comment”,
“z”: “34c7757dbe47e866”,
“name”: “Not used - Set global var “ki””,
“info”: “”,
“x”: 1360,
“y”: 1300,
“wires”:
},
{
“id”: “8f677d6cbd45ec8d”,
“type”: “comment”,
“z”: “34c7757dbe47e866”,
“name”: “Not used - Set global var “jo””,
“info”: “”,
“x”: 1120,
“y”: 860,
“wires”:
},
{
“id”: “e22fcf3e9ed4c9e4”,
“type”: “comment”,
“z”: “34c7757dbe47e866”,
“name”: “Not used - Set global var “ha””,
“info”: “”,
“x”: 1340,
“y”: 540,
“wires”:
},
{
“id”: “339baf6ffac5f442”,
“type”: “change”,
“z”: “34c7757dbe47e866”,
“name”: “msg”,
“rules”: [
{
“t”: “set”,
“p”: “payload”,
“pt”: “msg”,
“to”: “present”,
“tot”: “str”
}
],
“action”: “”,
“property”: “”,
“from”: “”,
“to”: “”,
“reg”: false,
“x”: 710,
“y”: 1000,
“wires”: [
[
“a139068c3b6a89c2”,
“690f9a47b410b7f1”,
“31b073c969884a34”
]
]
},
{
“id”: “4ebdfa7afeec1a45”,
“type”: “switch”,
“z”: “34c7757dbe47e866”,
“name”: “uuid”,
“property”: “payload.id”,
“propertyType”: “msg”,
“rules”: [
{
“t”: “eq”,
“v”: “DB:FB:F3:44:25:75”,
“vt”: “str”
}
],
“checkall”: “true”,
“repair”: false,
“outputs”: 1,
“x”: 510,
“y”: 960,
“wires”: [
[
“5c299c2fd5675766”,
“c80443bd8c64b47f”
]
]
},
{
“id”: “c80443bd8c64b47f”,
“type”: “change”,
“z”: “34c7757dbe47e866”,
“name”: “”,
“rules”: [
{
“t”: “set”,
“p”: “payload”,
“pt”: “msg”,
“to”: “true”,
“tot”: “bool”
}
],
“action”: “”,
“property”: “”,
“from”: “”,
“to”: “”,
“reg”: false,
“x”: 300,
“y”: 1080,
“wires”: [
[
“1010121448b4061c”
]
]
},
{
“id”: “5c299c2fd5675766”,
“type”: “trigger”,
“z”: “34c7757dbe47e866”,
“name”: “No msg Not Present”,
“op1”: “”,
“op2”: “false”,
“op1type”: “nul”,
“op2type”: “bool”,
“duration”: “30”,
“extend”: true,
“overrideDelay”: false,
“units”: “s”,
“reset”: “”,
“bytopic”: “all”,
“topic”: “topic”,
“outputs”: 1,
“x”: 320,
“y”: 1020,
“wires”: [
[
“1010121448b4061c”
]
]
},
{
“id”: “62ebc57c0b32065c”,
“type”: “switch”,
“z”: “34c7757dbe47e866”,
“name”: “”,
“property”: “payload”,
“propertyType”: “msg”,
“rules”: [
{
“t”: “true”
},
{
“t”: “false”
}
],
“checkall”: “true”,
“repair”: false,
“outputs”: 2,
“x”: 710,
“y”: 1060,
“wires”: [
[
“339baf6ffac5f442”,
“c2c1ef296f779298”
],
[
“6d155ca6f025b82b”,
“dd17d23fb33021d6”
]
]
},
{
“id”: “a139068c3b6a89c2”,
“type”: “debug”,
“z”: “34c7757dbe47e866”,
“name”: “4 - Salon”,
“active”: false,
“tosidebar”: true,
“console”: false,
“tostatus”: true,
“complete”: “payload”,
“targetType”: “msg”,
“statusVal”: “msg.payload &" at: " & $moment().tz(‘Europe/Madrid’).format(‘hh:mm:ss, DD/MM’)”,
“statusType”: “jsonata”,
“x”: 940,
“y”: 1040,
“wires”:
},
{
“id”: “6d155ca6f025b82b”,
“type”: “change”,
“z”: “34c7757dbe47e866”,
“name”: “msg”,
“rules”: [
{
“t”: “set”,
“p”: “payload”,
“pt”: “msg”,
“to”: “notpresent”,
“tot”: “str”
}
],
“action”: “”,
“property”: “”,
“from”: “”,
“to”: “”,
“reg”: false,
“x”: 710,
“y”: 1120,
“wires”: [
[
“a139068c3b6a89c2”,
“690f9a47b410b7f1”,
“12195a18b7db15b9”
]
]
},
{
“id”: “690f9a47b410b7f1”,
“type”: “mqtt out”,
“z”: “34c7757dbe47e866”,
“name”: “Hub”,
“topic”: “smartthings/MQTTPresence4”,
“qos”: “0”,
“retain”: “”,
“respTopic”: “”,
“contentType”: “”,
“userProps”: “”,
“correl”: “”,
“expiry”: “”,
“broker”: “3bcf20bbba8064e7”,
“x”: 890,
“y”: 1100,
“wires”:
},
{
“id”: “31b073c969884a34”,
“type”: “change”,
“z”: “34c7757dbe47e866”,
“name”: “”,
“rules”: [
{
“t”: “set”,
“p”: “payload”,
“pt”: “msg”,
“to”: “{ “detect”: { “detected”: true } }”,
“tot”: “json”
}
],
“action”: “”,
“property”: “”,
“from”: “”,
“to”: “”,
“reg”: false,
“x”: 920,
“y”: 960,
“wires”: [

]
},
{
“id”: “12195a18b7db15b9”,
“type”: “change”,
“z”: “34c7757dbe47e866”,
“name”: “”,
“rules”: [
{
“t”: “set”,
“p”: “payload”,
“pt”: “msg”,
“to”: “{“detect”:{“detected”:false}}”,
“tot”: “json”
}
],
“action”: “”,
“property”: “”,
“from”: “”,
“to”: “”,
“reg”: false,
“x”: 920,
“y”: 1160,
“wires”: [

]
},
{
“id”: “c2c1ef296f779298”,
“type”: “function”,
“z”: “34c7757dbe47e866”,
“name”: “Set “sa” Salon presence var”,
“func”: “flow.set(“sa”,msg.payload);\n//global.set(“sa”,msg.payload);\nreturn msg;”,
“outputs”: 1,
“timeout”: 0,
“noerr”: 0,
“initialize”: “”,
“finalize”: “”,
“libs”: ,
“x”: 1080,
“y”: 1000,
“wires”: [
[
“a1c321f5711f7032”
]
]
},
{
“id”: “dd17d23fb33021d6”,
“type”: “function”,
“z”: “34c7757dbe47e866”,
“name”: “Set “sa” Salon presence var”,
“func”: “flow.set(“sa”,msg.payload);\n//global.set(“sa”, msg.payload);\nreturn msg;”,
“outputs”: 1,
“timeout”: 0,
“noerr”: 0,
“initialize”: “”,
“finalize”: “”,
“libs”: ,
“x”: 1080,
“y”: 1100,
“wires”: [
[
“a1c321f5711f7032”
]
]
},
{
“id”: “1010121448b4061c”,
“type”: “toggle”,
“z”: “34c7757dbe47e866”,
“name”: “Toggle 4”,
“onOffTopic”: “”,
“onValue”: “true”,
“onType”: “bool”,
“offValue”: “false”,
“offType”: “bool”,
“toggleTopic”: “”,
“toggleValue”: “”,
“toggleType”: “str”,
“passOnOff”: “ifChanged”,
“x”: 460,
“y”: 1080,
“wires”: [
[
“62ebc57c0b32065c”
]
]
},
{
“id”: “3079653e56d348f2”,
“type”: “mqtt in”,
“z”: “34c7757dbe47e866”,
“name”: “”,
“topic”: “home/presence/OMG_ESP32_BLE4”,
“qos”: “2”,
“datatype”: “auto-detect”,
“broker”: “3bcf20bbba8064e7”,
“nl”: false,
“rap”: true,
“rh”: 0,
“inputs”: 0,
“x”: 190,
“y”: 960,
“wires”: [
[
“4ebdfa7afeec1a45”
]
]
},
{
“id”: “769d8226ecb3de14”,
“type”: “comment”,
“z”: “34c7757dbe47e866”,
“name”: “PRESENT”,
“info”: “”,
“x”: 1280,
“y”: 1460,
“wires”:
},
{
“id”: “14580a5fd91b60b6”,
“type”: “junction”,
“z”: “34c7757dbe47e866”,
“x”: 390,
“y”: 1305,
“wires”: [

]
},
{
“id”: “c09be9a34cc74d1d”,
“type”: “junction”,
“z”: “34c7757dbe47e866”,
“x”: 460,
“y”: 1080,
“wires”: [

]
},
{
“id”: “3bcf20bbba8064e7”,
“type”: “mqtt-broker”,
“name”: “Mosquitto mqtt 8883”,
“broker”: “192.168.0.85”,
“port”: “8883”,
“clientid”: “”,
“autoConnect”: true,
“usetls”: false,
“protocolVersion”: “4”,
“keepalive”: “60”,
“cleansession”: true,
“autoUnsubscribe”: true,
“birthTopic”: “”,
“birthQos”: “0”,
“birthRetain”: “false”,
“birthPayload”: “”,
“birthMsg”: {},
“closeTopic”: “”,
“closeQos”: “0”,
“closeRetain”: “false”,
“closePayload”: “”,
“closeMsg”: {},
“willTopic”: “”,
“willQos”: “0”,
“willRetain”: “false”,
“willPayload”: “”,
“willMsg”: {},
“userProps”: “”,
“sessionExpiry”: “”
},
{
“id”: “7645b9a88fbe034c”,
“type”: “api-server”,
“name”: “Token”,
“ip”: “192.168.0.85:80”,
“ipaddr”: “”,
“token”: “70320e15-887e-4d48-ad3e-3d12061c6925”
},
{
“id”: “4cc27c8095951cbd”,
“type”: “global-config”,
“env”: ,
“modules”: {
“node-red-contrib-ewelink-cube”: “1.3.6”,
“node-red-contrib-toggle”: “0.1.1”
}
}
]

3 Likes

My Edge driver is up and running and on Github here for anyone interested. Feedback is welcome as this is a first pass.

2 Likes