PiHole for presence detection

Hi,

I saw this in HomeAssistant - https://community.home-assistant.io/t/use-pi-hole-dhcp-to-speed-up-ping-device-tracker-detection/52180

Did someone use this technique in openHAB? Can share it?

Thx

I would bet you could just copy that script and use the exec binding. That’s how I would attempt in openhab.

The script is triggered by PiHole so exec cannot do the job here. I will try to integrate it to openHAB and share.

Think it’ll work by changing:

curl -H "Content-Type: application/json" -X POST \
	-d '{"dev_id": "'$dev_id'", "location_name":"home"}' \
	https://xxxx.example.com:8123/api/services/device_tracker/see?api_password=yourpassword

to

curl -X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "ON" "http://ip_openHAB_host:8080/rest/items/$dev_id"

Assuming you have defined the same items (ie. Switch item paulus_oneplus).

1 Like

Your suggestion is right.

I already have a mechanism that gets MAC from Wifi Sniffer (Wemos D1) and oepnHAB do the translation to human presence (or even car presence :-)). So I will change the script to send me the same data as I get from the Sniffer (The sniffer works perfectly with only one issue that sometimes it has delays compering to the router connection). This way (i hope) detection fo presence will be done immediately (leaving is still something that is handled by expire binding).

1 Like