Skip to content

Allow Pillow version customization in ESPHome Dashboard configuration - #390

Merged
DutchmanNL merged 9 commits into
mainfrom
copilot/allow-pillow-customization
Feb 16, 2026
Merged

Allow Pillow version customization in ESPHome Dashboard configuration#390
DutchmanNL merged 9 commits into
mainfrom
copilot/allow-pillow-customization

Conversation

Copilot AI commented Feb 16, 2026

Copy link
Copy Markdown
Contributor

Addressing PR Feedback

Based on feedback from @SimonFischer04 and @DutchmanNL, implementing the following changes:

  • Fix German translation for lblPillowVersion (already correct: "Pillow-Version")
  • Remove unused jsonData from PillowVersion and ESPHomeDashboardVersion in jsonConfig
  • Implement Pillow version caching similar to ESPHome version pattern
  • Add PillowVersion to dashboard integration test
  • Refactor version fetching logic into reusable function
  • Add integration test for version fetching
  • Ensure clean log entries when fallback versions are used

Changes Made

Version Caching (commit 8ca4137)

  • Added pillowVersions array to cache available versions from PyPI
  • Fetch versions once during adapter initialization in espHomeDashboard()
  • Store versions in _ESPHomeDashboard.pillowVersionCache state for persistence
  • Use cached versions in getPillowVersion message handler (no more repeated API calls)

Error Handling & Logging

  • Proper fallback to cached versions if PyPI is unavailable
  • Fallback to hardcoded versions if cache is also unavailable
  • Clear log messages at appropriate levels (warn/info/debug)

Configuration Cleanup

  • Removed unnecessary jsonData parameter from both ESPHome and Pillow version selectors

Refactoring (this commit)

  • Extracted version fetching logic to fetchAndCachePillowVersions() method
  • Simplified code and improved maintainability
  • Created comprehensive integration test (version_fetch_tests.js) that verifies:
    • Versions are successfully fetched from PyPI
    • Versions are cached in state for offline use
    • Only stable releases are included (alpha/beta/rc filtered out)
    • Versions are properly sorted (newest first)

Testing

  • Added PillowVersion: "Always last available" to dashboard integration test
  • Created dedicated version fetch integration test
Original prompt

This section details on the original issue you should resolve

<issue_title>Allow pillow customization.</issue_title>
<issue_description>Also allow to configure the used 'pillow' version. Like already implemented for 'esphome' (dashboard) version.

Preparation for concept in: #183</issue_description>

<agent_instructions>(or / and add my second account ()https://github.com/SimonFischer042 as reviewer access to the repo as well. For some kind of stupid reasons I can only use the copilot assignment there. PS: don't mention that one or something, not sure if would I get notifications. Its only for assigning copilot to issues - communication please with my main (this) account.)</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits February 16, 2026 18:37
- Add PillowVersion config field to io-package.json
- Add Pillow version selector in admin UI
- Add translations for Pillow version configuration
- Implement PyPI API integration to fetch available Pillow versions
- Update main.js to use configurable Pillow version
- All linter checks pass

Co-authored-by: DutchmanNL <7318445+DutchmanNL@users.noreply.github.com>
Co-authored-by: DutchmanNL <7318445+DutchmanNL@users.noreply.github.com>
Co-authored-by: DutchmanNL <7318445+DutchmanNL@users.noreply.github.com>
Copilot AI changed the title [WIP] Allow pillow customization and version configuration Allow Pillow version customization in ESPHome Dashboard configuration Feb 16, 2026
Copilot AI requested a review from DutchmanNL February 16, 2026 18:41
@DutchmanNL
DutchmanNL requested review from SimonFischer04 and removed request for DutchmanNL February 16, 2026 18:41
@DutchmanNL
DutchmanNL marked this pull request as ready for review February 16, 2026 18:41
Copilot AI review requested due to automatic review settings February 16, 2026 18:41
@DutchmanNL

Copy link
Copy Markdown
Contributor

@SimonFischer04 so what do you think about Copilot's solution ? ;)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds the ability to customize the Pillow version used by ESPHome Dashboard, implementing a similar pattern to the existing ESPHome version selector. Users can now select from available Pillow versions via a dropdown populated from PyPI's JSON API, with fallback to hardcoded versions if PyPI is unavailable.

Changes:

  • Added PillowVersion configuration option with "Always last available" as default
  • Implemented PyPI API integration to fetch and filter stable Pillow versions (top 20)
  • Added version resolution logic that uses hardcoded 11.3.0 for "Always last available" or user-specified version
  • Added admin UI dropdown with autocomplete for version selection
  • Added translation keys (lblPillowVersion, hlpPillowVersion) across all locales

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
main.js Added Pillow version resolution logic (lines 277-291) and getPillowVersion message handler with PyPI API integration (lines 1834-1912)
io-package.json Added PillowVersion to native config with default "Always last available"
admin/jsonConfig.json5 Added autocompleteSendTo dropdown component for Pillow version selection
admin/i18n/*/translations.json Added lblPillowVersion and hlpPillowVersion translation keys (some use English placeholders)
README.md Added changelog entry documenting the new Pillow version customization feature

Comment thread main.js Outdated
Comment thread main.js
Comment thread admin/i18n/de/translations.json Outdated
Comment thread admin/i18n/de/translations.json Outdated
Comment thread admin/jsonConfig.json5 Outdated
Comment thread main.js Outdated
@SimonFischer04

SimonFischer04 commented Feb 16, 2026

Copy link
Copy Markdown
Collaborator

@SimonFischer04 so what do you think about Copilot's solution ? ;)

Cant test right now, but

Looka Not too bad. Just a few comments.

DutchmanNL and others added 2 commits February 16, 2026 21:13
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
DutchmanNL and others added 3 commits February 16, 2026 21:15
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Add pillowVersions array to cache PyPI versions at startup
- Fetch Pillow versions from PyPI once during initialization with proper error handling
- Cache versions in _ESPHomeDashboard.pillowVersionCache state
- Update getPillowVersion handler to use cached versions instead of fetching on every request
- Remove unused jsonData from both ESPHomeDashboardVersion and PillowVersion config
- Add PillowVersion to dashboard integration test
- Add clear logging when using fallback or cached versions

Co-authored-by: DutchmanNL <7318445+DutchmanNL@users.noreply.github.com>
- Create fetchAndCachePillowVersions() helper method
- Simplify espHomeDashboard() by using the new helper
- Add version_fetch_tests.js integration test to verify:
  - Versions are fetched from PyPI
  - Versions are cached in state
  - Only stable versions (no alpha/beta/rc)
  - Versions are sorted newest first
- Integrate version fetch test into test suite

Co-authored-by: DutchmanNL <7318445+DutchmanNL@users.noreply.github.com>
@DutchmanNL

Copy link
Copy Markdown
Contributor

@SimonFischer04 so what do you think about Copilot's solution ? ;)

Cant test right now, but

Looka Not too bad. Just a few comments.

Some changes made based on the review, what about now ?

@SimonFischer04

Copy link
Copy Markdown
Collaborator

@SimonFischer04 so what do you think about Copilot's solution ? ;)

Cant test right now, but
Looka Not too bad. Just a few comments.

Some changes made based on the review, what about now ?

LGTM

@DutchmanNL
DutchmanNL merged commit 9bf4d6f into main Feb 16, 2026
8 of 13 checks passed
@DutchmanNL
DutchmanNL deleted the copilot/allow-pillow-customization branch February 16, 2026 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow pillow customization.

4 participants