core icon indicating copy to clipboard operation
core copied to clipboard

LD2410 state gets stuck, does not change anymore

Open user45876 opened this issue 1 year ago • 40 comments

The problem

After some hours, a day at most, the state of the motion and occupation sensor in HA gets stuck. This seems to be new since core 2023.3.1, before it would go to 'unavailable'.

Also, reloading helped before bit now reloading needs a core restart.

What version of Home Assistant Core has the issue?

2023.3.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

LD2410_BLE

Link to integration documentation on our website

https://www.home-assistant.io/integrations/ld2410_ble

Diagnostics information

Will provide after next failing, enabled debug logging.

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

user45876 avatar Mar 04 '23 08:03 user45876

Hey there @930913, mind taking a look at this issue as it has been labeled with an integration (ld2410_ble) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of ld2410_ble can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign ld2410_ble Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


ld2410_ble documentation ld2410_ble source (message by IssueLinks)

home-assistant[bot] avatar Mar 04 '23 08:03 home-assistant[bot]

Hello. With 2023.3.0 I have the same problem.

pawlikmichal avatar Mar 08 '23 06:03 pawlikmichal

What is weird: I am using two LD2410C, both visa identical but proxies and with identical FW. One is running for days, one needs a Homeassistant for restart every some hours but works flawlessly after that.

Are you guys using ESPHome bt proxies as well!?

user45876 avatar Mar 08 '23 07:03 user45876

Yes, I'm using ESPHOME BT proxy. I will try to use another one LD2410B and will find if it behave the same way.

pawlikmichal avatar Mar 08 '23 07:03 pawlikmichal

Hi there, I am experiencing the same problem - LD2410B dropping out after several hours - randomly (never making through the night). LD2410 becomes unavailable. Same issue on both firmwares (1.07 and newest 2.something). I am using BT proxy on Olimex POE. Any suggestion how to rectify this are welcome :)

wip58 avatar Mar 09 '23 08:03 wip58

So I read a little in issues regarding esphome btproxies. There was one, where the suggestion was, that with lower loglevels, it would work longer: https://github.com/esphome/issues/issues/3951#issuecomment-1362760623 . OTOH, we should rise the loglevels, not lower them ;)

But it seems to be related to btproxies, right? For me, a restart of HA core. insta-solves it reliably for some hours, maybe a day. Powering a btproxy off and on again does nothing, however. Kinda weird.

user45876 avatar Mar 11 '23 17:03 user45876

In my case deleting and adding integration again works for some hours, sometimes minutes.

pawlikmichal avatar Mar 11 '23 17:03 pawlikmichal

In my case deleting and adding integration again works for some hours, sometimes minutes.

Exactly same here.

wip58 avatar Mar 11 '23 17:03 wip58

Yes, unfortunatly I am having same "freeze" after some hours problem. When HA is rebooted, HLK-LD2410 becomes available for some hours again.... then same problem starts over. HA Version 2023.3.3. Supervisor 2023.03.1

I have a suspicion that the problem comes from the BLE proxy (ESPHome). I read somewhere that the LD2410 only supports 1 BLE connection. The problem is probably that there are multiple BLE proxies (overlapping BLE-Trackers) around in my area. As soon as the LD2410 has established a connection to one of the BLE proxies, it "disappears" for the others. If, for some reason, another BLE tracker then takes over the lead, the device suddenly "stands still" in the HA -> which can be seen as "freeze". The problem is therefore probably in the firmware of the LD2410 itself (not allowing multiple BLE connections) or in the BLE proxy that no longer enables this connection? (I'm not an expert, but maybe that's also in the definition of BLE itself?)

Dont get me wrong. Both the BLE-Proxy for HA and the LD2410 integration are really big Inventions in the last months, but if my suspicion turns out to be right, I am afraid, we have to chose between one or the other :-(

andreasbuff avatar Mar 13 '23 13:03 andreasbuff

Same here, LD2410B status hang after few hour with only 1 esp32 BT proxy.

clspeter avatar Mar 14 '23 08:03 clspeter

Same problem here, and I also have just an ESP32 repeater. Restarting the addon is enough to make it work again anyway. No need to completely restart HA.

Microclisma avatar Mar 14 '23 13:03 Microclisma

Ah, this could be gold - restarting esphome is enough? Will test that on the naxt hang. Because constant core restarts are not great, esphome restarts however might be ok.

user45876 avatar Mar 14 '23 13:03 user45876

Restarting ESP32 isn't necessary. Only restarting integration can help, but not every time, Sometimes You need to delete device and add it again.

pawlikmichal avatar Mar 14 '23 13:03 pawlikmichal

Ok, misunderstood that, thanks for clarifying. For me, it wants a core restart after reloading a LD sensor from inside integrations.

user45876 avatar Mar 14 '23 13:03 user45876

Same problem here, and I also have just an ESP32 repeater. Restarting the addon is enough to make it work again anyway. No need to completely restart HA.

Hello, thank you and I am glad, that you can confirm, that it is not BLE Proxy itself. Could it be that you (or in your environment) is another BLE-Tracker, such as Smart Phone? What I also tried was: I Used a Tracker-APP on Smart-Phone. Then "connect" to my LD2410. As long I was using this connection, the LD2410 was "unavailable" in the HA-LD2410 Device-Map.... When I released the connection and rebooted the LD2410 the connection reapeared and was "available". Hence if one Tracker is connected to the LD2410 it is no longer available for another BLE-Tracker....

andreasbuff avatar Mar 14 '23 13:03 andreasbuff

No, I'm not using another tracker.

pawlikmichal avatar Mar 14 '23 14:03 pawlikmichal

I have the same problem and it is something in HA or in the plugin. I use an HA Yellow with no ESPHome as proxy or something. After restart HA it works for a view hours. Then it stops and it does not recover. After the connection to HA breaks, I can connect to the sensor via the app on my mobile phone, so the sensor is still running.

MasonVX avatar Mar 15 '23 22:03 MasonVX

That is a good datapoint, thank you. This is exactly the behaviour I am seeing with esphome bluetooth proxies as well.

user45876 avatar Mar 15 '23 22:03 user45876

I forgot to mention since HA Yellow has no Bluetooth, I have a CM4 Module with Bluetooth, so technically it‘s Raspi4 Bluetooth. The LD2410C ist directly connected to the power lines of an usb cable which itself is powered by a USB Power Supply. The device is about 15cm distance to the Yellow

MasonVX avatar Mar 15 '23 22:03 MasonVX

I can confirme (my case):

HLK-LD2410B is working without freezing in case of direct connection to bluetooth of Raspberry Pi (in that time device is not appered in mobile application). If it connected through ESPHome BLE proxy (I have two ESP32 proxy), then connection is brocken after limited period of time.

I think @andreasbuff is right and the LD2410 only supports 1 BLE connection.

alexanderznamensky avatar Mar 17 '23 07:03 alexanderznamensky

Hi there,

same issue here. This is my workaround which does work:

  • id: '9999999999999' alias: occupancy_reload description: '' trigger:
    • platform: state entity_id:
      • binary_sensor.hlk_ld2410b_####_occupancy to: unavailable for: hours: 0 minutes: 1 seconds: 0 condition: [] action:
    • service: homeassistant.reload_config_entry data: {} target: entity_id: binary_sensor.hlk_ld2410b_####_occupancy mode: single

Regards, Horst

Korki67 avatar Mar 17 '23 08:03 Korki67

Horst, that is great. I will try. I am converting my sensors to D1 Mini ones, which are also small and cheap but it is a bummer, since the 'naked' LD2410C are so amazingly small.

For me, sensors get stuck - they just do not change anymore. Maybe just reloading them every othger hour might work.

user45876 avatar Mar 17 '23 08:03 user45876

Hi there,

same issue here. This is my workaround which does work:

  • id: '9999999999999' alias: occupancy_reload description: '' trigger:

    • platform: state entity_id:

      • binary_sensor.hlk_ld2410b_####_occupancy to: unavailable for: hours: 0 minutes: 1 seconds: 0 condition: [] action:
    • service: homeassistant.reload_config_entry data: {} target: entity_id: binary_sensor.hlk_ld2410b_####_occupancy mode: single

Regards, Horst

this is forcing to restart home assistant or else the integration wont start. the integration is not behaving like other integration where we can reload

captshadab avatar Mar 21 '23 14:03 captshadab

On a side note and rather OT, I have migrated all my LD2410C to esphome and ESP8266 and added a BH1750 light sensor, as the on device one is rather bad - it is more reliable and also has the (imo huge) benefit of being able to tune the LD2410 'in situi' with the app via bluetooth.

This is my config:

esphome:
  name: presence-1
  friendly_name: Presence 1

esp8266:
  board: d1_mini

# Enable logging
logger:
  baud_rate: 0

# Enable Home Assistant API
api:
  encryption:
    key: "xyz"

ota:
  password: "abc"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

button:
  - platform: restart
    name: "Restart"

i2c:
  frequency: 400kHz

sensor:
  - platform: bh1750
    name: "Illuminance"
    update_interval: 60s
    device_class: "illuminance"
    unit_of_measurement: "lx"

uart:
  id: uart1
  tx_pin: TX
  rx_pin: RX
  baud_rate: 256000
  parity: NONE
  stop_bits: 1

ld2410:
  timeout: 30s
  max_move_distance : 6m
  max_still_distance: 6m
  g0_move_threshold: 50
  g0_still_threshold: 0
  g1_move_threshold: 50
  g1_still_threshold: 0
  g2_move_threshold: 40
  g2_still_threshold: 40
  g3_move_threshold: 30
  g3_still_threshold: 40
  g4_move_threshold: 20
  g4_still_threshold: 30
  g5_move_threshold: 15
  g5_still_threshold: 30
  g6_move_threshold: 30
  g6_still_threshold: 20
  g7_move_threshold: 30
  g7_still_threshold: 20
  g8_move_threshold: 30
  g8_still_threshold: 20

binary_sensor:
  - platform: ld2410
    has_target:
      name: Presence
    has_moving_target:
      name: Moving Target
    has_still_target:
      name: Still Target

user45876 avatar Mar 21 '23 14:03 user45876

Hi there, same issue here. This is my workaround which does work:

  • id: '9999999999999' alias: occupancy_reload description: '' trigger:

    • platform: state entity_id:

      • binary_sensor.hlk_ld2410b_####_occupancy to: unavailable for: hours: 0 minutes: 1 seconds: 0 condition: [] action:
    • service: homeassistant.reload_config_entry data: {} target: entity_id: binary_sensor.hlk_ld2410b_####_occupancy mode: single

Regards, Horst

this is forcing to restart home assistant or else the integration wont start. the integration is not behaving like other integration where we can reload

This is unfortunately true for me, as well.

user45876 avatar Mar 21 '23 14:03 user45876

Hi there, same issue here. This is my workaround which does work:

  • id: '9999999999999' alias: occupancy_reload description: '' trigger:

    • platform: state entity_id:

      • binary_sensor.hlk_ld2410b_####_occupancy to: unavailable for: hours: 0 minutes: 1 seconds: 0 condition: [] action:
    • service: homeassistant.reload_config_entry data: {} target: entity_id: binary_sensor.hlk_ld2410b_####_occupancy mode: single

Regards, Horst

this is forcing to restart home assistant or else the integration wont start. the integration is not behaving like other integration where we can reload

This is unfortunately true for me, as well.

Has the issue started with March core update. I just received it today and it's a menace

captshadab avatar Mar 21 '23 14:03 captshadab

Dear all,

I made the script with the UI, let it run manually and it worked. Later, I also saw it is not working automatically. The trigger seems not to work. Sure a workaround is bad and we all wait for the good solution.

Anyhow, my LD2410 just got "unavailable" and the script which I did adjust before was working nicely. This is the updated code:

- id: '9999999999999'
  alias: occupancy_reload
  description: ''
  trigger:
  - platform: state
    entity_id: binary_sensor.hlk_ld2410b_####_occupancy
    to: unavailable
    for: 00:02:00
  condition: []
  action:
  - service: homeassistant.reload_config_entry
    data: {}
    target:
      entity_id: binary_sensor.hlk_ld2410b_####_occupancy
  mode: single

Hope it is working for you now ...

Cheers, Horst

Korki67 avatar Mar 22 '23 01:03 Korki67

it extends the life but fails just later ... only restarting HA helps .... does anybody have better ideas?

Korki67 avatar Mar 22 '23 09:03 Korki67

it extends the life but fails just later ... only restarting HA helps .... does anybody have better ideas?

Yes I do And mine is working since last 48 hrs

I will create a post and explain what I did

captshadab avatar Mar 22 '23 09:03 captshadab

As I said above and sorry for not helping in the issue directly - I have kind of given up and migrated to small boxes containing an ESP8266, the LD2410 and a BH1750. Reliable and better light sensor.

user45876 avatar Mar 22 '23 09:03 user45876