Support for AXP192 power management chip?

On this ESPHome documentation page: https://esphome.io/cookbook/leak-detector-m5stickc it shows an example using an M5Stick and includes support for the AXP192 power management chip. I tried borrowing the YAML for enabling that on my own M5Stick, but I’m getting an error message when I try to compile it " Platform not found: ‘sensor.axp192’. "

There is no AXP192 platform listed on esphome.io so where is this support supposed to come from? Is there some way to pull in additional Arduino libraries?

The relevant bits of YAML that I used:

    i2c:
       - id: bus_a
         sda: GPIO21
         scl: GPIO22
         scan: true
    
    sensor:
       - platform: axp192
         address: 0x34
         i2c_id: bus_a
         update_interval: 30s
         battery_level:
           name: "${friendly_name} Battery Level"
           id: "m5stick_batterylevel"

Perhaps clues here? https://github.com/airy10/esphome-m5stickC/issues/4

Aha! That lead me to the solution. Strange that a cookbook answer on their website fails to mention that there’s a bunch of code you need to install manually before it works, but it does work!

Thank you for the assist!

Yes, that needs fixing!

PR submitted https://github.com/esphome/esphome-docs/pull/651

1 Like

Ok, I must be being very dim here. I just cannot get the AXP192 component to turn the light on my my M5Core2. It does all the debug stuff etc. But display is off, if I flash the display demo code via Ardunio IDE it works and then all the other display stuff work also when I reflask esphome until a powerdown, then its blank again.

Is there a light.on() I need to call somewhere?

Tearing my hair out (and I cant spare too much)