My Home Assistant System—
Raspberry Pi 4 - 4GB
Home Assistant 2022.10.4
Supervisor 2022.10.0
Operating System 9.0
Frontend 20221010.0 - latest
My Project—
Climate controller’s for my 2 heat pumps. Both are Trane, air-air with electric resistance aux heat. After much research, the ESPHome Thermostat Climate Controller seemed to be the best fit for my goals.
My full error message—
bmp280::BMP280Component doesn’t inherit from sensor::Sensor
My project had been working for a few days with no real problems. Although I would be making some modifications to the code for my personal situation, but only after I tested the basics thoroughly. I was using one of my existing Govee H5075 Hygrometers from Home Assistant for temperature readings. Being a battery powered, bluetooth device, the polling updates were not as often as I would like. I then decided to use a local hardwired sensor for faster response and so the controller would still function, should I lose connectivity to Home Assistant.
This is the working code that I tested for several days with the Govee sensor:
esphome:
name: hvac-upstairs
esp8266:
board: esp12e
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "removed"
ota:
password: "removed"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Hvac-Upstairs Fallback Hotspot"
password: "removed"
captive_portal:
sensor:
- platform: homeassistant
id: upstairs_temp
name: "Upstairs_Temp_Sensor"
entity_id: sensor.upstairs_hvac_temperature
filters:
- lambda: return (x - 32.0) * 5.0 / 9.0; # Convert F coming from sensor to C
# Use the blue LED in the device as a status LED, which will blink if there are warnings (slow) or errors (fast)
status_led:
pin:
number: GPIO5
inverted: True
# Four relay outputs, exposed as switches in Home Assistant so I can see their status
switch:
- platform: gpio
pin: GPIO16
name: R-Valve # Relay 1
id: r_valve
- platform: gpio
pin: GPIO14
name: Compressor # Relay 2
id: compressor
- platform: gpio
pin: GPIO12
name: Aux-Heat # Relay 3
id: aux_heat
- platform: gpio
pin: GPIO13
name: Fan # Relay 4
id: fan
climate:
- platform: thermostat
name: "Upstairs Thermostat"
default_target_temperature_low: 13.35 C # 56 F
default_target_temperature_high: 26.67 C # 80 F
visual:
min_temperature: 10 C # 50 F
max_temperature: 30 C # 86 F
temperature_step: 0.5 # 0.5 F steps shown in HA thermostat card
min_cooling_off_time: 300s
min_cooling_run_time: 300s
min_heating_off_time: 300s
min_heating_run_time: 300s
max_heating_run_time: 60s
supplemental_heating_delta: 1.7 # 3.0 F
min_idle_time: 30s
min_fanning_off_time: 10s
min_fanning_run_time: 10s
fan_with_cooling: True
fan_with_heating: True
sensor: upstairs_temp
cool_action:
- switch.turn_on: r_valve
- switch.turn_on: compressor
heat_action:
- switch.turn_on: compressor
supplemental_heating_action:
- switch.turn_on: aux_heat
idle_action:
- switch.turn_off: r_valve
- switch.turn_off: compressor
- switch.turn_off: aux_heat
# - delay: 30s
- switch.turn_off: fan
fan_only_action:
- switch.turn_on: fan
I had a few BMP280’s on hand so I tested one of those for a few hours using this code. I removed the existing sensor code, the climate component and added the BMP280 code:
captive_portal:
i2c:
sda: GPIO4
scl: GPIO2
scan: False
sensor:
- platform: bmp280
temperature:
name: "Upstairs_Temp_Sensor"
oversampling: 16x
id: upstairs_temp
address: 0x76
update_interval: 30s
# Use the blue LED in the device as a status LED, which will blink if there are warnings (slow) or errors (fast)
status_led:
pin:
number: GPIO5
inverted: True
# Four relay outputs, exposed as switches in Home Assistant so I can see their status
switch:
- platform: gpio
pin: GPIO16
name: R-Valve # Relay 1
id: r_valve
- platform: gpio
pin: GPIO14
name: Compressor # Relay 2
id: compressor
- platform: gpio
pin: GPIO12
name: Aux-Heat # Relay 3
id: aux_heat
- platform: gpio
pin: GPIO13
name: Fan # Relay 4
id: fan
After testing this for a few hours, I added back the climate component and that is when I got the error message. Both in the ESPHome code editor and in the complier logs.
I substituted both BME280 and BME680 sensors but continued to receive the same error. I then tried using a Dallas sensor and did not receive an error with that code. I don’t have a Dallas sensor on hand to test and I had planned to use a BME280 in my final product. Here is the Dallas code that I used, without error:
dallas:
- pin: GPIO2
sensor:
- platform: dallas
address: 0xE8011438D052AA28
id: upstairs_temp
This is the full code with the BMP280 sensor that resulted in the error code:
esphome:
name: hvac-upstairs
esp8266:
board: esp12e
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "removed"
ota:
password: "removed"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Hvac-Upstairs Fallback Hotspot"
password: "removed"
captive_portal:
i2c:
sda: GPIO4
scl: GPIO2
scan: False
sensor:
- platform: bmp280
temperature:
name: "Upstairs_Temp_Sensor"
oversampling: 16x
id: upstairs_temp
address: 0x76
update_interval: 30s
# Use the blue LED in the device as a status LED, which will blink if there are warnings (slow) or errors (fast)
status_led:
pin:
number: GPIO5
inverted: True
# Four relay outputs, exposed as switches in Home Assistant so I can see their status
switch:
- platform: gpio
pin: GPIO16
name: R-Valve # Relay 1
id: r_valve
- platform: gpio
pin: GPIO14
name: Compressor # Relay 2
id: compressor
- platform: gpio
pin: GPIO12
name: Aux-Heat # Relay 3
id: aux_heat
- platform: gpio
pin: GPIO13
name: Fan # Relay 4
id: fan
climate:
- platform: thermostat
name: "Upstairs Thermostat"
default_target_temperature_low: 13.35 C # 56 F
default_target_temperature_high: 26.67 C # 80 F
visual:
min_temperature: 10 C # 50 F
max_temperature: 30 C # 86 F
temperature_step: 0.5 # 0.5 F steps shown in HA thermostat card
min_cooling_off_time: 300s
min_cooling_run_time: 300s
min_heating_off_time: 300s
min_heating_run_time: 300s
max_heating_run_time: 60s
supplemental_heating_delta: 1.7 # 3.0 F
min_idle_time: 30s
min_fanning_off_time: 10s
min_fanning_run_time: 10s
fan_with_cooling: True
fan_with_heating: True
sensor: upstairs_temp
cool_action:
- switch.turn_on: r_valve
- switch.turn_on: compressor
heat_action:
- switch.turn_on: compressor
supplemental_heating_action:
- switch.turn_on: aux_heat
idle_action:
- switch.turn_off: r_valve
- switch.turn_off: compressor
- switch.turn_off: aux_heat
- switch.turn_off: fan
fan_only_action:
- switch.turn_on: fan
I have done quite a bit of researching, and if I did find a solution, I certainly didn’t recognize it…
Best regards to all…