Errors in build when building yaml

Hi, quasi-nubie here (read: I don’t know what I don’t know),

I have a dht20-aht20 temperature sensor and trying to build the yaml file but I’m getting errors on the build. I know it’s got to be just ignorance on my part but I need a bit of help.

The “dht20-aht20-001.yaml”

esphome:
  name: dht20-aht20-001
  includes:
  - ahtx0.h
  libraries:
  - "https://github.com/adafruit/Adafruit_AHTX0/"
  - "Wire"
  
esp8266:
  board: esp01_1m
  
sensor:
  - platform: custom
    lambda: |-
      auto aht20 = new AHTX0Sensor();
      App.register_component(aht20);
      return {aht20->temperature_sensor, aht20->humidity_sensor};
    sensors:
    - name: "Temperature"
      unit_of_measurement: °F
      accuracy_decimals: 2
    - name: "Humidity"
      unit_of_measurement: "%"
      accuracy_decimals: 2

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "OTA-PASSWORD-HIDDEN"

wifi:
  ssid: "SSID-HIDDEN"
  password: "PWD-HIDDEN"
  manual_ip:
    static_ip: 192.168.3.221
    gateway: 192.168.3.1
    subnet: 255.255.255.0
    dns1: 192.168.3.1
    dns2: 192.168.3.1

captive_portal:

The “ahtx0.h” include file:

#include "esphome.h"
#include "Wire.h"
#include "Adafruit_AHTX0.h"

#define TAG "ahtx0"

class AHTX0Sensor : public PollingComponent {

  public:
    Adafruit_AHTX0 aht;
    Sensor *temperature_sensor = new Sensor();
    Sensor *humidity_sensor = new Sensor();

    AHTX0Sensor() : PollingComponent(15000) { }

    void setup() override {
      ESP_LOGCONFIG(TAG, "Setting up AHTX0Sensor...");
      if (!aht.begin()) {
        ESP_LOGCONFIG(TAG, "Failed to start AHTX0Sensor...");
      }
      LOG_SENSOR("  ", "Temperature", this->temperature_sensor);
      LOG_SENSOR("  ", "Humidity", this->humidity_sensor);
    }

    void update() override {
      sensors_event_t humidity, temp;
      aht.getEvent(&humidity, &temp);
      temperature_sensor->publish_state(temp.temperature);
      humidity_sensor->publish_state(humidity.relative_humidity);
    }
};

The build log:

ESPHome Log
INFO Reading configuration /config/esphome/dht20-aht20-001.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing dht20-aht20-001 (board: esp01_1m; framework: arduino; platform: platformio/espressif8266 @ 3.2.0)
--------------------------------------------------------------------------------
HARDWARE: ESP8266 80MHz, 80KB RAM, 1MB Flash
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
Dependency Graph
|-- <ESPAsyncTCP-esphome> 1.2.3
|-- <Adafruit AHTX0> 2.0.1+sha.2d96149
|-- <Wire> 1.0
|-- <ESPAsyncWebServer-esphome> 2.1.0
|   |-- <ESPAsyncTCP-esphome> 1.2.3
|   |-- <Hash> 1.0
|   |-- <ESP8266WiFi> 1.0
|-- <DNSServer> 1.1.1
|-- <ESP8266WiFi> 1.0
|-- <ESP8266mDNS> 1.2
Compiling /data/dht20-aht20-001/.pioenvs/dht20-aht20-001/src/main.cpp.o
Generating LD script /data/dht20-aht20-001/.pioenvs/dht20-aht20-001/ld/local.eagle.app.v6.common.ld
Compiling /data/dht20-aht20-001/.pioenvs/dht20-aht20-001/lib975/ESPAsyncTCP-esphome/AsyncPrinter.cpp.o
Compiling /data/dht20-aht20-001/.pioenvs/dht20-aht20-001/lib975/ESPAsyncTCP-esphome/ESPAsyncTCP.cpp.o
Compiling /data/dht20-aht20-001/.pioenvs/dht20-aht20-001/lib975/ESPAsyncTCP-esphome/ESPAsyncTCPbuffer.cpp.o
In file included from src/ahtx0.h:3,
                 from src/main.cpp:27:
/data/dht20-aht20-001/.piolibdeps/dht20-aht20-001/Adafruit AHTX0/Adafruit_AHTX0.h:22:10: fatal error: Adafruit_BusIO_Register.h: No such file or directory

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

   22 | #include <Adafruit_BusIO_Register.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
*** [/data/dht20-aht20-001/.pioenvs/dht20-aht20-001/src/main.cpp.o] Error 1
========================== [FAILED] Took 4.37 seconds ==========================

I assume that if you are a newbie, you got this config somewhere. Where?

You’ll see that https://github.com/adafruit/Adafruit_AHTX0 * Adafruit_BusIO is a dependency. So perhaps download that too.

That’s part of my confusion. I thought the library is referenced using " libraries:

Compiling /data/dht20-aht20-001/.pioenvs/dht20-aht20-001/src/main.cpp.o
Generating LD script /data/dht20-aht20-001/.pioenvs/dht20-aht20-001/ld/local.eagle.app.v6.common.ld
Compiling /data/dht20-aht20-001/.pioenvs/dht20-aht20-001/lib975/ESPAsyncTCP-esphome/AsyncPrinter.cpp.o
Compiling /data/dht20-aht20-001/.pioenvs/dht20-aht20-001/lib975/ESPAsyncTCP-esphome/ESPAsyncTCP.cpp.o
Compiling /data/dht20-aht20-001/.pioenvs/dht20-aht20-001/lib975/ESPAsyncTCP-esphome/ESPAsyncTCPbuffer.cpp.o
In file included from src/ahtx0.h:3,
                 from src/main.cpp:27:
/data/dht20-aht20-001/.piolibdeps/dht20-aht20-001/Adafruit AHTX0/Adafruit_AHTX0.h:22:10: fatal error: Adafruit_BusIO_Register.h: No such file or directory

Why does it find some and not the other?