Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for using BMP280 with SPI #7053

Merged
merged 5 commits into from
Sep 5, 2024
Merged

Conversation

ademuri
Copy link
Contributor

@ademuri ademuri commented Jul 7, 2024

This adds support for using BMP280 with SPI, similar to #5538.

What does this implement/fix?

This adds a bmp280_spi component, and moves the existing bmp280 component to bmp280_i2c.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Other

Related issue or feature (if applicable): fixes esphome/feature-requests#1321.

Pull request in esphome-docs with documentation (if applicable): esphome/esphome-docs#4064

Test Environment

  • ESP32
  • ESP32 IDF
  • ESP8266
  • RP2040
  • BK72xx
  • RTL87xx

Example entry for config.yaml:

# Example config.yaml
sensor:
  - platform: bmp280_spi
    temperature:
      name: "Board Temperature"
      oversampling: 16x
    pressure:
      name: "Board Pressure"
      oversampling: 16x
    update_interval: 5s
    cs_pin: GPIO16

spi:
  clk_pin: GPIO13
  mosi_pin: GPIO15
  miso_pin: GPIO14
  interface: hardware

Checklist:

  • The code change is tested and works locally.
  • Tests have been added to verify that the new code works (under tests/ folder).

If user exposed functionality or configuration variables are added/changed:

@probot-esphome
Copy link

probot-esphome bot commented Jul 7, 2024

Hey there @ademuri,
Thanks for submitting this pull request! Can you add yourself as a codeowner for this integration? This way we can notify you if a bug report for this integration is reported.
In __init__.py of the integration, please add:

CODEOWNERS = ["@ademuri"]

And run script/build_codeowners.py

(message by NeedsCodeownersLabel)

@codecov-commenter
Copy link

codecov-commenter commented Jul 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 53.93%. Comparing base (4d8b5ed) to head (c047044).
Report is 1275 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #7053      +/-   ##
==========================================
+ Coverage   53.70%   53.93%   +0.22%     
==========================================
  Files          50       50              
  Lines        9408     9678     +270     
  Branches     1654     1708      +54     
==========================================
+ Hits         5053     5220     +167     
- Misses       4056     4134      +78     
- Partials      299      324      +25     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ademuri ademuri force-pushed the bmp280-spi branch 2 times, most recently from 51ade8f to 4f1f14c Compare July 18, 2024 03:09
@ademuri ademuri force-pushed the bmp280-spi branch 2 times, most recently from 9dec67e to 1399526 Compare July 18, 2024 04:02
@ademuri ademuri changed the title Rename bmp280 to bmp280_i2c. Add support for using BMP280 with SPI Jul 18, 2024
@ademuri ademuri marked this pull request as ready for review July 18, 2024 04:44
Copy link
Member

@jesserockz jesserockz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please leave a minimal file in place at bmp280/__init__.py and bmp280/sensor.py similar to bmp3xx

esphome/components/bmp280_base/__init__.py Outdated Show resolved Hide resolved
@ademuri
Copy link
Contributor Author

ademuri commented Aug 23, 2024

Apologies for the spam, I accidentally rebased against the wrong dev branch. I did in fact apply all of the requested changes, but Github is showing one of them as outstanding.

kbx81
kbx81 previously requested changes Aug 25, 2024
Copy link
Member

@kbx81 kbx81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple other quick remarks

esphome/components/bmp280_base/__init__.py Outdated Show resolved Hide resolved
tests/components/bmp280_i2c/common.yaml Show resolved Hide resolved
@esphome esphome bot marked this pull request as draft August 25, 2024 06:50
@kbx81 kbx81 added this to the 2024.9.0b1 milestone Aug 28, 2024
@kbx81 kbx81 self-assigned this Aug 28, 2024
@kbx81 kbx81 marked this pull request as ready for review August 28, 2024 19:53
@esphome esphome bot requested a review from kbx81 August 28, 2024 19:53
@jesserockz
Copy link
Member

🤦 Merging dev back in again after approval means I now have to wait for the CI to run again...haha

@jesserockz jesserockz merged commit 18a1191 into esphome:dev Sep 5, 2024
28 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Sep 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SPI Support for BMP280
7 participants