Comments (20)
publish_state
is from the ESPHome library, so ESPHome has likely introduced a breaking change. Unfortunately, their versioning makes figuring out which version introduces breaking changes difficult, so you might have to guess and roll back a few versions to get it to build.
from amg8833-esphome.
That said, the error message seems to indicate that there is something else wrong with the code in that file. Can you post the contents of your amg8833_person_detected.h
?
from amg8833-esphome.
Also, how are you including it?
from amg8833-esphome.
I'm including it per your amg833.yaml example, as follows:
(the odd path is because I put the ZIP file of the repository in the esphome directory for reference)
substitutions:
name: esp8266-thermal-camera
text_name: "ESP8266 Thermal Camera"
esphome:
name: ${name}
comment: WeMos D1 Mini
platform: esp8266
board: esp01_1m
name_add_mac_suffix: false
includes:
- ./esp8266-amg8833-github/amg8833.h
- ./esp8266-amg8833-github/amg8833_camera.h
# - ./esp8266-amg8833-github/amg8833_person_detected.h
libraries:
- "Wire"
- "SparkFun GridEYE AMG88 Library"
Here is the actual file as I downloaded it yesterday:
#include "esphome.h"
#include <SparkFun_GridEYE_Arduino_Library.h>
class AMG8833PersonDetectedComponent : public PollingComponent, public BinarySensor
{
public:
float get_setup_priority() const override { return esphome::setup_priority::BUS; }
AMG8833PersonDetectedComponent() : PollingComponent(100) {}
void setup() override
{
Wire.begin();
grideye.begin();
}
void loop() override
{
}
void update() override
{
float pixel_temperature;
float min = 0;
float max = 0;
unsigned char local_min_index = 0;
unsigned char local_max_index = 0;
for (unsigned char i = 0; i < total_pixels; i++)
{
pixel_temperature = grideye.getPixelTemperature(i);
if (i == 0 || pixel_temperature > max)
{
max = pixel_temperature;
local_max_index = i;
}
if (i == 0 || pixel_temperature < min)
{
min = pixel_temperature;
local_min_index = i;
}
}
if (max - min > 4)
{
if (!last_state)
{
publish_state(true);
delay_count = delay;
}
last_state = true;
}
else
{
if (last_state)
{
delay_count--;
if (delay_count <= 0)
{
publish_state(false);
last_state = false;
}
}
}
}
protected:
GridEYE grideye;
static const int size = 8;
static const int total_pixels = size * size;
static const int delay = 50;
int delay_count = delay;
bool last_state = false;
};
from amg8833-esphome.
One thought here is that the directory structure is your problem; the libraries may not be able to find files that they expect to be in certain folders. For example:
#include "esphome.h"
#include <SparkFun_GridEYE_Arduino_Library.h>
It may not be finding esphome.h
because the file is one folder up in the way that ESPHome registers these files.
from amg8833-esphome.
from amg8833-esphome.
from amg8833-esphome.
from amg8833-esphome.
It's complaining about publish_state
not being defined, which comes from the esphome library, not the sparkfun lib.
from amg8833-esphome.
from amg8833-esphome.
from amg8833-esphome.
Regarding where they are in my project, ESPHome does some sort of linking in the background that has them completely external to the project.
It is still there, according to the docs for the latest version: https://esphome.io/api/binary__sensor_8h.html
Looking at your output, it shows ESPhome 2023.5.5, but 2023.6.2 is now the latest; perhaps a bug in 2023.5.5?
from amg8833-esphome.
from amg8833-esphome.
from amg8833-esphome.
from amg8833-esphome.
from amg8833-esphome.
from amg8833-esphome.
Ok, figured it out, now it compiles. Including the header file is not enough to get ESPHome to add the support files, the actual sensor has to be configured also. That doesn't do much going forward, given that they are dumping Custom Sensors in favor of External Sensors, but at least it works for the moment.
from amg8833-esphome.
@UniKyrn any documentation you can point me to about migrating to External Sensors? I haven't had to rebuild any sensors for some time but might help other people like yourselves.
from amg8833-esphome.
from amg8833-esphome.
Related Issues (7)
- License/Upstream to ESPHome HOT 2
- Use with ESP32 HOT 18
- False positive Person detected HOT 1
- Warning in the HA log HOT 2
- Looking for Wire.h HOT 3
- How to add a delay to Person Detected HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amg8833-esphome.