Skip to content

External regression - Si1145 Project doesn't compile anymore #2743

@Lefuneste83

Description

@Lefuneste83

The problem

I have noticed that I cannot compile my weather station project anymore. It has been working for years but probably due to a change in the libraries dependencies, it refuses to compile anymore, It seems to miss one library since I last updated Esphome.

/data/weather/.piolibdeps/weather/Adafruit SI1145 Library/Adafruit_SI1145.h:25:32: fatal error: Adafruit_I2CDevice.h: No such file or directory

I have tried to force previous versions of the Adafruit SI1145 Library but with no success. If I place this library Adafruit_I2CDevice.h by hand in the /config/esphome directory, it then complains about Wire.h missing.

I think something has changed with the Adafruit SI1145 Library as it now installs the Adafruit BusIO as a dependency which I believe was not the case.

If anyone has some idea on how to solve this as it seems a widespread issue with the Adafruit BusIO Library.

Which version of ESPHome has the issue?

v2021.12.0-dev

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

core-2021.11.5

What platform are you using?

ESP8266

Board

D1 Mini

Component causing the issue

SI1145, I2C, Wire

Example YAML snippet

esphome:
  name: Weather
  platform: ESP8266
  board: d1_mini
  
  includes:
    - SI1145.h
  libraries:
    - "Adafruit SI1145 Library"
    
wifi:
  ssid: "Bla"
  password: "blabla"
  fast_connect: on

  manual_ip:
    static_ip: 192.168.0.x
    gateway: 192.168.0.x
    subnet: 255.255.255.0
    dns1: 192.168.0.x
    dns2: 8.8.8.8
    
# Enable logging
logger:

# Enable Home Assistant API
ota:
  password: 'blablabla'

mqtt:
  broker: 192.168.0.x
  username: blabla
  password: "blablabla"
  birth_message:
  will_message:
  
i2c:
  sda: GPIO4
  scl: GPIO5
  id: bus_a
  scan: True
  frequency: 100000 Hz

sensor:
  - platform: sht3xd
    temperature:
      name: "Weather SHT35 Temperature"
    humidity:
      name: "Weather SHT35 Humidity"
    address: 0x44
    update_interval: 3s

  - platform: tsl2561
    name: "Weather TSL2561 Ambiant Light"
    address: 0x39
    integration_time: 402ms
    update_interval: 3s
    
  - platform: wifi_signal
    name: "Weather WiFi Signal"
    update_interval: 3s

  - platform: adc
    pin: A0
    name: "Weather Battery Level"
    update_interval: 3s
    filters:
      - multiply: 5.23
    
  - platform: bme280
    temperature:
      name: "Weather BME280 Temperature"
      id: bme280_temperature
      oversampling: 16x
    pressure:
      name: "Weather BME280 Pressure"
      id: bme280_pressure
      oversampling: 16x
    humidity:
      name: "Weather BME280 Relative Humidity"
      id: bme280_humidity
#      filters:
#        - calibrate_polynomial:
#            degree: 2
#            datapoints:
#               - 33.4 -> 23 
#               - 42.9 -> 33
#               - 46.7 -> 38
#               - 48 -> 40
#               - 52.1 -> 45
#               - 54.7 -> 48
#               - 65.7 -> 62
#               - 69.5 -> 66
#               - 78.8 -> 77
#               - 79.5 -> 79
#               - 81.9 -> 81
#               - 91.8 -> 90
#               - 97.5 -> 93
#               - 100 -> 94
#               - 100 -> 100
    address: 0x76
    update_interval: 3s
    
  - platform: template
    name: "Weather Calc Absolute Humidity"
    lambda: |-
      const float mw = 18.01534;    // molar mass of water g/mol
      const float r = 8.31447215;   // Universal gas constant J/mol/K
      return (6.112 * powf(2.718281828, (17.67 * id(bme280_temperature).state) /
        (id(bme280_temperature).state + 243.5)) * id(bme280_humidity).state * mw) /
        ((273.15 + id(bme280_temperature).state) * r); // in grams/m^3
    accuracy_decimals: 2
    update_interval: 3s

  - platform: template
    name: "Weather Calc ESL Pressure"
    lambda: |-
      const float STANDARD_ALTITUDE = 260; // in meters, see note
      return id(bme280_pressure).state / powf(1 - ((0.0065 * STANDARD_ALTITUDE) /
        (id(bme280_temperature).state + (0.0065 * STANDARD_ALTITUDE) + 273.15)), 5.257); // in hPa
    update_interval: 3s

  - platform: custom
    lambda: |-
      auto UV_sensor = new SI1145_sensor();
      App.register_component(UV_sensor);
      return {UV_sensor->visible_sensor, UV_sensor->ir_sensor, UV_sensor->uvindex_sensor};

    sensors:
    - name: "Weather SI1145 Visible Light"
      unit_of_measurement: lux
      filters:
      - offset: -260
    - name: "Weather SI1145 IR Light"
      unit_of_measurement: lux
      filters:
      - offset: -252
    - name: "Weather SI1145 UV Index"
      unit_of_measurement: uvindex
      accuracy_decimals: 2
      
deep_sleep:
  run_duration: 10s
  sleep_duration: 10min

Anything in the logs that might be useful for us?

INFO Reading configuration /config/esphome/weather.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing weather (board: d1_mini; framework: arduino; platform: platformio/espressif8266 @ 2.6.3)
--------------------------------------------------------------------------------
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
Library Manager: Installing Adafruit SI1145 Library

Unpacking  [------------------------------------]    0%
Unpacking  [###---------------------------------]    9%
Unpacking  [######------------------------------]   18%
Unpacking  [#########---------------------------]   27%
Unpacking  [#############-----------------------]   36%
Unpacking  [################--------------------]   45%
Unpacking  [###################-----------------]   54%
Unpacking  [######################--------------]   63%
Unpacking  [##########################----------]   72%
Unpacking  [#############################-------]   81%
Unpacking  [################################----]   90%
Unpacking  [####################################]  100%
Library Manager: Adafruit SI1145 Library @ 1.2.0 has been installed!
Library Manager: Installing dependencies...
Library Manager: Installing Adafruit BusIO
Library Manager: Warning! More than one package has been found by Adafruit BusIO requirements:
 - adafruit/Adafruit BusIO @ 1.9.6
 - mertmechanic/Adafruit BusIO @ 1.7.3
Library Manager: Please specify detailed REQUIREMENTS using package owner and version (showed above) to avoid name conflicts

Unpacking  [------------------------------------]    0%
Unpacking  [#-----------------------------------]    4%
Unpacking  [###---------------------------------]    9%
Unpacking  [#####-------------------------------]   14%
Unpacking  [######------------------------------]   19%
Unpacking  [########----------------------------]   23%
Unpacking  [##########--------------------------]   28%
Unpacking  [############------------------------]   33%
Unpacking  [#############-----------------------]   38%
Unpacking  [###############---------------------]   42%
Unpacking  [#################-------------------]   47%
Unpacking  [##################------------------]   52%
Unpacking  [####################----------------]   57%
Unpacking  [######################--------------]   61%
Unpacking  [########################------------]   66%
Unpacking  [#########################-----------]   71%
Unpacking  [###########################---------]   76%
Unpacking  [#############################-------]   80%
Unpacking  [##############################------]   85%
Unpacking  [################################----]   90%
Unpacking  [##################################--]   95%
Unpacking  [####################################]  100%
Library Manager: Adafruit BusIO @ 1.9.6 has been installed!
Dependency Graph
|-- <ESPAsyncTCP-esphome> 1.2.3
|-- <Adafruit SI1145 Library> 1.2.0
|-- <ESP8266WiFi> 1.0
|-- <AsyncMqttClient-esphome> 0.8.6
|   |-- <ESPAsyncTCP-esphome> 1.2.3
|-- <Wire> 1.0
|-- <ArduinoJson-esphomelib> 5.13.3
|-- <ESP8266mDNS> 1.2
Compiling /data/weather/.pioenvs/weather/src/esphome/components/adc/adc_sensor.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/bme280/bme280.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/custom/sensor/custom_sensor.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/deep_sleep/deep_sleep_component.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/esp8266/core.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/esp8266/gpio.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/esp8266/preferences.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/i2c/i2c.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/i2c/i2c_bus_arduino.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/i2c/i2c_bus_esp_idf.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/json/json_util.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/logger/logger.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/md5/md5.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/mdns/mdns_component.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/mdns/mdns_esp32_arduino.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/mdns/mdns_esp8266.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/mdns/mdns_esp_idf.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/mqtt/custom_mqtt_device.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/mqtt/mqtt_binary_sensor.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/mqtt/mqtt_client.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/mqtt/mqtt_climate.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/mqtt/mqtt_component.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/mqtt/mqtt_cover.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/mqtt/mqtt_fan.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/mqtt/mqtt_light.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/mqtt/mqtt_number.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/mqtt/mqtt_select.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/mqtt/mqtt_sensor.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/mqtt/mqtt_switch.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/mqtt/mqtt_text_sensor.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/network/util.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/ota/ota_backend_arduino_esp32.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/ota/ota_backend_arduino_esp8266.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/ota/ota_backend_esp_idf.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/ota/ota_component.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/sensor/automation.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/sensor/filter.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/sensor/sensor.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/sht3xd/sht3xd.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/socket/bsd_sockets_impl.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/socket/lwip_raw_tcp_impl.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/template/sensor/template_sensor.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/tsl2561/tsl2561.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/wifi/wifi_component.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/wifi/wifi_component_esp32_arduino.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/wifi/wifi_component_esp8266.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/wifi/wifi_component_esp_idf.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/components/wifi_signal/wifi_signal_sensor.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/core/application.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/core/color.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/core/component.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/core/controller.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/core/entity_base.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/core/helpers.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/core/log.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/core/scheduler.cpp.o
Compiling /data/weather/.pioenvs/weather/src/esphome/core/util.cpp.o
Compiling /data/weather/.pioenvs/weather/src/main.cpp.o
Generating LD script /data/weather/.pioenvs/weather/ld/local.eagle.app.v6.common.ld
In file included from src/SI1145.h:2:0,
                 from src/main.cpp:57:
/data/weather/.piolibdeps/weather/Adafruit SI1145 Library/Adafruit_SI1145.h:25:32: fatal error: Adafruit_I2CDevice.h: No such file or directory

****************************************************************************
* Looking for Adafruit_I2CDevice.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:Adafruit_I2CDevice.h"
* Web  > https://platformio.org/lib/search?query=header:Adafruit_I2CDevice.h
*
****************************************************************************

 #include <Adafruit_I2CDevice.h>
                                ^
compilation terminated.
*** [/data/weather/.pioenvs/weather/src/main.cpp.o] Error 1
========================= [FAILED] Took 12.94 seconds =========================

Additional information

Custom /config/esphome/SI1145.h

#include "esphome.h"
#include "Adafruit_SI1145.h"

using namespace esphome;

class SI1145_sensor : public PollingComponent {
public:

Adafruit_SI1145 uv = Adafruit_SI1145();

sensor::Sensor *visible_sensor = new sensor::Sensor();
sensor::Sensor *ir_sensor = new sensor::Sensor();
sensor::Sensor *uvindex_sensor = new sensor::Sensor();

SI1145_sensor() : PollingComponent(1000) { }

float visible;
float irlight;
float uvindex;

void setup() override {
uv.reset();
uv.begin();
}

void update() override {
visible = uv.readVisible();
visible_sensor->publish_state(visible);

irlight = uv.readIR();
ir_sensor->publish_state(irlight);

uvindex = uv.readUV();
uvindex_sensor->publish_state(uvindex / 100.0);

}
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions