esphome icon indicating copy to clipboard operation
esphome copied to clipboard

[http_request] Add custom UpdateInfo checks

Open dentra opened this issue 1 year ago • 2 comments

What does this implement/fix?

This PR adds the ability to do additional custom UpdateInfo checks to decide whether an update is available.

Types of changes

  • [ ] Bugfix (non-breaking change which fixes an issue)
  • [x] 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#<esphome-docs PR number goes here>

Test Environment

  • [ ] ESP32
  • [ ] ESP32 IDF
  • [ ] ESP8266
  • [ ] RP2040
  • [ ] BK72xx
  • [ ] RTL87xx

Example entry for config.yaml:

# Example config.yaml
http_request:
ota:
  - platform: http_request
update:
  - platform: http_request
    name: Firmware
    source: $FW_MANIFEST_JSON
    check_update: |-
      return !str_endswith(x.latest_version, "-beta");

Checklist:

  • [x] 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:

dentra avatar Aug 05 '24 13:08 dentra

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 53.77%. Comparing base (4d8b5ed) to head (c10523f). Report is 1842 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #7193      +/-   ##
==========================================
+ Coverage   53.70%   53.77%   +0.06%     
==========================================
  Files          50       50              
  Lines        9408     9840     +432     
  Branches     1654     1361     -293     
==========================================
+ Hits         5053     5291     +238     
- Misses       4056     4223     +167     
- Partials      299      326      +27     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Aug 05 '24 13:08 codecov-commenter

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

Learn more about our pull request process.

esphome[bot] avatar Sep 15 '24 23:09 esphome[bot]

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. If you are the author of this PR, please leave a comment if you want to keep it open. Also, please rebase your PR onto the latest dev branch to ensure that it's up to date with the latest changes. Thank you for your contribution!

github-actions[bot] avatar Oct 05 '25 00:10 github-actions[bot]