BMP280 on Raspberry Pi after GPIO deprecation

I have a BMP280 temp+pressure sensor wired up directly to the RPi that I have HASS installed on. Previously, I was able to get the sensor values in Home Assistant via the official integration, but I recently updated the home assistant version, and found that this integration had been deprecated. The main GPIO integration seems to have been picked up by a member of the community and seems to now available as a custom integration.

I was wondering whether this has been done for the BMP280 integration as well? If not, how would I go about moving the integration code from the older version of HASS to a custom integration?

Bump

Any advice would be appreciated.

Bump. Any advice, or even any pointers would be appreciated.

I figured out the method for taking the deprecated integration and running it by placing the files in config/custom_components. I took the files for the bmp280 integration from a previous version of Home Assistant. The manifest.json looks like this:

{
  "domain": "bmp280",
  "name": "Bosch BMP280 Environmental Sensor",
  "documentation": "https://www.home-assistant.io/integrations/bmp280",
  "codeowners": ["@belidzs"],
  "requirements": ["adafruit-circuitpython-bmp280==3.1.1", "RPi.GPIO==0.7.1a4"],
  "quality_scale": "silver",
  "iot_class": "local_polling",
  "version": "1.0.0"
}

The issue I’m having is that the RPi.GPIO installation is failing, seemingly because gcc can’t be found?

2023-07-25 21:49:09.373 ERROR (SyncWorker_2) [homeassistant.util.package] Unable to install package RPi.GPIO==0.7.1a4: error: subprocess-exited-with-error
Ă— python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [15 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-311
creating build/lib.linux-x86_64-cpython-311/RPi
copying RPi/__init__.py -> build/lib.linux-x86_64-cpython-311/RPi
creating build/lib.linux-x86_64-cpython-311/RPi/GPIO
copying RPi/GPIO/__init__.py -> build/lib.linux-x86_64-cpython-311/RPi/GPIO
running build_ext
building 'RPi._GPIO' extension
creating build/temp.linux-x86_64-cpython-311
creating build/temp.linux-x86_64-cpython-311/source
gcc -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fno-semantic-interposition -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/local/include/python3.11 -c source/c_gpio.c -o build/temp.linux-x86_64-cpython-311/source/c_gpio.o
error: command 'gcc' failed: No such file or directory
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for RPi.GPIO
ERROR: Could not build wheels for RPi.GPIO, which is required to install pyproject.toml-based projects

I also tried RPi.GPIO==0.7.1, same error.

Any ideas why gcc can’t be found during the installation process?

Finally got it working :slight_smile:

Here’s the full procedure for anyone stumbling across this in the future. Could probably also get the BME280 working by tweaking these instructions a bit.

  1. Go to this previous commit on the Home Assistant Core Github repo, and download this component’s folder
  2. Edit the manifest.json file, and add "version": "1.0.0" to the JSON file.
  3. Copy the bmp280 folder to config/custom_components of your HASS install
  4. This integration seems to need additional packages when building, which we will install now. Go to the terminal (install Home Assistant Community Add-on: Advanced SSH & Web Terminal if you haven’t already), and enter the command docker exec -it homeassistant bash
  5. Now inside the Home Assistant container shell, enter apk add build-base
  6. Next, I2C needs to be enabled on the Raspberry Pi. Use your favourite method, here are the official instructions (there also seems to be an add-on that achieves this, but I haven’t personally used it). DON’T FORGET TO REBOOT HOST TWICE AFTER COMPLETING THIS STEP
  7. Everything should (:crossed_fingers:) be working at this point, so just follow the integration documentation here (web archive link since this documentation isn’t available anymore) to set up the integration. Any errors will pop up at this point, when you go to verify your configuration.

Some caveats:

  • This integration may break if you update your Home Assistant, and you may need to run apk add build-base inside the HASS container to fix this
  • Future updates might potentially break the install in some other way
1 Like