ESPHome Bluetooth Proxy - ESPHome - Adopt than Not Connection to Device

Hello together,

I have problem to add the Bluetooth Proxy to ESPHome

I’m using:
ESP32: https://www.amazon.de/dp/B07YKBY53C?ref_=pe_27091401_487187591_302_E_DDE_dt_1
Home Assistant: (2023.4.4, Supervisor 2023.04.0, Operating System 9.5, Frontend 20230411.1 - latest)
ESPHome: 2023.3.2

I do following steps:

  1. Flash ESP32 via ESPHome Bluetooth Proxy
  2. Adding ESP32 to Home Assistant
  3. ESPHome - Click on Adopt - Install

The point 3 ends with:

INFO Uploading /data/esp32-bluetooth-proxy-3d5b20/.pioenvs/esp32-bluetooth-proxy-3d5b20/firmware.bin (1286784 bytes)
Uploading: [============================================================] 100% Done...

INFO Waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from esp32-bluetooth-proxy-3d5b20.local using esphome API
WARNING Can't connect to ESPHome API for esp32-bluetooth-proxy-3d5b20.local: Timeout while connecting to ('192.168.188.77', 6053)
INFO Trying to reconnect to esp32-bluetooth-proxy-3d5b20.local in the background

Hi,

I had the same issue. I solved it by fetching the yaml configuration file from GitHub and creating a new device in ESPHome using that config.

The configuration, by default, adds the mac address to the host name and that caused problems with mdns discovery for me. So I changed the following to false

 name_add_mac_suffix: false

and it worked

esphome:
  name: ${name}
  friendly_name: ${friendly_name}
  name_add_mac_suffix: false
  project:
    name: esphome.bluetooth-proxy
    version: "1.0"

You just have to make sure every device have a unique name.

You could also try to switch to using Ping instead of mdns in ESPHome.

From ESPHome FAQ:

Alternatively, you can make esphome use ICMP pings to check the status of the device with the Home Assistant add-on “status_use_ping”: true, option

1 Like

Hy,

yes I conected the ESP32 via usb to Home assitant yellow and flashed it via ESP Home.

I got different errors:

[19:06:05][D][esp-idf:000]: I (2178) wifi:
[19:06:05][D][esp-idf:000]: Set ps t\x80 \xe0 \xf0\xc0\xfc`\x8aR
[19:06:05][D][esp-idf:000]: 
[19:06:05]
[19:06:05][D][wifi:386]: Starting scan...
[19:06:05]uru Meditation Error: Core  0 panic'ed (IllegalInstruction). Exception was unhandled.
[19:06:05]Memory dump at 0x400937b8: 290cb5c8 20c0228a 82022800
[19:06:05]Core  0 register dump:
[19:06:05]PC      : 0x400937be  PS      : 0x00060533  A0      : 0x800967ab  A1      : 0x3ffdfca0  
WARNING Decoded 0x400937be: xTaskGetSchedulerState at /data/cache/platformio/packages/framework-espidf/components/freertos/tasks.c:4690
[19:06:05]A2      : 0x3ffc3aa0  A3      : 0x3ffc0a10  A4      : 0x00000000  A5      : 0x401729e0  
[19:06:05]A6      : 0x00000000  A7      : 0x00000000  A8      : 0x00000000  A9      : 0x00000002  
[19:06:05]A10     : 0x00060520  A11     : 0x40174adc  A12     : 0x3ffc55b8  A13     : 0x00000000  
[19:06:05]A14     : 0x3ffe05e4  A15     : 0x80000001  SAR     : 0x0000001e  EXCCAUSE: 0x00000000  
[19:06:05]EXCVADDR: 0x00000000  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0xffffffff  
[19:06:05]
[19:06:05]
[19:06:05]Backtrace: 0x400937bb:0x3ffdfca0 0x400967a8:0x3ffdfcc0 0x401ae6e2:0x3ffdfce0 0x40096749:0x3ffdfd10 0x4016d2be:0x3ffdfd60 0x40186f67:0x3ffdfdd0 0x40174ae4:0x3ffdfdf0 0x40172a3c:0x3ffdfe10 0x400995e9:0x3ffdfe30
WARNING Found stack trace! Trying to decode it
WARNING Decoded 0x400937bb: xTaskGetSchedulerState at /data/cache/platformio/packages/framework-espidf/components/freertos/tasks.c:4696
WARNING Decoded 0x400967a8: esp_log_impl_lock_timeout at /data/cache/platformio/packages/framework-espidf/components/log/log_freertos.c:45
WARNING Decoded 0x401ae6e2: esp_log_writev at /data/cache/platformio/packages/framework-espidf/components/log/log.c:192
WARNING Decoded 0x40096749: esp_log_write at /data/cache/platformio/packages/framework-espidf/components/log/log.c:210
WARNING Decoded 0x4016d2be: wifi_log
WARNING Decoded 0x40186f67: pm_set_sleep_type
WARNING Decoded 0x40174ae4: wifi_set_ps_process
WARNING Decoded 0x40172a3c: ieee80211_ioctl_process
WARNING Decoded 0x400995e9: ppTask
[19:06:06]
[19:06:06]
[19:06:06]
[19:06:06]
[19:06:06]ELF file SHA256: 7926f2fefd091ceb
[19:06:06]

or

[19:06:07][D][esp-idf:000]: W (2175) wifi:
[19:06:07][D][esp-idf:000]: Error! Should use default active scan time parameter for WiFi scan when Bluetooth is enabled!!!!!!
[19:06:07]
[19:06:07][D][esp-idf:000]: 
[19:06:07]
[19:06:07][D][esp-idf:000]: I (2188) wifi:
[19:06:07][D][esp-idf:000]: Set ps type: 1
[19:06:07]
[19:06:07][D][esp-idf:000]: 
[19:06:07]
[19:06:07]\xd5\xc9ՁMeditation Error: Core  1 panic'ed (IllegalInstruction). Exception was unhandled.
[19:06:07]Memory dump at 0x40091ec8: 49008136 56027d41 b9d100e2
[19:06:07]Core  1 register dump:
[19:06:07]PC      : 0x40091ecf  PS      : 0x00060d30  A0      : 0x800e3f61  A1      : 0x3ffceea0  
WARNING Decoded 0x40091ecf: xQueueGenericSend at /data/cache/platformio/packages/framework-espidf/components/freertos/queue.c:820
[19:06:08]A2      : 0x3ffb7c4c  A3      : 0x00000000  A4      : 0x00000000  A5      : 0x00000000  
[19:06:08]A6      : 0x3ffbbef8  A7      : 0x3ffbbeac  A8      : 0x800946fd  A9      : 0x3ffcf290  
[19:06:08]A10     : 0x00000003  A11     : 0x00060d23  A12     : 0x00060d20  A13     : 0x00060d23  
[19:06:08]A14     : 0x00000003  A15     : 0x3ffb7c4c  SAR     : 0x0000000a  EXCCAUSE: 0x00000000  
[19:06:08]EXCVADDR: 0x00000000  LBEG    : 0x40083251  LEND    : 0x40083259  LCOUNT  : 0x00000027  
[19:06:08]
[19:06:08]
[19:06:08]Backtrace: 0x40091ecc:0x3ffceea0 0x400e3f5e:0x3ffcf2e0 0x400e4109:0x3ffcf300 0x400e459e:0x3ffcf320 0x400e4711:0x3ffcf350 0x400e3732:0x3ffcf3a0 0x400e5747:0x3ffcf3d0 0x400d9e87:0x3ffcf490
WARNING Found stack trace! Trying to decode it
WARNING Decoded 0x40091ecc: xQueueGenericSend at /data/cache/platformio/packages/framework-espidf/components/freertos/queue.c:815
WARNING Decoded 0x400e3f5e: esphome::Mutex::unlock() at /config/esphome/.esphome/build/esp32-bluetooth-proxy-3c7dd0/src/esphome/core/helpers.cpp:406
WARNING Decoded 0x400e4109: esphome::LockGuard::~LockGuard() at /config/esphome/.esphome/build/esp32-bluetooth-proxy-3c7dd0/src/esphome/core/helpers.h:551
WARNING Decoded 0x400e459e: esphome::Scheduler::process_to_add() at /config/esphome/.esphome/build/esp32-bluetooth-proxy-3c7dd0/src/esphome/core/scheduler.cpp:271
WARNING Decoded 0x400e4711: esphome::Scheduler::call() at /config/esphome/.esphome/build/esp32-bluetooth-proxy-3c7dd0/src/esphome/core/scheduler.cpp:148
WARNING Decoded 0x400e3732: esphome::Application::setup() at /config/esphome/.esphome/build/esp32-bluetooth-proxy-3c7dd0/src/esphome/core/application.cpp:49
WARNING Decoded 0x400e5747: setup() at /config/esphome/.esphome/build/esp32-bluetooth-proxy-3c7dd0/src/main.cpp:334
WARNING Decoded 0x400d9e87: esphome::loop_task(void*) at /config/esphome/.esphome/build/esp32-bluetooth-proxy-3c7dd0/src/esphome/components/esp32/core.cpp:72
[19:06:08]
[19:06:08]
[19:06:08]
[19:06:08]
[19:06:08]ELF file SHA256: 7926f2fefd091ceb

or

[19:06:09][D][wifi:386]: Starting scan...
[19:06:09][D][esp-idf:000]: W (2178) wifi:
[19:06:09][D][esp-idf:000]: Error! Should use default active scan time parameter for WiFi scan when Bluetooth is enabled!!!!!!
[19:06:09]
[19:06:09][D][esp-idf:000]: 
[19:06:09]
[19:06:09][D][esp-idf:000]: I (2191) wifi:
[19:06:09][D][esp-idf:000]: Set ps type: 1
[19:06:09]
[19:06:09][D][esp-idf:000]: 
[19:06:09]
[19:06:11]\xf0\x808\xe0u Meditation Error: Core  0 panic'ed (LLLL((LLLLaaaaooaaaaPPPPddPPPPoooorrooooiiiihhiiiiiiiibbiiiieeeetteeeeets Jul 29 2019 12:21:46
[19:06:11]
[19:06:11]rst:0x7 (TG0WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
[19:06:11]configsip: 0, SPIWP:0xee
[19:06:11]clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
[19:06:11]mode:DIO, clock div:2
[19:06:11]load:0x3fff0030,len:6660
[19:06:11]load:0x40078000,len:14944
[19:06:11]ho 0 tail 12 room 4
[19:06:11]load:0x40080400,len:3816
[19:06:11]entry 0x40080698
[19:06:11]I (58) boot: ESP-IDF 4.4.4 2nd stage bootloader

I used than the default configuration

substitutions:
  name: esp32-bluetooth-proxy-3c7dd0
  friendly_name: Bluetooth Proxy
packages:
  esphome.bluetooth-proxy: github://esphome/bluetooth-proxies/esp32-generic.yaml@main
esphome:
  name: ${name}
  name_add_mac_suffix: false
  friendly_name: ${friendly_name}
api:
  encryption:
    key: #######


wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

This lead to compiler error which I solved with “Clean Build Files”
Now the Bluetooth proxy was working and connected to ESPHome.

I added than the config

i2c:
  sda: 21
  scl: 22
  scan: true



# Example configuration entry YAML
sensor:
  - platform: bme280
    temperature:
      name: "Floor Temperature"
      oversampling: 16x
    pressure:
      name: "Floor Pressure"
    humidity:
      name: "Floor Humidity"
    address: 0x76
    update_interval: 40s

which lead to error:

Compiling /data/esp32-bluetooth-proxy-3c7dd0/.pioenvs/esp32-bluetooth-proxy-3c7dd0/src/main.o
Linking /data/esp32-bluetooth-proxy-3c7dd0/.pioenvs/esp32-bluetooth-proxy-3c7dd0/firmware.elf
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esp32-bluetooth-proxy-3c7dd0/.pioenvs/esp32-bluetooth-proxy-3c7dd0/src/esphome/components/api/api_connection.o:(.literal._ZN7esphome3api13APIConnection17send_sensor_stateEPNS_6sensor6SensorEf+0x8): undefined reference to `esphome::sensor::Sensor::has_state() const'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esp32-bluetooth-proxy-3c7dd0/.pioenvs/esp32-bluetooth-proxy-3c7dd0/src/esphome/components/api/api_connection.o:(.literal._ZN7esphome3api13APIConnection16send_sensor_infoEPNS_6sensor6SensorE+0x10): undefined reference to `esphome::sensor::Sensor::get_unit_of_measurement[abi:cxx11]()'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esp32-bluetooth-proxy-3c7dd0/.pioenvs/esp32-bluetooth-proxy-3c7dd0/src/esphome/components/api/api_connection.o:(.literal._ZN7esphome3api13APIConnection16send_sensor_infoEPNS_6sensor6SensorE+0x14): undefined reference to `esphome::sensor::Sensor::get_accuracy_decimals()'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esp32-bluetooth-proxy-3c7dd0/.pioenvs/esp32-bluetooth-proxy-3c7dd0/src/esphome/components/api/api_connection.o:(.literal._ZN7esphome3api13APIConnection16send_sensor_infoEPNS_6sensor6SensorE+0x18): undefined reference to `esphome::sensor::Sensor::get_device_class[abi:cxx11]()'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esp32-bluetooth-proxy-3c7dd0/.pioenvs/esp32-bluetooth-proxy-3c7dd0/src/esphome/components/api/api_connection.o:(.literal._ZN7esphome3api13APIConnection16send_sensor_infoEPNS_6sensor6SensorE+0x1c): undefined reference to `esphome::sensor::Sensor::get_state_class()'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esp32-bluetooth-proxy-3c7dd0/.pioenvs/esp32-bluetooth-proxy-3c7dd0/src/esphome/components/api/api_connection.o: in function `esphome::api::APIConnection::send_sensor_state(esphome::sensor::Sensor*, float)':
/config/esphome/.esphome/build/esp32-bluetooth-proxy-3c7dd0/src/esphome/components/api/api_connection.cpp:414: undefined reference to `esphome::sensor::Sensor::has_state() const'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esp32-bluetooth-proxy-3c7dd0/.pioenvs/esp32-bluetooth-proxy-3c7dd0/src/esphome/components/api/api_connection.o: in function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::assign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/data/cache/platformio/packages/[email protected]+2021r2-patch5/xtensa-esp32-elf/include/c++/8.4.0/bits/basic_string.h:1366: undefined reference to `esphome::sensor::Sensor::get_unit_of_measurement[abi:cxx11]()'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esp32-bluetooth-proxy-3c7dd0/.pioenvs/esp32-bluetooth-proxy-3c7dd0/src/esphome/components/api/api_connection.o: in function `esphome::api::APIConnection::send_sensor_info(esphome::sensor::Sensor*)':
/config/esphome/.esphome/build/esp32-bluetooth-proxy-3c7dd0/src/esphome/components/api/api_connection.cpp:426: undefined reference to `esphome::sensor::Sensor::get_accuracy_decimals()'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /config/esphome/.esphome/build/esp32-bluetooth-proxy-3c7dd0/src/esphome/components/api/api_connection.cpp:427: undefined reference to `esphome::sensor::Sensor::get_device_class[abi:cxx11]()'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /config/esphome/.esphome/build/esp32-bluetooth-proxy-3c7dd0/src/esphome/components/api/api_connection.cpp:429: undefined reference to `esphome::sensor::Sensor::get_state_class()'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esp32-bluetooth-proxy-3c7dd0/.pioenvs/esp32-bluetooth-proxy-3c7dd0/src/main.o:(.literal._Z5setupv+0x54): undefined reference to `vtable for esphome::i2c::IDFI2CBus'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esp32-bluetooth-proxy-3c7dd0/.pioenvs/esp32-bluetooth-proxy-3c7dd0/src/main.o:(.literal._Z5setupv+0x58): undefined reference to `vtable for esphome::i2c::IDFI2CBus'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esp32-bluetooth-proxy-3c7dd0/.pioenvs/esp32-bluetooth-proxy-3c7dd0/src/main.o:(.literal._Z5setupv+0xd0): undefined reference to `vtable for esphome::bme280::BME280Component'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esp32-bluetooth-proxy-3c7dd0/.pioenvs/esp32-bluetooth-proxy-3c7dd0/src/main.o:(.literal._Z5setupv+0x144): undefined reference to `esphome::sensor::Sensor::Sensor()'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esp32-bluetooth-proxy-3c7dd0/.pioenvs/esp32-bluetooth-proxy-3c7dd0/src/main.o:(.literal._Z5setupv+0x148): undefined reference to `esphome::sensor::Sensor::set_device_class(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esp32-bluetooth-proxy-3c7dd0/.pioenvs/esp32-bluetooth-proxy-3c7dd0/src/main.o:(.literal._Z5setupv+0x14c): undefined reference to `esphome::sensor::Sensor::set_state_class(esphome::sensor::StateClass)'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esp32-bluetooth-proxy-3c7dd0/.pioenvs/esp32-bluetooth-proxy-3c7dd0/src/main.o:(.literal._Z5setupv+0x150): undefined reference to `esphome::sensor::Sensor::set_unit_of_measurement(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esp32-bluetooth-proxy-3c7dd0/.pioenvs/esp32-bluetooth-proxy-3c7dd0/src/main.o:(.literal._Z5setupv+0x154): undefined reference to `esphome::sensor::Sensor::set_accuracy_decimals(signed char)'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esp32-bluetooth-proxy-3c7dd0/.pioenvs/esp32-bluetooth-proxy-3c7dd0/src/main.o:(.literal._Z5setupv+0x158): undefined reference to `esphome::bme280::BME280Component::set_temperature_oversampling(esphome::bme280::BME280Oversampling)'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esp32-bluetooth-proxy-3c7dd0/.pioenvs/esp32-bluetooth-proxy-3c7dd0/src/main.o:(.literal._Z5setupv+0x15c): undefined reference to `esphome::bme280::BME280Component::set_pressure_oversampling(esphome::bme280::BME280Oversampling)'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esp32-bluetooth-proxy-3c7dd0/.pioenvs/esp32-bluetooth-proxy-3c7dd0/src/main.o:(.literal._Z5setupv+0x160): undefined reference to `esphome::bme280::BME280Component::set_humidity_oversampling(esphome::bme280::BME280Oversampling)'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esp32-bluetooth-proxy-3c7dd0/.pioenvs/esp32-bluetooth-proxy-3c7dd0/src/main.o:(.literal._Z5setupv+0x164): undefined reference to `esphome::bme280::BME280Component::set_iir_filter(esphome::bme280::BME280IIRFilter)'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esp32-bluetooth-proxy-3c7dd0/.pioenvs/esp32-bluetooth-proxy-3c7dd0/src/main.o: in function `setup()':
/config/esphome/.esphome/build/esp32-bluetooth-proxy-3c7dd0/src/main.cpp:238: undefined reference to `esphome::sensor::Sensor::Sensor()'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /config/esphome/.esphome/build/esp32-bluetooth-proxy-3c7dd0/src/main.cpp:279: undefined reference to `esphome::sensor::Sensor::set_device_class(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /config/esphome/.esphome/build/esp32-bluetooth-proxy-3c7dd0/src/main.cpp:279: undefined reference to `esphome::sensor::Sensor::set_state_class(esphome::sensor::StateClass)'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /config/esphome/.esphome/build/esp32-bluetooth-proxy-3c7dd0/src/main.cpp:280: undefined reference to `esphome::sensor::Sensor::set_unit_of_measurement(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esp32-bluetooth-proxy-3c7dd0/.pioenvs/esp32-bluetooth-proxy-3c7dd0/src/main.o: in function `esphome::bme280::BME280Component::BME280Component()':
/config/esphome/.esphome/build/esp32-bluetooth-proxy-3c7dd0/src/esphome/components/bme280/bme280.h:61: undefined reference to `esphome::sensor::Sensor::set_accuracy_decimals(signed char)'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esp32-bluetooth-proxy-3c7dd0/.pioenvs/esp32-bluetooth-proxy-3c7dd0/src/main.o: in function `setup()':
/config/esphome/.esphome/build/esp32-bluetooth-proxy-3c7dd0/src/main.cpp:280: undefined reference to `esphome::bme280::BME280Component::set_temperature_oversampling(esphome::bme280::BME280Oversampling)'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esp32-bluetooth-proxy-3c7dd0/.pioenvs/esp32-bluetooth-proxy-3c7dd0/src/main.o: in function `esphome::bme280::BME280Component* esphome::Application::register_component<esphome::bme280::BME280Component>(esphome::bme280::BME280Component*)':
/config/esphome/.esphome/build/esp32-bluetooth-proxy-3c7dd0/src/esphome/core/application.h:132: undefined reference to `esphome::sensor::Sensor::Sensor()'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esp32-bluetooth-proxy-3c7dd0/.pioenvs/esp32-bluetooth-proxy-3c7dd0/src/main.o: in function `setup()':
/config/esphome/.esphome/build/esp32-bluetooth-proxy-3c7dd0/src/main.cpp:287: undefined reference to `esphome::sensor::Sensor::set_device_class(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /config/esphome/.esphome/build/esp32-bluetooth-proxy-3c7dd0/src/main.cpp:288: undefined reference to `esphome::sensor::Sensor::set_state_class(esphome::sensor::StateClass)'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /config/esphome/.esphome/build/esp32-bluetooth-proxy-3c7dd0/src/main.cpp:289: undefined reference to `esphome::sensor::Sensor::set_unit_of_measurement(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /config/esphome/.esphome/build/esp32-bluetooth-proxy-3c7dd0/src/main.cpp:290: undefined reference to `esphome::sensor::Sensor::set_accuracy_decimals(signed char)'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /config/esphome/.esphome/build/esp32-bluetooth-proxy-3c7dd0/src/main.cpp:291: undefined reference to `esphome::bme280::BME280Component::set_pressure_oversampling(esphome::bme280::BME280Oversampling)'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esp32-bluetooth-proxy-3c7dd0/.pioenvs/esp32-bluetooth-proxy-3c7dd0/src/main.o: in function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()':
/data/cache/platformio/packages/[email protected]+2021r2-patch5/xtensa-esp32-elf/include/c++/8.4.0/bits/basic_string.h:657: undefined reference to `esphome::sensor::Sensor::Sensor()'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esp32-bluetooth-proxy-3c7dd0/.pioenvs/esp32-bluetooth-proxy-3c7dd0/src/main.o: in function `setup()':
/config/esphome/.esphome/build/esp32-bluetooth-proxy-3c7dd0/src/main.cpp:298: undefined reference to `esphome::sensor::Sensor::set_device_class(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /config/esphome/.esphome/build/esp32-bluetooth-proxy-3c7dd0/src/main.cpp:298: undefined reference to `esphome::sensor::Sensor::set_state_class(esphome::sensor::StateClass)'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /config/esphome/.esphome/build/esp32-bluetooth-proxy-3c7dd0/src/main.cpp:299: undefined reference to `esphome::sensor::Sensor::set_unit_of_measurement(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /config/esphome/.esphome/build/esp32-bluetooth-proxy-3c7dd0/src/main.cpp:300: undefined reference to `esphome::sensor::Sensor::set_accuracy_decimals(signed char)'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esp32-bluetooth-proxy-3c7dd0/.pioenvs/esp32-bluetooth-proxy-3c7dd0/src/main.o: in function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()':
/data/cache/platformio/packages/[email protected]+2021r2-patch5/xtensa-esp32-elf/include/c++/8.4.0/bits/basic_string.h:657: undefined reference to `esphome::bme280::BME280Component::set_humidity_oversampling(esphome::bme280::BME280Oversampling)'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esp32-bluetooth-proxy-3c7dd0/.pioenvs/esp32-bluetooth-proxy-3c7dd0/src/main.o: in function `setup()':
/config/esphome/.esphome/build/esp32-bluetooth-proxy-3c7dd0/src/main.cpp:301: undefined reference to `esphome::bme280::BME280Component::set_iir_filter(esphome::bme280::BME280IIRFilter)'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esp32-bluetooth-proxy-3c7dd0/.pioenvs/esp32-bluetooth-proxy-3c7dd0/src/esphome/core/controller.o:(.literal._ZN7esphome10Controller16setup_controllerEb+0x8): undefined reference to `esphome::sensor::Sensor::add_on_state_callback(std::function<void (float)>&&)'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esp32-bluetooth-proxy-3c7dd0/.pioenvs/esp32-bluetooth-proxy-3c7dd0/src/esphome/core/controller.o: in function `esphome::Controller::setup_controller(bool)':
/config/esphome/.esphome/build/esp32-bluetooth-proxy-3c7dd0/src/esphome/core/controller.cpp:29: undefined reference to `esphome::sensor::Sensor::add_on_state_callback(std::function<void (float)>&&)'
collect2: error: ld returned 1 exit status
*** [/data/esp32-bluetooth-proxy-3c7dd0/.pioenvs/esp32-bluetooth-proxy-3c7dd0/firmware.elf] Error 1

Solved this with “Clean Build Files”

Not realy sure what was the problem. It is working now.