Here is my brand new flow for detecting BLE presence and apply changes to domoticz server.
REQUIREMENTS
- NodeRed
- node-red-contrib-bleacon installed via palette management
- MQTT server installed
- MQTT Hardware installed in Domoticz (and setted to receive domoticz/in)
- Domoticz server (of course
)


HOW FLOW WORKS
On NodeRed startup the inject Config will create the needed context variables and config (you don't need to press it for now).
You will need to edit the Initial Config node to include the correct configuration of your BLE devices (see CONFIG section). After each change you will need to deploy the flow to commit the changes
From this point on the flow is completely automated:
The inject Impulse will send a signal every 45 seconds (you can edit the node and set) that scan Toggle convert to a true/false toggle (nomen omen). This is used to start and stop the BLE Scan.
BLE Scan will discover EVERY BLE device in range and will send a message for each device detected (with no duplicates) and pass it to the new_MqttSetHome node. It will look for the device mac address and if it match with the configuration it will prepare the MQTT telegram to be sent to domoticz
When scan Toggle send False the BLE Scan sto scanning and new_MqttSetAway check the configuration and look for those devices that have not been found during the last scan.
If so, it will send the OFF telegrams to Domoticz via MQTT
That's all...
CONFIG
Initial Config needs to be edited with the array of BLE you want to seek for and you have to follow this structure:
Code: Select all
var deviceConfig = [
["BLE Mac Address", "DeviceNameWithNoSpaces", Domoticz Switch IDX, Domoticz Switch Update, Domoticz Variable IDX, Domoticz Variable Update, Domoticz Variable Update with RSSI]
];
Code: Select all
var deviceConfig = [
["001122334455", "nut1Device", 10, true, 0, false, false],
["AABBCCDDEE", "nut2Device", 11, true, 1, true, true],
["AABBCCDDEE", "nut3Device", 11, false, 2, true, false]
];
nut1Device: switch ON/OFF device 10, no variable working
nut2Device: switch ON/OFF device 11, update variable 1 with RSSI value (when found it will have RSSI value, when not it will show AWAY)
nut2Device: no switch operation (idx is useless at this point), update variable 2 only with HOME/AWAY value (note last parameter is false)
This is it!
I'm now finalizing few things and clean up the code... then I will update this topic with the flow to paste to nodeRed
Hope you will enjoy it and willing to ear your opinion about

ciao
M
P.S.
of course this can be applied to any BLE device, not only related to personal presence...
ie: check if a ble smartTV is on... a BLE tag on the car key in in the house... and stuff like that...