esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
290 stars 36 forks source link

Missing library ld2450 since update ESPhome, cannot compile previously working yaml #6132

Closed m90att closed 2 months ago

m90att commented 2 months ago

The problem

Since upgrading Home Assistant to 2024.8.0, I am seeing an error when installing yaml that works in previous versions.

YAML is provided below. ld2450 is underlined in red in Home Assistant ESPHome addon 2024.7.3

image

When installing, the following error is seen.

INFO ESPHome 2024.7.3
INFO Reading configuration /config/esphome/presence3.yaml...
Failed config

external_components: [source /config/esphome/presence3.yaml:12]
  - source: 
      type: git
      url: https://github.com/hareeshmu/esphome
      ref: ld2450
    components: 

      Could not find __init__.py file for component ld2450. Please check the component is defined by this source (search path: /data/external_components/46c9292e/esphome/components/ld2450/__init__.py).
      - ld2450

I am not certain in which version this started but I rolled back ESPHome to 2024.6.6 and none of the issues above are seen and the installation succeeds.

Which version of ESPHome has the issue?

2024.7.x

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

2024.8.0

What platform are you using?

ESP32

Board

No response

Component causing the issue

HLK-LD2450

Example YAML snippet

esphome:
  name: mmwave-sensor
  friendly_name: mmWave Sensor
  name_add_mac_suffix: True

esp32:
  board: esp32dev
  framework:
    type: arduino

external_components:
  - source:
      type: git
      url: https://github.com/hareeshmu/esphome
      ref: ld2450
    components: [ ld2450 ]

uart:
  id: uart_bus
  rx_pin: 
    number: GPIO16
    mode:
      input: true
      pullup: true
  tx_pin: 
    number: GPIO17
    mode:
      input: true
      pullup: true
  baud_rate: 256000
  parity: NONE
  stop_bits: 1
  data_bits: 8

ld2450:
  id: ld2450_radar
  uart_id: uart_bus
  throttle: 1000ms

binary_sensor:
  - platform: ld2450
    ld2450_id: ld2450_radar
    has_target:
      name: Presence
    has_moving_target:
      name: Moving Target
    has_still_target:
      name: Still Target
  - platform: template
    name: "Zone-1 Presence"
    id: zone_1_presence
    device_class: motion
  - platform: template
    name: "Zone-2 Presence"
    id: zone_2_presence
    device_class: motion
  - platform: template
    name: "Zone-3 Presence"
    id: zone_3_presence
    device_class: motion

button:
  - platform: restart
    icon: mdi:power-cycle
    name: "Reboot Sensor"

number:
  - platform: ld2450
    ld2450_id: ld2450_radar
    presence_timeout:
      name: "Timeout"
    zone_1:
      x1:
        name: Zone-1 X1
      y1:
        name: Zone-1 Y1
      x2:
        name: Zone-1 X2
      y2:
        name: Zone-1 Y2
    zone_2:
      x1:
        name: Zone-2 X1
      y1:
        name: Zone-2 Y1
      x2:
        name: Zone-2 X2
      y2:
        name: Zone-2 Y2
    zone_3:
      x1:
        name: Zone-3 X1
      y1:
        name: Zone-3 Y1
      x2:
        name: Zone-3 X2
      y2:
        name: Zone-3 Y2
  - platform: template
    name: "Illuminance OffSet"
    id: illuminance_offset
    unit_of_measurement: "lx"
    min_value: -0
    max_value: 100
    step: 0.1
    update_interval: never
    optimistic: true
    restore_value: true
    initial_value: 0
    on_value:
      - then:
          - lambda: !lambda |-
              id(illuminance_sensor).update();
  - platform: template
    name: "Temperature OffSet"
    id: temperature_offset
    unit_of_measurement: "ºC"
    min_value: -50
    max_value: 0
    step: 0.1
    update_interval: never
    optimistic: true
    restore_value: true
    initial_value: 0
    on_value:
      - then:
          - lambda: !lambda |-
              id(aht20_sensor).update();
              id(bmp280_sensor).update();              
  - platform: template
    name: "Humidity OffSet"
    id: humidity_offset
    unit_of_measurement: "%"
    min_value: 0
    max_value: 50
    step: 0.1
    update_interval: never
    optimistic: true
    restore_value: true
    initial_value: 0
    on_value:
      - then:
          - lambda: !lambda |-
              id(aht20_sensor).update();
  - platform: template
    name: "Pressure OffSet"
    id: pressure_offset
    unit_of_measurement: "hPa"
    min_value: -50
    max_value: 0
    step: 0.01
    update_interval: never
    optimistic: true
    restore_value: true
    initial_value: 0
    on_value:
      - then:
          - lambda: !lambda |-
              id(bmp280_sensor).update();

output:
  - platform: ledc
    pin:
      number: GPIO2
      mode: OUTPUT
    id: notif_gpio

light:
  - platform: monochromatic
    name: "On Board LED"
    output: notif_gpio
    id: notif_light
    default_transition_length: 0.3s
    restore_mode: ALWAYS_OFF

switch:
  - platform: ld2450
    ld2450_id: ld2450_radar
    bluetooth:
      name: "Bluetooth"
    multi_target:
      name: "Multi Target Tracking"

select:
  - platform: ld2450
    ld2450_id: ld2450_radar
    baud_rate:
      name: "Baud rate"
    zone_type:
      name: "Zone Type"

text_sensor:
  - platform: ld2450
    ld2450_id: ld2450_radar
    version:
      name: "LD2450 Firmware"
    mac_address:
      name: "LD2450 BT MAC"
    target_1:
      direction:
        name: "Target-1 Direction"
    target_2:
      direction:
        name: "Target-2 Direction"
    target_3:
      direction:
        name: "Target-3 Direction"

i2c:

sensor:
  - platform: bh1750
    name: Illuminance
    id: illuminance_sensor    
    address: 0x23
    update_interval: 30s
    filters:
      - lambda: !lambda |-          
          return x + id(illuminance_offset).state;
  - platform: bmp280
    id: bmp280_sensor
    address: 0x77
    update_interval: 30s   
    temperature:
      name: "BMP temp"
      id: bmp280_temperature_sensor
      oversampling: 2x
      filters:
        - lambda: !lambda |-
            return x + id(temperature_offset).state;
    pressure:
      name: "BMP Pressure"
      id: bmp280_pressure_sensor
      filters:
        - lambda: !lambda |-
            return x + id(pressure_offset).state;

  - platform: aht10
    variant: AHT20
    id: aht20_sensor    
    update_interval: 30s
    temperature:
      name: "AHT20 temp"
      id: aht20_temperature_sensor
      accuracy_decimals: 1
      filters:
      - filter_out: 0.0        
      - median:
          window_size: 3
          send_every: 3
          send_first_at: 1
      - lambda: !lambda |-
          return x + id(temperature_offset).state; 
    humidity:
      name: "AHT20 humidity"
      id: aht20_humidity_sensor
      accuracy_decimals: 1
      filters:
      - filter_out: 0.0       
      - median:
          window_size: 3
          send_every: 3
          send_first_at: 1
      - lambda: !lambda |-
          return x + id(humidity_offset).state;   

  - platform: ld2450
    ld2450_id: ld2450_radar
    target_count:
      name: Presence Target Count
    still_target_count:
      name: Still Target Count
    moving_target_count:
      name: Moving Target Count
    target_1:
      x:
        name: Target-1 X
      y:
        name: Target-1 Y
      speed:
        name: Target-1 Speed
      angle:
        name: Target-1 Angle
      distance:
        name: Target-1 Distance
      resolution:
        name: Target-1 Resolution
    target_2:
      x:
        name: Target-2 X
      y:
        name: Target-2 Y
      speed:
        name: Target-2 Speed
      angle:
        name: Target-2 Angle
      distance:
        name: Target-2 Distance
      resolution:
        name: Target-2 Resolution
    target_3:
      x:
        name: Target-3 X
      y:
        name: Target-3 Y
      speed:
        name: Target-3 Speed
      angle:
        name: Target-3 Angle
      distance:
        name: Target-3 Distance
      resolution:
        name: Target-3 Resolution
    zone_1:
      target_count:
        name: Zone-1 All Target Count
        id: zone_1_count
        on_value:
        - then:
            - binary_sensor.template.publish:
                id: zone_1_presence
                state: !lambda 'return id(zone_1_count).state > 0;'
      still_target_count:
        name: Zone-1 Still Target Count
      moving_target_count:
        name: Zone-1 Moving Target Count
    zone_2:
      target_count:
        name: Zone-2 All Target Count
        id: zone_2_count
        on_value:
        - then:
            - binary_sensor.template.publish:
                id: zone_2_presence
                state: !lambda 'return id(zone_2_count).state > 0;'
      still_target_count:
        name: Zone-2 Still Target Count
      moving_target_count:
        name: Zone-2 Moving Target Count
    zone_3:
      target_count:
        name: Zone-3 All Target Count
        id: zone_3_count
        on_value:
        - then:
            - binary_sensor.template.publish:
                id: zone_3_presence
                state: !lambda 'return id(zone_3_count).state > 0;'
      still_target_count:
        name: Zone-3 Still Target Count
      moving_target_count:
        name: Zone-3 Moving Target Count

# Enable logging
logger:

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

ota:
  - platform: esphome
    password: "xxxxxxxxxxxxxxxxxxxxxxxxxxx"

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

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

captive_portal:

Anything in the logs that might be useful for us?

No response

Additional information

No response

randybb commented 2 months ago

try to Clear build files

m90att commented 2 months ago

Hi @randybb, thanks for the reply. I've tried 'Clean Build Files' but get the same error... image

I've also found this information on the underlined word in the YAML but I'm not experienced enough to troubleshoot... image

ssieb commented 2 months ago

I just tried your config and it compiled with no problems. Try adding a refresh: 1min option to the external component config. Your cached copy seems to be messed up somehow.

randybb commented 2 months ago

This is why I proposed the clearing of build files as I added it to my config and I got the same validation error, but once I cleared build files it compiled without any issues.

m90att commented 2 months ago

Thank you, I tried it again this morning and it's working. I can't begin to imagine what the cause was but I accept that it is likely to be local to my setup. Thank you for your support. Closing.