Closed mvturnho closed 5 years ago
This is solved with
@OttoWinter could we reopen this issue?
I tried again with another yaml project and with the latest esphomeyaml version 1.11.0-dev and it gives the error:
$ esphomeyaml controlpanel.yaml compile
INFO Reading configuration...
INFO Generating C++ source...
INFO Updating esphomelib copy from git (controlpanel\.piolibdeps\esphomelib)
Already up to date.
INFO Compiling app...
INFO Running: platformio run -d controlpanel
Processing controlpanel (platform: espressif8266@1.8.0; framework: arduino; board: nodemcuv2)
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/nodemcuv2.html
PLATFORM: Espressif 8266 > NodeMCU 1.0 (ESP-12E Module)
HARDWARE: ESP8266 80MHz 80KB RAM (4MB Flash)
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(off) COMPATIBILITY(soft)
Collected 57 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <AsyncMqttClient> 0.8.2
| |-- <ESPAsyncTCP> 1.2.0
|-- <ESP8266WiFi> 1.0
|-- <ESP8266mDNS>
|-- <FastLED> 3.2.0
|-- <Hash> 1.0
|-- <esphomelib> 1.11.0-dev #0bea62d
| |-- <ArduinoJson-esphomelib> 5.13.3
| |-- <ESPAsyncTCP> 1.2.0
Compiling .pioenvs\controlpanel\src\main.cpp.o
Compiling .pioenvs\controlpanel\lib0ca\AsyncMqttClient_ID346\AsyncMqttClient\Packets\UnsubAckPacket.cpp.o
Compiling .pioenvs\controlpanel\lib180\ESP8266WiFi\BearSSLHelpers.cpp.o
Compiling .pioenvs\controlpanel\lib180\ESP8266WiFi\CertStoreBearSSL.cpp.o
Compiling .pioenvs\controlpanel\lib180\ESP8266WiFi\ESP8266WiFi.cpp.o
Compiling .pioenvs\controlpanel\lib180\ESP8266WiFi\ESP8266WiFiAP.cpp.o
Compiling .pioenvs\controlpanel\lib180\ESP8266WiFi\ESP8266WiFiGeneric.cpp.o
Compiling .pioenvs\controlpanel\lib180\ESP8266WiFi\ESP8266WiFiMulti.cpp.o
In file included from src\main.cpp:5:0:
src\custom_i2c.h:2: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
*
**************************************************************
#include "Wire.h"
^
compilation terminated.
*** [.pioenvs\controlpanel\src\main.cpp.o] Error 1
[ERROR] Took 4.39 seconds
esphomeyaml:
name: controlpanel
platform: ESP8266
board: nodemcuv2
esphomelib_version:
branch: dev
includes:
- controlpanel/src/custom_i2c.h
custom_i2c.h
#include "esphomelib.h"
#include "Wire.h"
using namespace esphomelib;
class MyCustomComponent : public Component {
public:
void setup() override {
// Initialize the device here. Usually Wire.begin() will be called in here,
// though that call is unnecessary if you have an 'i2c:' entry in your config
Wire.begin();
}
void loop() override {
// Example: write the value 0x42 to register 0x78 of device with address 0x21
Wire.beginTransmission(0x21);
Wire.write(0x78);
Wire.write(0x42);
Wire.endTransmission();
}
};
when using version 1.10.1 it compiles just fine
Guessing this is due to LDF being disabled - if you don't include an i2c entry in your YAML, it has no idea that your custom component wants to use Wire.h. @ottowinter may have a better solution, but adding Wire to your library list in platformio.ini is probably the easy fix.
Yes it's almost certainly the LDF. I'm currently thinking that more people will run into this in the future because every library that is slightly misconfigured will cause troubles - probably I'll just end up making use_custom_code: true
re-enabling the LDF (I still want to leave LDF off by default because it makes compiling faster).
For your case though you can probably add Wire
to libraries
and things should work fine.
@brandond and @OttoWinter , tried your solution, but this has not the deired effect.
I added i2c and the Wire library to my controlpanel.yaml file.
esphomeyaml:
name: controlpanel
platform: ESP8266
board: nodemcuv2
esphomelib_version:
branch: dev
includes:
- controlpanel/src/custom_i2c.h
libraries:
- Wire
- I2Cdevlib-esphomelib
wifi:
ssid: 'XXXXXXXXXXX'
password: 'XXXXXXXXXXXXXXXXXX'
domain : .visconti.nl
mqtt:
broker: '192.168.3.100'
port: 1883
# Enable logging
logger:
level: DEBUG
ota:
safe_mode: True
password: VERYSECURE
i2c:
sda: D2
scl: D4
scan: True
light:
- platform: fastled_clockless
id: light_fastled
chipset: WS2812B
pin: D3
num_leds: 16
rgb_order: GRB
name: 'LED Strip'
Compilation gives:
$ esphomeyaml controlpanel.yaml compile
INFO Reading configuration...
INFO Generating C++ source...
INFO Updating esphomelib copy from git (controlpanel\.piolibdeps\esphomelib)
Already up to date.
INFO Compiling app...
INFO Running: platformio run -d controlpanel
Processing controlpanel (platform: espressif8266@1.8.0; framework: arduino; board: nodemcuv2)
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/nodemcuv2.html
PLATFORM: Espressif 8266 > NodeMCU 1.0 (ESP-12E Module)
HARDWARE: ESP8266 80MHz 80KB RAM (4MB Flash)
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(off) COMPATIBILITY(soft)
Collected 58 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <AsyncMqttClient> 0.8.2
| |-- <ESPAsyncTCP> 1.2.0
|-- <ESP8266WiFi> 1.0
|-- <ESP8266mDNS>
|-- <FastLED> 3.2.0
|-- <Hash> 1.0
|-- <I2Cdevlib-esphomelib> 1.1.0
|-- <Wire> 1.0
|-- <esphomelib> 1.11.0-dev #5eeead9
| |-- <ArduinoJson-esphomelib> 5.13.3
| |-- <ESPAsyncTCP> 1.2.0
Compiling .pioenvs\controlpanel\src\main.cpp.o
Archiving .pioenvs\controlpanel\lib180\libESP8266WiFi.a
Archiving .pioenvs\controlpanel\lib27d\libESP8266mDNS.a
Archiving .pioenvs\controlpanel\lib18f\libHash.a
Compiling .pioenvs\controlpanel\lib10a\I2Cdevlib-esphomelib_ID3838\AD7746.cpp.o
Compiling .pioenvs\controlpanel\lib10a\I2Cdevlib-esphomelib_ID3838\ADS1115.cpp.o
Compiling .pioenvs\controlpanel\lib10a\I2Cdevlib-esphomelib_ID3838\BMP085.cpp.o
Compiling .pioenvs\controlpanel\lib10a\I2Cdevlib-esphomelib_ID3838\DS1307.cpp.o
Compiling .pioenvs\controlpanel\lib10a\I2Cdevlib-esphomelib_ID3838\HMC5843.cpp.o
Compiling .pioenvs\controlpanel\lib10a\I2Cdevlib-esphomelib_ID3838\HTU21D.cpp.o
Compiling .pioenvs\controlpanel\lib10a\I2Cdevlib-esphomelib_ID3838\I2Cdev.cpp.o
In file included from .piolibdeps\I2Cdevlib-esphomelib_ID3838\src\AD7746.h:38:0,
from .piolibdeps\I2Cdevlib-esphomelib_ID3838\src\AD7746.cpp:35:
.piolibdeps\I2Cdevlib-esphomelib_ID3838\src\I2Cdev.h:53: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
*
**************************************************************
#include <Wire.h>
^
compilation terminated.
*** [.pioenvs\controlpanel\lib10a\I2Cdevlib-esphomelib_ID3838\AD7746.cpp.o] Error 1
In file included from .piolibdeps\I2Cdevlib-esphomelib_ID3838\src\ADS1115.h:40:0,
from .piolibdeps\I2Cdevlib-esphomelib_ID3838\src\ADS1115.cpp:36:
.piolibdeps\I2Cdevlib-esphomelib_ID3838\src\I2Cdev.h:53: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
*
**************************************************************
#include <Wire.h>
^
compilation terminated.
*** [.pioenvs\controlpanel\lib10a\I2Cdevlib-esphomelib_ID3838\ADS1115.cpp.o] Error 1
In file included from .piolibdeps\I2Cdevlib-esphomelib_ID3838\src\BMP085.h:36:0,
from .piolibdeps\I2Cdevlib-esphomelib_ID3838\src\BMP085.cpp:33:
.piolibdeps\I2Cdevlib-esphomelib_ID3838\src\I2Cdev.h:53: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
*
**************************************************************
#include <Wire.h>
^
compilation terminated.
*** [.pioenvs\controlpanel\lib10a\I2Cdevlib-esphomelib_ID3838\BMP085.cpp.o] Error 1
In file included from .piolibdeps\I2Cdevlib-esphomelib_ID3838\src\DS1307.h:37:0,
from .piolibdeps\I2Cdevlib-esphomelib_ID3838\src\DS1307.cpp:37:
.piolibdeps\I2Cdevlib-esphomelib_ID3838\src\I2Cdev.h:53: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
*
**************************************************************
#include <Wire.h>
^
compilation terminated.
*** [.pioenvs\controlpanel\lib10a\I2Cdevlib-esphomelib_ID3838\DS1307.cpp.o] Error 1
In file included from .piolibdeps\I2Cdevlib-esphomelib_ID3838\src\HMC5843.h:36:0,
from .piolibdeps\I2Cdevlib-esphomelib_ID3838\src\HMC5843.cpp:33:
.piolibdeps\I2Cdevlib-esphomelib_ID3838\src\I2Cdev.h:53: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
*
**************************************************************
#include <Wire.h>
^
compilation terminated.
*** [.pioenvs\controlpanel\lib10a\I2Cdevlib-esphomelib_ID3838\HMC5843.cpp.o] Error 1
In file included from .piolibdeps\I2Cdevlib-esphomelib_ID3838\src\HTU21D.h:36:0,
from .piolibdeps\I2Cdevlib-esphomelib_ID3838\src\HTU21D.cpp:33:
.piolibdeps\I2Cdevlib-esphomelib_ID3838\src\I2Cdev.h:53: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
*
**************************************************************
#include <Wire.h>
^
compilation terminated.
*** [.pioenvs\controlpanel\lib10a\I2Cdevlib-esphomelib_ID3838\HTU21D.cpp.o] Error 1
In file included from .piolibdeps\I2Cdevlib-esphomelib_ID3838\src\I2Cdev.cpp:46:0:
.piolibdeps\I2Cdevlib-esphomelib_ID3838\src\I2Cdev.h:53: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
*
**************************************************************
#include <Wire.h>
^
compilation terminated.
*** [.pioenvs\controlpanel\lib10a\I2Cdevlib-esphomelib_ID3838\I2Cdev.cpp.o] Error 1
[ERROR] Took 4.08 seconds
custom_i2c.h
#include "esphomelib.h"
#include "MPR121.h"
#include "Wire.h"
using namespace esphomelib;
class MyCustomComponent : public Component {
public:
void setup() override {
// Initialize the device here. Usually Wire.begin() will be called in here,
// though that call is unnecessary if you have an 'i2c:' entry in your config
Wire.begin();
}
void loop() override {
// Example: write the value 0x42 to register 0x78 of device with address 0x21
Wire.beginTransmission(0x21);
Wire.write(0x78);
Wire.write(0x42);
Wire.endTransmission();
}
};
platformio.ini
; Auto generated code by esphomeyaml
[common]
lib_deps =
build_flags =
upload_flags =
; ===== DO NOT EDIT ANYTHING BELOW THIS LINE =====
; ========== AUTO GENERATED CODE BEGIN ===========
[env:controlpanel]
board = nodemcuv2
build_flags =
-DESPHOMELIB_LOG_LEVEL=ESPHOMELIB_LOG_LEVEL_DEBUG
-DESPHOMEYAML_USE
-DUSE_FAST_LED_LIGHT
-DUSE_I2C
-DUSE_LIGHT
-DUSE_MQTT
-DUSE_NEW_OTA
-DUSE_OTA
-Wno-sign-compare
-Wno-unused-but-set-variable
-Wno-unused-variable
-Wl,-Teagle.flash.4m.ld
${common.build_flags}
framework = arduino
lib_deps =
AsyncMqttClient@0.8.2
ESP8266WiFi
ESP8266mDNS
FastLED@3.2.0
Hash
I2Cdevlib-esphomelib
Wire
https://github.com/OttoWinter/esphomelib.git#dev
${common.lib_deps}
lib_ldf_mode = off
platform = espressif8266@1.8.0
upload_speed = 115200
; =========== AUTO GENERATED CODE END ============
; ========= YOU CAN EDIT AFTER THIS LINE =========
With lib_ldf_mode = on
in platformio.ini
compilation works fine.
How can I set this from the yaml file?
Operating environment (Hass.io/Docker/pip/etc.):
Windows 10 commandline and Visual C++ ESP (ESP32/ESP8266/Board/Sonoff):
ESP8266 nosemcu Affected component:
https://esphomelib.com/esphomeyaml/custom/custom_component.html
Description of problem: I added the library
I2Cdevlib-esphomelib
to the yaml file to use the MPR121 driver from my custom component. Then when compiling the yaml file I get the compile errors.Problem-relevant YAML-configuration entries:
Custom component
my_custom_sensor.h
Traceback (if applicable):
Additional information: