-
Notifications
You must be signed in to change notification settings - Fork 40
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
Feature request: Auto discovery for presence detected devices in Home Assistant #159
Comments
I would like to add that if would be useful to also publish the rssi of the received beacon per presence device |
is this some kind of ESPresense? |
This feature is out of scope for NUKI Hub. Let me explain
Since ESPs are inexpensive, I suggest to use another ESP for presence tracking. @ralle12345 The rssi value per device is available, you can read it from the published CSV data. |
As the information is there, one should do something with it. Following the basically completely understandable "not in core focus of this project" approach, otherwise one could ask why it exists at all. If one has ideas / working snippets on how to create and update |
@bcutter You do not really want to add a |
Indeed I want to monitor only specific Bluetooth devices. Underlying main task remains the same: use MQTT data to create and update device tracker entity. If there's another project exactly doing this (I think there is in the big ESP world)... feel free to share some links 😃 |
The reason this exists is that it is a by-product of something that needs to be done anyway: scanning for beacons. This is necessary for 1. pairing the lock and 2. detecting lock state changes. The information about beacons is always collected, wether presence detection is enabled or not. If enabled, it's just packed into a CSV payload and published. That's easy. And parsing data from CSV is possible, just less convenient. Making a UI to allow to configure which beacons to track, then dynamically publishing discovery topics, deleting them when necessary and so on adds a layer of complexity that's time-consuming to implement. And it doesn't stop at implementation. features need to be tested before release and if changes are made to the code. After release, it'll need maintenance (e. g. reported bugs that need to be fixed and so on). Considering there's already a firmware that takes care all of this and does it well, I think it's better to just that firmware on a secondary ESP. |
I understand Nuki Hub won't provide anything besideds the raw presence detection data. It would be great to get some kickstart assistance on how to realize this on a "for one device only" basis. So: Can someone help on how to create some kind of template sensor for one specific bluetooth device out of the presence topic? Target: create a sensor which contains the connection strength of a certain bluetooth device nearby one SL/Nuki Hub (the Example input (one line/entry of the presence/devices topic): In the end I want to use the sensor in an automation (Home Assistant) as trigger/condition (like "once state sensor.device_name >= -50, do something"). |
Not tested, but something like mqtt:
sensor:
- name: "<device name>"
unique_id: '<uuid>'
state_topic: "<nuki topic>/presence/devices"
value_template: >
{%- for line in value.split('\n') -%}
{%- if line[:17] == 'XX:XX:XX:XX:XX:XX' -%}
{{ line[-3:] }}
{%- endif -%}
{%- endfor -%}
device:
identifiers: nuki_<device> However, this question would be more suitable to https://community.home-assistant.io/, as it is not really specific to Nuki Hub. |
@mundschenk-at Indeed the forum is better. It's just that your piece is working, except being unable to set a "default" state if the stuff in the for loop does not apply. Even this is great for starting, after now more than 30 minutes I was unable to modify it to just show "home" once a certain MAC is discovered and show "not_home" if it is not. So it's a pretty pain in the a** unfortunately. Doing all this manually would be so much easier if presence information would not be provided as a flat list/array but a dedicated sub-topic for each discovered device, by the way. This is my latest approach:
Unfortunately it always gives After trying for almost 1 more hour I tend to really quit this shit. Presence detection in NUKI Hub is useless unless you're a scripting pro. Currently one needs to
In the end I just wanted to monitor one specific device with the free information from Nuki Hub. Desired output: I think if I would have spent the last 1,5 hours for deep-diving into ESPresense (https://espresense.com), I would be much closer to that target already. |
I know this is not the home assistant forum, but maybe it would help the one or other. Just create a mqtt sensor:
Then you have a sensor if your iBeacon ID is recognized by NukiHUB, home if recognized and not_home if you are away. |
Thank you, this works great. Any idea how we could extract the rssi as well to a sensor? |
Sure, here you only use value instead of the if clause:
I have doubled these 2 in the home assistant forum, if there are further questions we should continue there https://community.home-assistant.io/t/nuki-hub-firmware-for-the-esp32/417572/301 |
Totally off-topic, but potentially helpful: Next to good behavior of using at least That's where probably https://github.com/pnbruckner/ha-composite-tracker will enter the room. I'll
|
I'm not sure I understand what you are trying to do, but I have been using the beacon id matching code in an automation for a while now and it works great. I switch on the transmitter when the device enters the home zone, open the door when the matching occurs (adjusting the transmitter power has made this spot-on for 99% of the time, door opens pretty much consistently as I'm 1-2 steps away), switch off the transmitter. As I have multiple users I switch off all other transmitters as well here (and reset their automations) to prevent multiple unlocks when arriving at the same time. This works a lot better than the native auto unlock, which would take 5-10-15 seconds of waiting to open the door. A bit hacky but it works so well I haven't felt the need to tweak it. |
I don't want to use a |
The ability of doing presence detection with NUKI Hub is a quite powerful feature.
Unfortunately it is not very well known (but stated in the docs ✅).
And most important: having that information in MQTT currently is the "end of the road" for most normal users (not being into templating that much or at all) resulting in not using that "free lunch information" at all.
FR:
device_tracker.abc
entity is automatically created and updated if the state changes.That would make NUKI hub such a powerful Bluetooth device tracker and be probably one of THE best add-on features.
The text was updated successfully, but these errors were encountered: