Error with MAX17043 SparkFun LiPo Fuel Gauge Integration

Hi all!!!

I’m trying to integrate this sensor for LiPo Batteries into esphome with a custom component but I get this error:

src/main.cpp: In lambda function:
src/main.cpp:392:23: error: expected type-specifier before 'MAX17043CustomSensor'
       auto maxi = new MAX17043CustomSensor();
                       ^
src/main.cpp:394:19: error: could not convert '{maxi}' from '<brace-enclosed initializer list>' to 'std::vector<esphome::sensor::Sensor*>'
       return {maxi};
                   ^
*** [/data/wadomo_postman/.pioenvs/wadomo_postman/src/main.cpp.o] Error 1

The libraries that I’m using are here: https://github.com/porrey/MAX1704X

Here are the codes that I’m using:

esphome:
  name: wadomo_postman
  platform: ESP32
  board: nodemcu-32s
  includes:
    - MAX17043.h
  libraries:
    - "https://github.com/porrey/MAX1704X"
#include "esphome.h"
#include "MAX17043.h"

class MAX17043CustomSensor : public PollingComponent, public Sensor {
 public:
  MAX17043 max;
  MAX17043CustomSensor() : PollingComponent(10000) {}

  void setup() override {
    ESP_LOGD("custom", "Starting up MAX17043 sensor");
    max.begin();
  }

  void update() override {
    // This is the actual sensor reading logic.
    float voltaje = max.voltage(); 
    publish_state(voltaje); 
  }
};

Do you know why I’m getting this error?

Thank you in advance

Any success with that? I am collecting information on whether or not it is possible to have the fuel gauge working with Home Assistant.

Hi @LSD70 , sorry for this big delay…

It seems there are some news…

In Github

I’ve used the information from a-marcel on GitHub to successfully set up part of my MAX17043. I think I’m getting the voltage reported, but the percentage is consistently 0.0.

The issue on GitHub is closed and locked, so I can’t reply there. If anyone has any thoughts, I’m interested in what I can do to get the percentage reporting correctly.

I’m using a Firebeetle ESP32 with the DFRobot MAX17043 sensor. I’ve got it wired up with the DFRobot 5v solar charger board and a LiPO battery.