Comments (18)
@sanderlv, the sensor uses I2C, and the library relies on Wire. To use alternative pins, you need to modify the .h file and edit the Wire declaration. It is possible that if you just use the i2c stanza inside your YAML, it will work as well.
A note: I am currently working on making this an external component, which will make the usage in ESPHome simpler.
from amg8833-esphome.
Hi, thanks for the reply and sorry for my delay. Where in the amg8833.h file do I need to assign pins?
from amg8833-esphome.
The Wire
constructor.
from amg8833-esphome.
I can confirm it's working on an esp32 using an i2c stanza, no need to muck around in amg8833.h. Here's what I added to my esphome yaml:
i2c:
sda: 27
scl: 25
scan: True
from amg8833-esphome.
Thanks for letting us know @sharpopotamus ! I really should get myself an ESP32 to play with.
from amg8833-esphome.
Unfortunately not having as good luck getting this working on an ESP32 tinypico board.
Here's my yaml for my esphome sensor:
substitutions:
devicename: carsensorv3
friendly_name: Car Sensor V3
esphome:
name: $devicename
platform: ESP32
board: tinypico
includes:
- custom/amg8833.h
- custom/amg8833_camera.h
- custom/amg8833_person_detected.h
libraries:
- "SparkFun GridEYE AMG88 Library"
- "Wire"
packages:
base: !include device_configs/base.yaml
i2c:
sda: 21
scl: 22
scan: true
frequency: 50kHz
bme680_bsec:
address: 0x77
text_sensor:
- platform: bme680_bsec
iaq_accuracy:
name: "${friendly_name} BME680 IAQ Accuracy"
- platform: custom
lambda: |-
auto amg8833 = new AMG8833CameraComponent();
App.register_component(amg8833);
return {amg8833};
text_sensors:
- name: "${friendly_name} Sensor Pixels"
binary_sensor:
- platform: custom
lambda: |-
auto amg8833 = new AMG8833PersonDetectedComponent();
App.register_component(amg8833);
return {amg8833};
binary_sensors:
name: "${friendly_name} Person Detected"
device_class: occupancy
sensor:
- platform: bme680_bsec
temperature:
name: "${friendly_name} BME680 Temperature"
id: bme680temperature
pressure:
name: "${friendly_name} BME680 Pressure"
humidity:
name: "${friendly_name} BME680 Humidity"
id: bme680humidity
iaq:
name: "${friendly_name} BME680 IAQ"
co2_equivalent:
name: "${friendly_name} BME680 eCO2"
breath_voc_equivalent:
name: "${friendly_name} BME680 Breath eVOC"
- platform: ultrasonic
trigger_pin: 33
echo_pin: 32
name: "${friendly_name} Ultrasonic Sensor"
update_interval: 5s
timeout: 3.5m
filters:
- median:
window_size: 11
send_every: 6
send_first_at: 5
- platform: custom
lambda: |-
auto amg8833 = new AMG8833Component();
App.register_component(amg8833);
return {amg8833->sensor_temperature, amg8833->max_temperature, amg8833->min_temperature, amg8833->avg_temperature, amg8833->min_index, amg8833->max_index};
sensors:
- name: "${friendly_name} Thermal Sensor Temperature"
unit_of_measurement: °C
device_class: temperature
accuracy_decimals: 2
- name: "${friendly_name} Thermal Sensor Max"
unit_of_measurement: °C
device_class: temperature
accuracy_decimals: 2
- name: "${friendly_name} Thermal Sensor Min"
unit_of_measurement: °C
device_class: temperature
accuracy_decimals: 2
- name: "${friendly_name} Thermal Sensor Avg"
unit_of_measurement: °C
device_class: temperature
accuracy_decimals: 2
- name: "${friendly_name} Thermal Sensor Min Index"
accuracy_decimals: 0
- name: "${friendly_name} Thermal Sensor Max Index"
accuracy_decimals: 0
and the error I'm getting at compile:
In file included from /data/carsensorv3/.piolibdeps/carsensorv3/SparkFun GridEYE AMG88 Library/src/SparkFun_GridEYE_Arduino_Library.cpp:30:0:
/data/carsensorv3/.piolibdeps/carsensorv3/SparkFun GridEYE AMG88 Library/src/SparkFun_GridEYE_Arduino_Library.h:38:18: fatal error: Wire.h: No such file or directory
**************************************************************
* Looking for Wire.h dependency? Check our library registry!
*
* CLI > platformio lib search "header:Wire.h"
* Web > https://platformio.org/lib/search?query=header:Wire.h
*
**************************************************************
compilation terminated.
Compiling /data/carsensorv3/.pioenvs/carsensorv3/lib64d/WiFi/WiFi.cpp.o
*** [/data/carsensorv3/.pioenvs/carsensorv3/lib4d0/SparkFun GridEYE AMG88 Library/SparkFun_GridEYE_Arduino_Library.cpp.o] Error 1
========================== [FAILED] Took 2.92 seconds ==========================
I am able to get pretty much the exact same yaml config working on a ES8266 Adafruit Huzzah, only the pin assignments are different. Trying to use the tinypico for packaging reasons.
From the sounds of things the reference to Wire.h inside Sparkfun Grideye isn't connecting like it should. Unfortunately this is way too far beyond my understanding of platformio.
I tried adding "Wire" to libraries:
but that doesn't seem to have handled the issue.
Any suggestions or ideas appreciated.
from amg8833-esphome.
@ThreeFN Wire.h
is built into ESPHome (part of I2C). What version of ESPHome are you using, and can you provide the complete output from the esphome command?
from amg8833-esphome.
@TheRealWaldo ESPHome is v2021.10.3 (latest stable).
Full output for a compile to datafile:
INFO Reading configuration /config/esphome/carsensorv3.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing carsensorv3 (board: tinypico; framework: arduino; platform: espressif32 @ 3.3.2)
--------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
Dependency Graph
|-- <AsyncTCP-esphome> 1.2.2
|-- <SparkFun GridEYE AMG88 Library> 1.0.1
|-- <Wire> 1.0.1
|-- <WiFi> 1.0
|-- <FS> 1.0
|-- <Update> 1.0
|-- <ESPAsyncWebServer-esphome> 2.0.0
| |-- <AsyncTCP-esphome> 1.2.2
|-- <DNSServer> 1.1.0
|-- <SPI> 1.0
|-- <BSEC Software Library> 1.6.1480
|-- <ESPmDNS> 1.0
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/api/api_connection.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/api/api_frame_helper.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/api/api_pb2.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/api/api_pb2_service.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/api/api_server.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/api/list_entities.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/api/proto.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/api/subscribe_state.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/api/user_services.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/api/util.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/binary_sensor/automation.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/binary_sensor/binary_sensor.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/binary_sensor/filter.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/bme680_bsec/bme680_bsec.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/captive_portal/captive_portal.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/custom/binary_sensor/custom_binary_sensor.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/custom/sensor/custom_sensor.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/custom/text_sensor/custom_text_sensor.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/esp32/core.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/esp32/gpio_arduino.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/esp32/gpio_idf.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/esp32/preferences.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/i2c/i2c.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/i2c/i2c_bus_arduino.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/i2c/i2c_bus_esp_idf.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/logger/logger.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/md5/md5.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/mdns/mdns_component.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/mdns/mdns_esp32_arduino.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/mdns/mdns_esp8266.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/mdns/mdns_esp_idf.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/network/util.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/ota/ota_backend_arduino_esp32.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/ota/ota_backend_arduino_esp8266.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/ota/ota_backend_esp_idf.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/ota/ota_component.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/sensor/automation.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/sensor/filter.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/sensor/sensor.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/socket/bsd_sockets_impl.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/socket/lwip_raw_tcp_impl.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/text_sensor/filter.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/text_sensor/text_sensor.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/ultrasonic/ultrasonic_sensor.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/web_server_base/web_server_base.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/wifi/wifi_component.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/wifi/wifi_component_esp32_arduino.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/wifi/wifi_component_esp8266.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/components/wifi/wifi_component_esp_idf.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/core/application.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/core/color.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/core/component.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/core/controller.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/core/entity_base.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/core/helpers.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/core/log.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/core/scheduler.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/esphome/core/util.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/src/main.cpp.o
Generating partitions /data/carsensorv3/.pioenvs/carsensorv3/partitions.bin
Compiling /data/carsensorv3/.pioenvs/carsensorv3/lib528/AsyncTCP-esphome/AsyncTCP.cpp.o
Compiling /data/carsensorv3/.pioenvs/carsensorv3/lib4d0/SparkFun GridEYE AMG88 Library/SparkFun_GridEYE_Arduino_Library.cpp.o
In file included from /data/carsensorv3/.piolibdeps/carsensorv3/SparkFun GridEYE AMG88 Library/src/SparkFun_GridEYE_Arduino_Library.cpp:30:0:
/data/carsensorv3/.piolibdeps/carsensorv3/SparkFun GridEYE AMG88 Library/src/SparkFun_GridEYE_Arduino_Library.h:38:18: fatal error: Wire.h: No such file or directory
**************************************************************
* Looking for Wire.h dependency? Check our library registry!
*
* CLI > platformio lib search "header:Wire.h"
* Web > https://platformio.org/lib/search?query=header:Wire.h
*
**************************************************************
compilation terminated.
*** [/data/carsensorv3/.pioenvs/carsensorv3/lib4d0/SparkFun GridEYE AMG88 Library/SparkFun_GridEYE_Arduino_Library.cpp.o] Error 1
========================= [FAILED] Took 10.69 seconds =========================
You would think this error shouldn't be happening, and maybe I'm misinterpreting the error, but it looks like the Sparkfun libraries reference to Wire isn't matching up with the other references and is being labelled as missing. Again only happening for me when I try to compile for ESP32 boards (tinypico), not for ESP8266 boards (Huzzah).
from amg8833-esphome.
@ThreeFN I have to guess that they use different I2C libraries for that specific board for one reason or another (likely some incompatibility). Please open a new issue citing that board specifically, and I'll try to look into it a bit deeper tomorrow.
from amg8833-esphome.
After I tried to reinstall on my esp32, I actually had the same error pop up. Not sure what the issue is, but I solved it by just downloading the sparkfun library and referencing it locally.
I downloaded this: https://github.com/sparkfun/SparkFun_GridEYE_Arduino_Library/releases/tag/v1.0.1 then copied SparkFun_GridEYE_Arduino_Library.cpp and SparkFun_GridEYE_Arduino_Library.h into my esphome directory. It's in the same file as amg8833.h, amg8833_camera.h, and amg8833_person_detected.h.
Then I modified the esphome yaml to call those files, removing the sparkfun library call. This is the relevant bit:
esphome:
name: ${device-name}
platform: ESP32
board: esp32dev
includes:
- amg8833.h
- amg8833_camera.h
- amg8833_person_detected.h
- SparkFun_GridEYE_Arduino_Library.cpp
- SparkFun_GridEYE_Arduino_Library.h
from amg8833-esphome.
SparkFun_GridEYE_Arduino_Library.cpp
Can confirm this workaround solved the issue for me. Again not really my expertise as to why this would solve the issue, but my guess is that the issue lies with platformio vs arduino c, etc.
@TheRealWaldo would you still like me to open a separate/new issue?
from amg8833-esphome.
@ThreeFN, yes, please. I think this might boil down to a recent change in ESPHome, and it may resolve itself when I finish up the external component.
from amg8833-esphome.
For me this was the solution/workaround. Added "Wire" before "SparkFun GridEYE AMG88 Library":
libraries:
- "Wire"
- "SparkFun GridEYE AMG88 Library"
from amg8833-esphome.
More promising...
But next step is how and where do I get a camera created? Where do I put: https://github.com/TheRealWaldo/AMG8833-ESPHOME#example
When I put it in sensors:
I get a compiling error...?
And a person is detected but there is no person in sight :-)
from amg8833-esphome.
Perhaps it's not clear:
The Thermal Vision camera can be configured by providing the AMG8833CameraComponent's resulting sensor in HASS to the configuration option pixel_sensor instead of host.
You need to install https://github.com/therealwaldo/thermal into your Home Assistant (via. HACS is the easiest), and configure the camera in your HASS yaml.
The current rudimentary person detection works off a difference of 4°C. Your min appears to be 20, and your max, 26, so it's triggering. You can tune that however you like, masking out the area that is too much heat, or adjusting the angle of the sensor so that you are not seeing hot-spots in the room.
from amg8833-esphome.
@sanderlv for the thermal camera you Need this: https://github.com/TheRealWaldo/thermal
no need for host as you have already the sensor.
from amg8833-esphome.
got it...
You can tune that however you like, masking out the area that is too much heat, or adjusting the angle of the sensor so that you are not seeing hot-spots in the room.
How and where do I mask? do?
from amg8833-esphome.
The current rudimentary person detection works off a difference of 4°C. Your min appears to be 20, and your max, 26, so it's triggering. You can tune that however you like, masking out the area that is too much heat, or adjusting the angle of the sensor so that you are not seeing hot-spots in the room.
How and where would I do that?
from amg8833-esphome.
Related Issues (7)
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.