-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MQTT room presence detection #2913
Conversation
As discussed with @balloob I converted this device tracker into a sensor to avoid custom core changes. |
"""Return the state attributes.""" | ||
return { | ||
'distance': self._distance, | ||
'updated': self._updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this always be updated to the last updated time of the state ?
self.assert_state(LIVING_ROOM) | ||
self.assert_distance(1) | ||
|
||
time.sleep(7) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great 🐬 |
Description:
This a component for detecting the indoor location of devices with MQTT clients. I have written a sample app at https://github.com/mKeRix/room-assistant (documentation incoming). Basically this component looks for all subtopics in
room_presence
(or what is configured manually) and then uses that subtopic as room name. The JSON payload (documented for hass.io) is then checked for the id and the distance, where the closest distance will be used as current room. If a scanner stops reporting the device the last distance is on a timeout.This is fairly cool because it allows us to e.g. turn the lights on/off based on if someone is actually in the room opposed to just being able to control the general presence of being
home
ornot_home
. A wearable beacon in combination with a couple RPi 3 make it easy to track anything within the home.Related issue (if applicable): none
Pull request in home-assistant.io with documentation (if applicable): home-assistant/home-assistant.io#810
Example entry for
configuration.yaml
(if applicable):Checklist:
If user exposed functionality or configuration variables are added/changed:
If code communicates with devices, web services, or a:
tox
run successfully. Your PR cannot be merged unless tests passREQUIREMENTS
variable (example).requirements_all.txt
by runningscript/gen_requirements_all.py
..coveragerc
.If the code does not interact with devices:
tox
run successfully. Your PR cannot be merged unless tests pass