ESP32 with BH1750

Hello,

So I have 3 ESP32 BT Proxies configured and working.

Have added a virgin ESP32 with BH1750 following the guides and it seemed to go ok until I try and Install, appreciated any advice?

Config

esphome:
  name: esphome-web-a8dd58
  friendly_name: ESPHome Web a8dd58
  min_version: 2025.9.0
  name_add_mac_suffix: false

esp32:
  variant: ESP32
  framework:
    type: esp-idf

# Enable logging
logger:

# Enable Home Assistant API
api:

# Allow Over-The-Air updates
ota:
- platform: esphome

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

i2c:
  sda: GPIO21
  scl: GPIO22
  scan: true
  id: bus_a  

sensor:
  - platform: bh1750
    name: "BH1750 Illuminance"
    address: 0x23
    update_interval: 60s

Install Log

INFO ESPHome 2025.9.3
INFO Reading configuration /config/esphome/esphome-web-a8dd58.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing esphome-web-a8dd58 (board: esp32dev; framework: espidf; platform: https://github.com/pioarduino/platform-espressif32/releases/download/54.03.21-2/platform-espressif32.zip)
--------------------------------------------------------------------------------
INFO Package configuration completed successfully
INFO Package configuration completed successfully
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
 - framework-espidf @ 3.50402.0 (5.4.2) 
 - tool-cmake @ 3.30.2 
 - tool-esp-rom-elfs @ 2024.10.11 
 - tool-esptoolpy @ 5.0.2 
 - tool-mklittlefs @ 3.2.0 
 - tool-ninja @ 1.13.1 
 - tool-scons @ 4.40801.0 (4.8.1) 
 - toolchain-xtensa-esp-elf @ 14.2.0+20241119
Reading CMake configuration...
-- git rev-parse returned 'fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).'
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- The ASM compiler identification is unknown
-- Found assembler: xtensa-esp32-elf-gcc
-- Warning: Did not find file Compiler/-ASM
-- Configuring incomplete, errors occurred!

fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
CMake Error at /data/cache/platformio/packages/framework-espidf/tools/cmake/project.cmake:571 (__project):
  The CMAKE_C_COMPILER:

    xtensa-esp32-elf-gcc

  is not a full path and was not found in the PATH.

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)


CMake Error at /data/cache/platformio/packages/framework-espidf/tools/cmake/project.cmake:571 (__project):
  The CMAKE_CXX_COMPILER:

    xtensa-esp32-elf-g++

  is not a full path and was not found in the PATH.

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)


CMake Error at /data/cache/platformio/packages/framework-espidf/tools/cmake/project.cmake:571 (__project):
  The CMAKE_ASM_COMPILER:

    xtensa-esp32-elf-gcc

  is not a full path and was not found in the PATH.

  Tell CMake where to find the compiler by setting either the environment
  variable "ASM" or the CMake cache entry CMAKE_ASM_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)



========================== [FAILED] Took 5.25 seconds ==========================
 - platform: bh1750
    i2c_id: bus_a
    name: "sensor-bh1750-2-lux"
    address: 0x23
    update_interval: 60s    

Missing i2c_id?

thanks , have added that but same error output on install

I have just updated my ESP32 with bh1750 on the latest ESPHome release 2025.9.3 without problems.
Did you already “clean build files” from the menu?

Remove i2c_id: bus_a in sensor. Use only id: xxx (not necessary) and change

esp32:
  board: esp32dev
  framework:
    type: arduino

See BLE tracker compile error - #2 by tom_l

This is only an (easily fixed) issue if using the esp-idf framework.

This is what works for me. I’m using esp-idf

i2c:
  sda: ${i2c_a_sda}
  scl: ${i2c_a_slc}
  scan: true
  id: bus_a

sensor:
  - platform: bh1750
    name: "Illuminance"
    address: 0x23
    update_interval: 10s
    i2c_id: bus_a

Yes, not everyone is getting this error.

If you do then the solution is in my post above.

thanks for all the help.

I have reinstalled ESPHome and this has resolved the fatal errors I had.

But now have a more basic problem, I can’t install anything, even the initial basic config on a virgin board, sits there after unpacking, have left it hours.

any ideas?

Install

INFO ESPHome 2025.9.3
INFO Reading configuration /config/esphome/light-sensor--living-room--01.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing light-sensor--living-room--01 (board: esp32dev; framework: espidf; platform: https://github.com/pioarduino/platform-espressif32/releases/download/54.03.21-2/platform-espressif32.zip)
--------------------------------------------------------------------------------
INFO Package configuration completed successfully
Tool Manager: Installing https://github.com/pioarduino/esp-idf/releases/download/v5.4.2/esp-idf-v5.4.2.zip
INFO Installing https://github.com/pioarduino/esp-idf/releases/download/v5.4.2/esp-idf-v5.4.2.zip
Downloading  [####################################]  100%          
Unpacking  [####################################]  100%          

Could your disk/partition be full?