Industry standard approach for indoor positioning seems to be RSSI using Bluetooth Low Energy beacons. I would choose this approach and forget about trying to integrate with the Zigbee network unless your project is Zigbee specific.
I've played about with a few BLE beacons. You can alter their transmission power depending upon your need, with the lowest setting resulting in the beacon only being visible to the phone from a few feet away.
With a beacon in each room I don't see why this wouldn't work for you. If the rooms don't have doors between them then maybe a pair of beacons in each room would be more reliable.
BLE support is baked into Android from version 4.3 onwards, it's easy to measure signal strength, estimate distance to beacon etc. Then it's just a case of making REST calls to the bridge depending upon which beacon is closest to the phone. If you have a Raspberry Pi 3 you can configure it to act as a BLE beacon for testing before buying any dedicated beacons.
In terms of Hue integration I would probably set up a new sensor on the bridge for each room and have the phone modify the value of this sensor based on signal strength from each beacon. Then on the bridge I would create rules to react to changes in these sensor values. This would make it easy to deploy an Android app involving minimal code and use the Hue bridge to create more complex conditional rules like what to do if someone walked quickly in and out of a room, handle multiple people in the same room etc.
Edited to add the following in response to your comment, apologies for the lengthy post!
Within the Hue API one of the available resources is sensors. If you buy Hue products like motion sensor, light switch etc these are added to the bridge as individual sensors. However you can also create your own generic sensors using the API and use these to store values that you update via the REST interface. The values of your custom sensors can be used in the rules on the bridge as conditions and triggers, you can even read the sensor values via the API to use in your own applications. This is where the system becomes very customisable.
As you are developing using Android I would recommend the Tasker app along with the RESTasker plugin as this provides an easy way to integrate with the Hue bridge and react to BLE sensors.
Here are examples of how I have used sensors in my setup, which works in conjunction with a raspberry pi:
- TV status - My tv has IP control and I have a python script polling
it every second to see if it is switched on or off. When this value
changes the python script updates the TV status sensor on my Hue
bridge.
- Home sensors for each member of the family - I have a 433mhz door
switch on the front door of my house. Whenever the door is opened
this triggers a delayed python script which pings the (static) IP
addresses of the phone of each member of the household on the LAN to
work out who is at home. It then sets the Home sensor value in the
bridge for everyone who is at home to 1.
- Overnight we use wireless chargers, when each phone is placed on a
wireless charger it updates the home sensor value for that person
from 1 to 2.
So from these few custom sensors the bridge can now trigger rules based on who is at home, whether they are in bed or not and whether or not the TV is on. Some of my rules are:
- If the living room lights are on and the TV is switched on dim the
lights, if the TV is switched off increase the brightness again. If
the TV is on and the light level outside is 0 (read from Hue motion
sensor outside) then slowly change the bulb hue to red.
- Turn off all the lights once the last person in the house puts their
phone on it's wireless charger. A python script also turns off the TV
off it has been left on.
- When I put my phone on the wireless charger a Tasker task reads the
home variable for my daughter from the bridge. It then sets my alarm
later than normal if she is not here, as I don't have to take her to
school.
- If I'm connected to my home wifi and my phone rings or I make a call
a Tasker task reads the sensor variables. If nobody else is at home
and the TV is on Tasker sends the IP command to my TV to mute the
volume, once the call ends it unmutes it again.
In terms of approaching your project I would create a sensor on the bridge to go with each room in the house, set with an initial value of 0. Then in Tasker I would scan for the closest BLE sensor. Lets say the closest BLE sensor is living room, I would have Tasker read the living room sensor variable from the bridge (value is 0) and then add 1 to the value and write it back to the bridge (value is now 1). I would have Tasker save a variable that the last sensor updated was living room and keep scanning for BLE beacons. Now if Tasker finds a different BLE beacon which is closer than living room I would have it read the living room sensor from the bridge again (still 1), subtract 1 from the value and write it back (so now its 0) and then repeat the process above, adding 1 to the sensor value for the room the phone is now closest to.
In the bridge I would have rules that said if sensor value for a room = 0 turn off lights in that room, if sensor value > 0 turn on lights in that room. Because you are reading the existing value and adding or subtracting from it when a phone enters a room the system can cope with multiple phones/people in the house. If two people are in a room then the room sensor value will be 2 so the lights will only turn off when the last person leaves, not if one of them goes to get a drink or whatever.
As you can tell I've spent far too long tinkering with my Hue, but it's been a great learning process. I came to it knowing very little about programming at all and found the API very easy to understand, it's flexibility and ease of integration with other things inspired me to become proficient in several languages and make some cool projects along the way.