stefanthoss / esphome-axp2101

ESPHome component for AXP2101
2 stars 4 forks source link

axp2101.h:4:10: fatal error: esphome/components/binary_sensor/binary_sensor.h: No such file or directory #3

Open lboue opened 5 months ago

lboue commented 5 months ago

Hi,

Thanks for your work. I am facing a build issue with your component for CoreS3. Do you know how to fix it?

Environment

Config

i2c:
  scl: GPIO11
  sda: GPIO12
  scan: true
  id: bus_a

external_components:
  #https://github.com/stefanthoss/esphome-axp2101
  - source: github://stefanthoss/esphome-axp2101
    components: [ axp2101 ]

sensor:
  - platform: axp2101
    model: M5CORE2
    address: 0x34
    i2c_id: bus_a
    update_interval: 30s
    brightness: 75%
    battery_voltage:
      name: "Battery Voltage"
    battery_level:
      name: "Battery Level"
    battery_charging:
      name: "Battery Charging"

Error log

Compiling .pioenvs/m5stack-cores3-85ae78/src/esphome/components/axp2101/axp2101.cpp.o
In file included from src/esphome/components/axp2101/axp2101.cpp:1:
src/esphome/components/axp2101/axp2101.h:4:10: fatal error: esphome/components/binary_sensor/binary_sensor.h: No such file or directory
 #include "esphome/components/binary_sensor/binary_sensor.h"
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

Full error log

INFO ESPHome 2024.1.0-dev
INFO Reading configuration /config/esphome/cores3-lbo.yaml...
INFO Detected timezone 'Europe/Paris'
WARNING GPIO36 is used by the PSRAM interface on ESP32-S3R8 / ESP32-S3R8V and should be avoided on these models
WARNING GPIO37 is used by the PSRAM interface on ESP32-S3R8 / ESP32-S3R8V and should be avoided on these models
WARNING GPIO35 is used by the PSRAM interface on ESP32-S3R8 / ESP32-S3R8V and should be avoided on these models
WARNING GPIO3 is a strapping PIN and should only be used for I/O with care.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
WARNING GPIO33 is used by the PSRAM interface on ESP32-S3R8 / ESP32-S3R8V and should be avoided on these models
WARNING GPIO0 is a strapping PIN and should only be used for I/O with care.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
INFO Generating C++ source...
INFO Compiling app...
Processing m5stack-cores3-85ae78 (board: esp32-s3-devkitc-1; framework: arduino; platform: platformio/espressif32@5.4.0)
--------------------------------------------------------------------------------
HARDWARE: ESP32S3 240MHz, 320KB RAM, 8MB Flash
 - toolchain-riscv32-esp @ 8.4.0+2021r2-patch5 
 - toolchain-xtensa-esp32s3 @ 8.4.0+2021r2-patch5
Dependency Graph
|-- WiFi @ 2.0.0
|-- ESPmDNS @ 2.0.0
|-- Update @ 2.0.0
|-- noise-c @ 0.1.4
|-- SPI @ 2.0.0
|-- Wire @ 2.0.0
|-- XPowersLib @ 0.2.1
Compiling .pioenvs/m5stack-cores3-85ae78/src/esphome/components/axp2101/axp2101.cpp.o
In file included from src/esphome/components/axp2101/axp2101.cpp:1:
src/esphome/components/axp2101/axp2101.h:4:10: fatal error: esphome/components/binary_sensor/binary_sensor.h: No such file or directory
 #include "esphome/components/binary_sensor/binary_sensor.h"
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
*** [.pioenvs/m5stack-cores3-85ae78/src/esphome/components/axp2101/axp2101.cpp.o] Error 1
========================= [FAILED] Took 26.13 seconds =========================
lboue commented 5 months ago

@stefanthoss It's really strange, when I add the binary_sensor section in the configuration it build:

binary_sensor:
  - platform: touchscreen
    name: Left Touch Button
    x_min: 0
    x_max: 106
    y_min: 120
    y_max: 140

  - platform: touchscreen
    name: Middle Touch Button
    x_min: 107
    x_max: 213
    y_min: 120
    y_max: 140

  - platform: touchscreen
    name: Right Touch Button
    x_min: 214
    x_max: 320
    y_min: 120
    y_max: 140
lboue commented 5 months ago

The output is OK now:

image

Bootlog

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x15 (USB_UART_CHIP_RESET),boot:0x28 (SPI_FAST_FLASH_BOOT)
Saved PC:0x40378c21
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x43c
load:0x403c9700,len:0xbec
load:0x403cc700,len:0x2a3c
entry 0x403c98d8
[I][logger:355]: Log initialized
[C][ota:473]: There have been 0 suspected unsuccessful boot attempts.
[D][esp32.preferences:114]: Saving 1 preferences to flash...
[D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[I][app:029]: Running through setup()...
[D][spi:039]: Setting up SPI bus...
[I][i2c.arduino:183]: Performing I2C bus recovery
[D][ili9xxx:021]: Setting up ILI9xxx
[D][spi_device:369]: mode 0, data_rate 40000kHz
[C][axp2101.sensor:037]: getID:0x4a
[C][axp2101.sensor:050]: ->  getSysPowerDownVoltage:2600
[C][axp2101.sensor:056]: ->  getSysPowerDownVoltage:2600
[C][axp2101.sensor:062]: DC1  : +   Voltage:3300 mV
[C][axp2101.sensor:068]: DC2  : -   Voltage:1000 mV
[C][axp2101.sensor:075]: DC3  : +   Voltage:3300 mV
[C][axp2101.sensor:081]: DC4  : -   Voltage:1000 mV
[C][axp2101.sensor:087]: DC5  : -   Voltage:3300 mV
[C][axp2101.sensor:142]: DC1  : +   Voltage:3300 mV
[C][axp2101.sensor:143]: DC2  : +   Voltage:1000 mV
[C][axp2101.sensor:144]: DC3  : +   Voltage:3300 mV
[C][axp2101.sensor:145]: DC4  : +   Voltage:1000 mV
[C][axp2101.sensor:146]: DC5  : +   Voltage:3300 mV
[C][axp2101.sensor:147]: ALDO1: +   Voltage:3300 mV
[C][axp2101.sensor:148]: ALDO2: +   Voltage:3300 mV
[C][axp2101.sensor:149]: ALDO3: -   Voltage:3300 mV
[C][axp2101.sensor:150]: ALDO4: +   Voltage:3300 mV
[C][axp2101.sensor:151]: BLDO1: +   Voltage:3300 mV
[C][axp2101.sensor:152]: BLDO2: +   Voltage:3300 mV
[C][axp2101.sensor:153]: CPUSLDO: + Voltage:1000 mV
[C][axp2101.sensor:154]: DLDO1: -   Voltage:3300 mV
[C][axp2101.sensor:155]: DLDO2: -   Voltage:1900 mV
[C][axp2101.sensor:162]: PowerKeyPressOffTime: 4 Second
[C][axp2101.sensor:181]: PowerKeyPressOnTime: 128 Ms
[C][axp2101.sensor:200]: getDCHighVoltagePowerDowmEn: ENABLE
[C][axp2101.sensor:203]: getDC1LowVoltagePowerDowmEn: ENABLE
[C][axp2101.sensor:206]: getDC2LowVoltagePowerDowmEn: ENABLE
[C][axp2101.sensor:209]: getDC3LowVoltagePowerDowmEn: ENABLE
[C][axp2101.sensor:212]: getDC4LowVoltagePowerDowmEn: ENABLE
[C][axp2101.sensor:215]: getDC5LowVoltagePowerDowmEn: ENABLE
[C][FT63X6Touchscreen:029]: Setting up FT63X6Touchscreen Touchscreen...
[D][binary_sensor:034]: 'Left Touch Button': Sending initial state OFF
[D][binary_sensor:034]: 'Middle Touch Button': Sending initial state OFF
[D][binary_sensor:034]: 'Right Touch Button': Sending initial state OFF
[D][axp2101.sensor:306]: Got Battery Voltage=3685.000000
[D][sensor:094]: 'Battery Voltage': Sending state 3.68500  with 3 decimals of accuracy
[D][axp2101.sensor:319]: Got Battery Level=12.000000
[D][sensor:094]: 'Battery Level': Sending state 12.00000 % with 0 decimals of accuracy
[D][axp2101.sensor:329]: Got Battery Charging=true
[D][binary_sensor:036]: 'Battery Charging': Sending state ON
[D][axp2101.sensor:417]: Brightness=0.750000 (Curr: -1.000000)
[W][component:214]: Component display took a long time for an operation (0.05 s).
[W][component:215]: Components should block for at most 20-30ms.
[W][component:214]: Component display took a long time for an operation (0.05 s).
[W][component:215]: Components should block for at most 20-30ms.
[C][logger:443]: Logger:
[C][logger:444]:   Level: DEBUG
[C][logger:445]:   Log Baud Rate: 115200
[C][logger:447]:   Hardware UART: USB_CDC
[C][spi:067]: SPI bus:
[C][spi:068]:   CLK Pin: GPIO36
[C][spi:069]:   SDI Pin: GPIO35
[C][spi:070]:   SDO Pin: GPIO37
[C][spi:072]:   Using HW SPI: SPI
[C][i2c.arduino:053]: I2C Bus:
[C][i2c.arduino:054]:   SDA Pin: GPIO12
[C][i2c.arduino:055]:   SCL Pin: GPIO11
[C][i2c.arduino:056]:   Frequency: 50000 Hz
[C][i2c.arduino:059]:   Recovery: bus successfully recovered
[I][i2c.arduino:069]: Results from i2c bus scan:
[I][i2c.arduino:075]: Found i2c device at address 0x34
[I][i2c.arduino:075]: Found i2c device at address 0x40
[I][i2c.arduino:075]: Found i2c device at add[I][i2c.arduino:075]: Found i2c device at address 0x580;32m[I][i2c.arduino:075]: Found i2c device at address 0x690;35m[C][ili9xxx:069]: ili9xxx
[C][ili9xxx:069]:   Rotations: 0 °
[C][ili9xxx:069]:   Dimensions: 320px x 240px
[C][ili9xxx:070]:   Width Offset: 0
[C][ili9xxx:071]:   Height Offset: 0
[C][ili9xxx:077]:   Color mode: 16bit
[C][ili9xxx:086]:   Data rate: 40MHz
[C][ili9xxx:089]:   CS Pin: GPIO5
[C][ili9xxx:090]:   DC Pin: GPIO15
[C][ili9xxx:092]:   Swap_xy: NO
[C][ili9xxx:093]:   Mirror_x: NO
[C][ili9xxx:094]:   Mirror_y: NO
[C][ili9xxx:099]:   Update Interval: 1.0s
[C][axp2101.sensor:293]: AXP2101:
[C][axp2101.sensor:294]:   Address: 0x34
[C][axp2101.sensor:295]:   Battery Voltage 'Battery Voltage'
[C][axp2101.sensor:295]:     Device Class: 'voltage'
[C][axp2101.sensor:295]:     State Class: ''
[C][axp2101.sensor:295]:     Unit of Measurement: ''
[C][axp2101.sensor:295]:     Accuracy Decimals: 3
[C][axp2101.sensor:296]:   Battery Level 'Battery Level'
[C][axp2101.sensor:296]:     State Class: ''
[C][axp2101.sensor:296]:     Unit of Measurement: '%'
[C][axp2101.sensor:296]:     Accuracy Decimals: 0
[C][axp2101.sensor:296]:     Icon: 'mdi:battery'
[C][axp2101.sensor:297]:   Battery Charging 'Battery Charging'
[C][axp2101.sensor:297]:     Device Class: 'battery_charging'
[C][FT63X6Touchscreen:075]: FT63X6 Touchscreen:
[C][FT63X6Touchscreen:076]:   Address: 0x38
[C][psram:020]: PSRAM:
[C][psram:021]:   Available: YES
[C][psram:024]:   Size: 8191 KB
[C][captive_portal:088]: Captive Portal:
[C][mdns:115]: mDNS:
[C][mdns:116]:   Hostname: core-s3-axp2101
[C][ota:097]: Over-The-Air Updates:
[C][ota:098]:   Address: core-s3-axp2101.local:3232
[C][ota:101]:   Using Password.
[C][api:139]: API Server:
[C][api:140]:   Address: core-s3-axp2101.local:6053
[C][api:142]:   Using noise encryption: YES
stefanthoss commented 5 months ago

Not 100% sure why it can't find the binary sensor dependency. If you don't need any binary sensors, this should also work by just defining an empty

binary_sensor:

section.

lboue commented 5 months ago

Not 100% sure why it can't find the binary sensor dependency. If you don't need any binary sensors, this should also work by just defining an empty

binary_sensor:

section.

Thank you. Yes, I can confirm that it works with this workaround.