8000
Skip to content

Skip gpio validation - #5615

Merged
jesserockz merged 12 commits into
esphome:devfrom
amcfague:skip_gpio_validation
May 15, 2024
Merged

Skip gpio validation#5615
jesserockz merged 12 commits into
esphome:devfrom
amcfague:skip_gpio_validation

Conversation

@amcfague
@amcfague amcfague commented Oct 28, 2023
Copy link
Copy Markdown
Contributor

What does this implement/fix?

Adds an option to skip validation on pins. For custom boards, there are often differing usages--for instance, the Spotpear ESP32C3 uses GPIO12 and 13 to control the LEDs, unlike on the devkit. This enables skipping validation checks for specific pins.

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.io#3699

Test Environment

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

Example entry for config.yaml:

# Example config.yaml
esp32:
  board: esp32s3box
  variant: ESP32S3

output:
  - platform: gpio
    id: board_info_ed
    pin:
      # This pin is reserved on the ESP32S3!
      number: 26
      ignore_pin_validation_error: true

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
Copy Markdown

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

And run script/build_codeowners.py

(message by NeedsCodeownersLabel)

@amcfague
amcfague marked this pull request as ready for review October 28, 2023 05:53
@amcfague
amcfague requested a review from a team as a code owner October 28, 2023 05:53
@probot-esphome
Copy link
Copy Markdown

Hey there @esphome/core, mind taking a look at this pull request as it has been labeled with an integration (esp32) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@jesserockz
Copy link
Copy Markdown
Member

If the board is known, it can be added to the esp32/boards.py file which will allow the known pins to be used for general purpose. Validation is already skipped for listed pins in that file.

@amcfague
Copy link
Copy Markdown
Contributor Author

If the board is known, it can be added to the esp32/boards.py file which will allow the known pins to be used for general purpose. Validation is already skipped for listed pins in that file.

To do so requires also adding platforms to platform-esspresif32, which is a bit more in depth (and for a lot of these cheapo boards, probably not worthwhile).

@jesserockz
Copy link
Copy Markdown
Member

In that case, I feel like it should be a similar option to #5287

@amcfague
Copy link
Copy Markdown
Contributor Author

In that case, I feel like it should be a similar option to #5287

Sounds very reasonable; let me update.

@probot-esphome
Copy link
Copy Markdown

Hey there @esphome/core, mind taking a look at this pull request as it has been labeled with an integration (esp32) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@amcfague
Copy link
Copy Markdown
Contributor Author

Hey @jesserockz, I combined what would have been two overlapping functions into one, validate_configs, that runs on the entire object.

Comment thread esphome/components/esp32/gpio.py Outdated
Comment thread esphome/const.py Outdated
@probot-esphome probot-esphome Bot added the small-pr PR < 30 lines label Dec 19, 2023
@probot-esphome probot-esphome Bot removed the small-pr PR < 30 lines label Dec 19, 2023
@amcfague
Copy link
Copy Markdown
Contributor Author

Hey @jesserockz! It's been a minute, but I merged with dev and this should be all up to date now, if you wanted to give it a pass!

@codecov-commenter
codecov-commenter commented Jan 30, 2024
Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (0fa0904) 53.71% compared to head (707c95e) 53.71%.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #5615   +/-   ##
=======================================
  Coverage   53.71%   53.71%           
=======================================
  Files          50       50           
  Lines        9404     9405    +1     
  Branches     1653     1653           
=======================================
+ Hits         5051     5052    +1     
  Misses       4055     4055           
  Partials      298      298           

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

@jesserockz
jesserockz merged commit f0ec900 into esphome:dev May 15, 2024
@github-actions github-actions Bot locked and limited conversation to collaborators May 17, 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.

3 participants

0