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