boverby / lc709203f

esphome support for lc709203f on ESP32_Bat_Pro
8 stars 11 forks source link

"Platform not found: 'sensor.lc709203f'" warning in ESPHome/HA #2

Closed Kokbo closed 1 year ago

Kokbo commented 1 year ago

I get the following warning in ESPHome in Home Assistant: 'Platform not found: 'sensor.lc709203f' while creating the yaml-file.

My yaml-file looks as follows:

substitutions:
  device_name: lc709203f
  device_platform: esp32
  device_board: firebeetle32

esphome:
  name: $device_name
  platform: $device_platform
  board: $device_board
  libraries:
    -  adafruit/Adafruit_LC709203F 

sensor:
  - platform: lc709203f  **'Platform not found: 'sensor.lc709203f'.**
    address: "0x0B"
    i2c_id: bus_a
    battery_voltage:
      name: "${device_name} battery V"
    battery_level:
      name: "${device_name} battery lvl"
    icversion:
      name: "${device_name} ic"
    cell_charge:
      name: "${device_name} cell charge"
    update_interval: 30s

I've copied the files from the lc709203f repo to /esphome/custom_component/lc709203f directory. I also tried to add the files through an includes statement but that doesn't fix the warning.

Do you have any tips to get the yaml working?

Cheers.

TheLordStyle commented 1 year ago

It looks like you're missing the external_components section of your code. https://esphome.io/components/external_components.html?highlight=external_components

Here's how I have mine set up for my forked code:

esphome:
  name: garden-sensor
  on_boot:
    then:
     script.execute: is_api_connected

external_components:
  # use all components from a local folder
  - source:
      type: local
      path: custom_components

sensor:
  - platform: lc709203f
    address: 0x0B
    i2c_id: bus_a

This project's code is a little outdates and won't work with the latest esphome without some tweaks but you can check out the forks of this code which address those issues.