esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
291 stars 34 forks source link

NodeMCU - LD2420 - MQTT issue #5307

Open Poseidon1982 opened 6 months ago

Poseidon1982 commented 6 months ago

The problem

The LD2420 sensor works fine with the NodeMCU. But when I connect to a MQTT Broker with esphome then I get weird values. The values are jumping very high and then back again. Why could be the reason?

Many thanks

Which version of ESPHome has the issue?

2023.12.5

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

No response

What platform are you using?

ESP8266

Board

NodeMCU

Component causing the issue

LD2420 and MQTT

Example YAML snippet

external_components:
  - source: github://pr#4847
    components: [ ld2420 ]
    refresh: 2s

esphome:
  name: 2_og-pyradmide-wz
  friendly_name: 2_OG_pyradmide_WZ

mqtt:
  broker: IP
  username: username
  password: password
  discovery: true

esp8266:
  board: nodemcuv2

# Enable logging
logger:

wifi:
  ssid: "SSID"
  password: "password"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Hotspot"
    password: "password"

web_server:
  port: 80

captive_portal:

uart:
  id: ld2420_uart
  tx_pin: GPIO15
  rx_pin: GPIO13
  baud_rate: 115200
  parity: NONE
  stop_bits: 1

sensor:
  - platform: ld2420
    moving_distance:
      name : Moving Distance
      discovery: true

binary_sensor:
  - platform: ld2420
    has_target:
      name: Presence
      discovery: true

ld2420:

text_sensor:
  - platform: ld2420
    fw_version:
      name: LD2420 Firmware
      discovery: false

switch:
  - platform: restart
    name: Restart
    discovery: false 

select:
  - platform: ld2420
    operating_mode:
      name: Operating Mode
      discovery: false

number:
  - platform: ld2420
    presence_timeout:
      name: Detection Presence Timeout
      discovery: false
    min_gate_distance:
      name: Detection Gate Minimum
      discovery: false
    max_gate_distance:
      name: Detection Gate Maximum
      discovery: false
    # See "Number" section below for detail
    gate_select:
      name: Select Gate to Set
      discovery: false
    still_threshold:
      name: Set Still Threshold Value
      discovery: false
    move_threshold:
      name: Set Move Threshold Value
      discovery: false

button:
  - platform: ld2420
    apply_config:
      name: Apply Config
      discovery: false
    factory_reset:
      name: Factory Reset
      discovery: false
    restart_module:
      name: Restart Module
      discovery: false
    revert_config:
      name: Undo Edits
      discovery: false

Anything in the logs that might be useful for us?

[19:53:56][D][sensor:093]: 'Moving Distance': Sending state 71.00000 cm with 0 decimals of accuracy
[19:53:57][D][sensor:093]: 'Moving Distance': Sending state 80.00000 cm with 0 decimals of accuracy
[19:53:58][D][sensor:093]: 'Moving Distance': Sending state 113.00000 cm with 0 decimals of accuracy
[19:54:00][D][sensor:093]: 'Moving Distance': Sending state 142.00000 cm with 0 decimals of accuracy
[19:54:04][D][sensor:093]: 'Moving Distance': Sending state 104.00000 cm with 0 decimals of accuracy
[19:54:05][D][sensor:093]: 'Moving Distance': Sending state 76.00000 cm with 0 decimals of accuracy
[19:54:06][D][sensor:093]: 'Moving Distance': Sending state 63.00000 cm with 0 decimals of accuracy
[19:54:07][D][sensor:093]: 'Moving Distance': Sending state 58.00000 cm with 0 decimals of accuracy
[19:54:08][D][sensor:093]: 'Moving Distance': Sending state 32826.00000 cm with 0 decimals of accuracy
[19:54:09][D][sensor:093]: 'Moving Distance': Sending state 58.00000 cm with 0 decimals of accuracy
[19:54:12][D][sensor:093]: 'Moving Distance': Sending state 75.00000 cm with 0 decimals of accuracy
[19:54:13][D][sensor:093]: 'Moving Distance': Sending state 25409.00000 cm with 0 decimals of accuracy
[19:54:14][D][sensor:093]: 'Moving Distance': Sending state 72.00000 cm with 0 decimals of accuracy
[19:54:22][D][sensor:093]: 'Moving Distance': Sending state 57856.00000 cm with 0 decimals of accuracy
[19:54:23][D][sensor:093]: 'Moving Distance': Sending state 72.00000 cm with 0 decimals of accuracy
[19:54:37][D][sensor:093]: 'Moving Distance': Sending state 32840.00000 cm with 0 decimals of accuracy
[19:54:38][D][sensor:093]: 'Moving Distance': Sending state 72.00000 cm with 0 decimals of accuracy
[19:55:04][D][sensor:093]: 'Moving Distance': Sending state 32840.00000 cm with 0 decimals of accuracy
[19:55:05][D][sensor:093]: 'Moving Distance': Sending state 72.00000 cm with 0 decimals of accuracy
[19:55:14][D][sensor:093]: 'Moving Distance': Sending state 45322.00000 cm with 0 decimals of accuracy
[19:55:15][D][sensor:093]: 'Moving Distance': Sending state 72.00000 cm with 0 decimals of accuracy
[19:55:16][D][sensor:093]: 'Moving Distance': Sending state 32840.00000 cm with 0 decimals of accuracy
[19:55:17][D][sensor:093]: 'Moving Distance': Sending state 72.00000 cm with 0 decimals of accuracy
[19:55:22][D][sensor:093]: 'Moving Distance': Sending state 32840.00000 cm with 0 decimals of accuracy
[19:55:23][D][sensor:093]: 'Moving Distance': Sending state 72.00000 cm with 0 decimals of accuracy
[19:55:27][D][sensor:093]: 'Moving Distance': Sending state 60068.00000 cm with 0 decimals of accuracy
[19:55:29][D][sensor:093]: 'Moving Distance': Sending state 72.00000 cm with 0 decimals of accuracy
[19:55:36][D][sensor:093]: 'Moving Distance': Sending state 12800.00000 cm with 0 decimals of accuracy

Additional information

No response

github-actions[bot] commented 2 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.