Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 13, 2025

Home Assistant rejected the repository as invalid due to missing repository.json. Additionally, color extraction from album covers lacked explicit validation that RGB values stay within the 0-255 range LEDs require.

Changes

  • Added repository.json at repository root with required metadata (name, url, maintainer) per HA add-on repository spec

  • Added RGB validation in color extraction pipeline:

    • ColorExtractor.validate_rgb(): Clamps RGB values to [0, 255] range
    • Applied in get_color() before caching extracted colors
    • Applied in WLEDController.set_color() before device transmission
  • Added test coverage for RGB clamping edge cases (negative values, values >255, mixed)

Example

# Before: ColorThief output passed through unchecked
color = color_thief.get_color(quality=1)  # Could theoretically be out of range

# After: Explicit validation ensures LED compatibility  
color = self.validate_rgb(*color_thief.get_color(quality=1))
# validate_rgb(300, -10, 128) → (255, 0, 128)

Defense-in-depth approach validates at both extraction and transmission points to guarantee WLED devices never receive invalid RGB values.

Original prompt

This section details on the original issue you should resolve

<issue_title>Not a valid addon repo</issue_title>
<issue_description>https://github.com/raphaelbleier/SpotifyToWled is not a valid add-on repository</issue_description>

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


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits November 13, 2025 14:06
…tory

Co-authored-by: raphaelbleier <75416341+raphaelbleier@users.noreply.github.com>
… are always 0-255

Co-authored-by: raphaelbleier <75416341+raphaelbleier@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix invalid add-on repository issue Add repository.json for HA add-on validation and enforce LED-compatible RGB range Nov 13, 2025
Copilot AI requested a review from raphaelbleier November 13, 2025 14:13
@raphaelbleier raphaelbleier marked this pull request as ready for review November 13, 2025 14:16
@raphaelbleier raphaelbleier merged commit 3a2a71c into main Nov 13, 2025
2 checks passed
@raphaelbleier raphaelbleier deleted the copilot/fix-invalid-addon-repo branch November 13, 2025 14: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.

Not a valid addon repo

2 participants