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 MPL115A2 Barometric Pressure/Temperature Sensor #6584

Open
wants to merge 27 commits into
base: dev
Choose a base branch
from

Conversation

unic8s
Copy link

@unic8s unic8s commented Apr 18, 2024

What does this implement/fix?

Add support for the MPL115A2 pressure/temperature I²C sensor. This is the tinier version of the already exisiting implementation of the sensor MPL3115A2 but without the altitude metric. The code is partly ported from https://github.com/adafruit/Adafruit_MPL115A2

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

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

Test Environment

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

Example entry for config.yaml:

sensor:
- platform: mpl115a2
  temperature:
    name: "Temperature"
  pressure:
    name: "Pressure"
  update_interval: 10s

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

Hey there @unic8s,
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 = ["@unic8s"]

And run script/build_codeowners.py

(message by NeedsCodeownersLabel)

@codecov-commenter
Copy link

codecov-commenter commented Apr 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 54.15%. Comparing base (4d8b5ed) to head (75233bb).
Report is 516 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #6584      +/-   ##
==========================================
+ Coverage   53.70%   54.15%   +0.44%     
==========================================
  Files          50       50              
  Lines        9408     9575     +167     
  Branches     1654     1687      +33     
==========================================
+ Hits         5053     5185     +132     
- Misses       4056     4066      +10     
- Partials      299      324      +25     

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

esphome/components/mpl115a2/mpl115a2.cpp Outdated Show resolved Hide resolved
esphome/components/mpl115a2/mpl115a2.cpp Outdated Show resolved Hide resolved
esphome/components/mpl115a2/mpl115a2.cpp Outdated Show resolved Hide resolved
esphome/components/mpl115a2/mpl115a2.cpp Outdated Show resolved Hide resolved
esphome/components/mpl115a2/mpl115a2.h Outdated Show resolved Hide resolved
esphome/components/mpl115a2/mpl115a2.cpp Outdated Show resolved Hide resolved
esphome/components/mpl115a2/sensor.py Outdated Show resolved Hide resolved
esphome/components/mpl115a2/sensor.py Outdated Show resolved Hide resolved
tests/test1.yaml Outdated
Copy link
Member

Choose a reason for hiding this comment

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

Please move this to its own file in tests/components/mpl115a2/

Copy link
Author

@unic8s unic8s May 6, 2024

Choose a reason for hiding this comment

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

@jesserockz I did so - should I remove it from the test1.yaml as well?

@esphome esphome bot marked this pull request as draft May 5, 2024 22:32
@esphome
Copy link

esphome bot commented May 5, 2024

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

unic8s and others added 4 commits May 6, 2024 22:11
@jesserockz thank you very much for your review and helping me out on the topics I missed

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
@unic8s unic8s marked this pull request as ready for review May 6, 2024 20:50
@esphome esphome bot requested a review from jesserockz May 6, 2024 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants