Multi-User Bluetooth Proximity Switch for Activiating Philips Hue Lights
- Designed around hcitool
- Designed for Raspberry Pi with a cheap Bluetooth Dongle.
- Does not re-set light state/color changes made with App until bluetooth proximity state changes
- Bluetooth queries are efficient so as to not impact portable device battery
- Works with PushOver service for alerts & notifications
- Works with any number of devices; if any one of the devices is detected, lights will stay on
Based on a slightly modified hue_bashlibrary by markusproske
Hue lights turn on when your Bluetooth device arrives home, turn off when your Bluetooth device leaves. Works with multiple users.
Watch the video below, noting that an intentional delay of three seconds is implemented from the time the notification appears and the time lights are turned on in the video. This delay is configurable. The delay is included so that the lights don't turn on immediately when detected (e.g., arrived, but still outside the door).
Turn Philips Hue lights on with a Raspberry Pi (or other server) upon arriving home and off upon leaving without the delays of IFTTT or inaccuracies and battery drain associated with geofencing via the Philips Hue app. Have multiple users turn lights on and off.
BlueHue will query a previously-connected bluetooth device (e.g., cell phone) for it's device name. If the device name is correct, BlueHue determines that the Bluetooth Device has 'arrived' and lights will be turned on.
After the Bluetooth Device is 'arrived', name queries preferrably reduce in frequency to not impact the Bluetooth Device battery. For example, the name may be queried once every 30 seconds or so.
Later, when the Bluetooth Device leaves and is no longer reachable, BlueHue enters a verification state that will ping several times in a row for the Bluetooth Device. If the device is not found, BlueHue determines that the Bluetooth Device has 'left' and lights will be turned off.
BlueHue remembers its last state and only changes light state if the Bluetooth Device state (e.g., left or arrived) changes. This way, if the light state is changed via the app (e.g., turn off lights before going to bed), the lights state will not change until the Bluetooth Device state changes.
-
Add user & connect to Philips Hue Bridge
Instructions here. Clip API is often the easiest way to send this first instruction:
http://<bridge ip address>/debug/clip.html
- Install Bluetooth/Bluez
sudo apt-get install bluetooth bluez-utils blueman
-
Pair the Bluetooth device
Instructions: set the device to discoverable mode, then (optionally) set search string for device name (default is 'iphone'):
sudo bash blue_hue.sh -p|--pair [search]
A pairing request from "BlueHueProximity-####" will be made to the device where #### is the pin to enter.
-
Add init.d
if [ "$1" == "start" ]; then bash /home/pi/hue/blue_hue.sh true & ; fi
sudo chmod 755 /etc/init.d/bluehue
sudo update-rc.d bluehue defaults
-
Add information to credentials and/or configuration file(s)
-
Reboot or Launch
sudo /etc/init.d/bluehue start