Presence detection with BLE, MQTT and NodeRed

All kinds of 'OS' scripts
Post Reply
User avatar
Posts: 938
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi
Domoticz version: latest
Location: Milano, Italy

Presence detection with BLE, MQTT and NodeRed

Post by emme » Monday 25 June 2018 10:37


So I've discovered nodeRed which is extremely powerful!
I'm starting to experiment it and move all my service based scripts to NR...

I'm actually in the process of working on presence with BLE dongles... and NodeRed works like a charm...
You need the Scan BLEs control that you can install in the Manage Palette menu
here is how I handle it:
Cattura-1.jpg (55.67 KiB) Viewed 605 times
I inject a toggle true/false value to the SCAN BLEs that start/stop the scanning feature every 45 secs
than the switch has an exit for all my configured devices (the scan of course will detect ALL available devices, but I do need few)
on each exit a function decode the presence and the rssi value and pack a mqtt message for domoticz where a variable store the RSSI value .

On domoticz Side I have a dzVents timer scritp that evaluate the lastUpdate for the variable.. if grater than 3 mins (that means 4 scans windows) it is assumed it's gone.

Hope you will find this useful :)
The most dangerous phrase in any language is:
"We always done this way"

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest