mKeRix / room-assistant

Presence tracking and more for automation on the room-level
https://www.room-assistant.io
MIT License
1.28k stars 122 forks source link

[Query] No update if device out of range #2

Closed vswraith closed 8 years ago

vswraith commented 8 years ago

Love the tool and just set it up with HomeAssistant,one thing I noticed is when the device is out of range of the beacon, it long longer sends any update on the MQTT...so HomeAssistant keeps the last known value instead of 0. Is there a way to set it to 0 if device is out of range?

How have you setup the room based automation rules? Would be great if you share some.

Thanks.

mKeRix commented 8 years ago

I have some more time on the weekend and can take a look at implementing something like this. Do ou want this to work smilar to the consider_home timeout of the HASS device trackers? So e.g. no update from any tracker for a while sets the current sensor state to away. That would have to be implemented on the HASS server side (even though it shouldn't be much of a problem).

And I've been planning on sharing my setup related to this tool anyway, I'll try to get a blog post out on the weekend. :)

vswraith commented 8 years ago

Yes,either set it to away or send a 0 to ensure the device is no longer in range. Also i get very big values in the distance variable(eg. 5797954322.232323) from my Fitbit device....is this normal? Can the code be tweaked to send signal strength instead?

I look forward to the blog post :)

mKeRix commented 8 years ago

I just made a pull request for this feature on home-assistant repo, although it won't be in till 0.29. If you need the feature soon I guess you could copy in the changed file manually once the code has been checked & merged.

The estimated distance is in meters, so it definitely should not deliver such moon values. I have not seen this happen on my end yet, although I have the suspicion that it may be related to the txPower value. If the Fitbit does not send data for that the calculation is thrown off. I am going to the algorithm locally in regards to this and add some better debug logging so we can get to the bottom of this.

The signal strength is actually already being sent as the rssi value, currently you can explore it with an MQTT client (planning to add a console publisher in the next version). However using it with mqtt_room would not work since it is inverted. The estimated distance is directly based on the signal strength anyway.

Last but not least: since some other things came up I did not have time to write that blog post yet, but it is definitely coming up in the next couple days. I'll comment in here again once I'm done. :)

vswraith commented 8 years ago

Could you send me the link of your blog,will add it to my rss feeds :)

mKeRix commented 8 years ago

Sorry for the long radio silence, been a busy couple weeks! As the main issue of this request has been solved with Home Assistant 0.29 (see away_timeout) I am going to mark this as resolved.

As far as the blog post goes... I am kinda ashamed to admit that it is still just an unfinished draft. Once I actually posted it I will link it in this thread.

mKeRix commented 7 years ago

I really have to apologize that the post never came together. You probably don't need the post anymore at this point, but I wrote a little explanation of my basic presence logic on reddit. If you or anyone else stumbling upon this topic are interested: https://www.reddit.com/r/homeassistant/comments/5jvwew/use_automation_triggers_with_home_zoning/dc5xgmw/