[Custom Integration] HiLink LD2450 Presence Sensor - Full BLE

@massipi, Does it work with the Bluetooth Proxy?

i have no idea :slight_smile: and i have no bt proxy around, you can freely test and let us know :slight_smile:
i can’t see why not, but who knows?

Thank you very much for all this hard work.

Although I’m happy currently with the choice I made, I was hopping the sensor would expose the zones and occupancy per zone, which I understand is not the case. Yet I see the zones are defined as x/y so I assume that allows for defining the detection zones in HA instead of HiLink app. Could be the case for a feature request to HiLink.

As it happens, the zones in my use case differ by both angle and distance so I’m thinking I could use them as conditions for automations. Has anybody tried this?

using this integration you are not defining anything in HLK app, everything is set up in HA (same config you can do in the app). If you need to understand what zone is occupied to me you can template a sensor, you have everything: you have the limits of the zones (you set it up), you have the actual position of targets (the sensor returns also coordinates) so it’s easily made…

why not… probably easier to work with coordinates than that with angles and distances, but you can do that…

Obviously I missed the target position coordinates, thanks for the hint. Sensor template is the next thing I need to learn how to do, then :smiley: .

I have looked around a bit and found a few useful resources but nothing like the zoned-sensor functionality I’m after. Don’t want to hijack this thread so I’ll document my use case in a separate thread.

i’ll write down this use case in my ā€œwhy notā€ list :smiley: but i don’t even have the sensor connected so nothing soon…
you are trying to have a boolean telling you if a zone is occupied, right?
what is leaving me some doubt is that this is something that is not aligned with the zone functionality of the sensor: trying to remember, but the sensor should have:

  • zone disabled
  • check only zones (the sensor tracks targets only in zones)
  • do not check zones (the sensor ignores targets in zones)

Your use case seems a specific use of the second option: you track only zones and you want to know in which zone there are targets.

On the other side, this could be a totally post-computing use case, ignore the zone mode configuration and just check if the sensor is inside the zones.
Is this your desiderata?

1 Like

hej Rafal, how did you discover what lines/uuid to add? thanks!

@MassiPi Hey! I installed the integration through HACS, and it detects the device, but for some reason its stuck at ā€œinitializingā€, or doesn’t even get pass the add step. Any ideas?

EDIT: I think it might be a proxy issue. I moved closer to the main BT and it connected, but I don’t think its being picked up by my proxies.

so it seems we got an answer to the above question

honestly i have totally no idea what changes with bt proxy, and i’m not using it :frowning: sorry
(i could try with one of my latest shelly, let see if i can manage to take the sensor ouf of the boxes in these holidays)

Does the system logs anything?

You know what… It was my setup. It tried to attach itself to a proxy that was already full. I just moved around a bit until it found another proxy that was less full and everything looks good now.

so it works even through bt proxy?
happy to know that :slight_smile:
hope the code works for you…
if you think it lacks any functionality let me know, maybe we can improve the code :slight_smile:

Works ok with bluetooth proxy but I am not able to atomate zone like the esphome version

what do you mean?


Look at what I have when I plug the ld2450 on a esp32. I would prefer the Bluetooth way but some of those option I use. Also with the app I can define zone easy and use them in home assistant. With Zone I can track where a target is and do things accordingly like turn on light.

i still haven’t understood what you lack in the BT way and i’m not going to check 2km of screenshot.

the BT way reproduces the HLK app functionalities, so on zones you can set up them and select the functioning mode (detect, exclude, no zone).
This is what the HLK app does (at least, last time i checked)
What the app and the BT way do not do is notifying when a target is in a specific zone. However, you can do it in post processing since the integration returns also coordinates.
Are you talking about this?

With esphome


With the zone count I can know where the target is in the room and make automation accordingly. With the bluetooth I do not see how I can follow someone in the room through the different 3 zone and light 3 different light according to the position of the target. In one automation I use sensor.mwave_salon_zone_2_all_target_count If Higher than 0 light on

those are calculate and not coming from the sensor itself.
What i’m trying to tell you is that since they are calculated you can either:

  • calculate them in HA based on ble sensor data (template sensors). as far as i can remember i exposed also raw coordinates of targets
  • modify the integration code to calculate these values and expose the variables (i’ve some doubts on this since they are variables linked to one use case only - zones set as detect - and not working in other uses (what if you use zones as exclude?)

anyway, i’ve my sensor disconnected and lying in a closet so hard for me modifying the code :slight_smile: