Merge#28
Merged
Merged
Conversation
Extends the existing image customization (previously only available in state filters) to the main Show Icon action settings. A custom image overrides the icon, color, scale and opacity when set. The other fields are disabled when an image is active to make the relationship clear. Also hardens settings initialization to fill in missing keys from defaults, preventing KeyErrors on actions with incomplete saved state.
Instead of a separate image field, the icon field now accepts both MDI icon names and file paths. If the entered value is a valid MDI icon it is rendered as before, otherwise it is treated as an image/GIF path. Scale works for both. The filter customizations follow the same logic.
Add custom image/GIF option to icon state customizations
Agent-Logs-Url: https://github.com/gensyn/HomeAssistantPlugin/sessions/6527bd55-e8ca-42ab-8a59-63115fd1298c Co-authored-by: gensyn <36128035+gensyn@users.noreply.github.com>
Agent-Logs-Url: https://github.com/gensyn/HomeAssistantPlugin/sessions/6527bd55-e8ca-42ab-8a59-63115fd1298c Co-authored-by: gensyn <36128035+gensyn@users.noreply.github.com>
Agent-Logs-Url: https://github.com/gensyn/HomeAssistantPlugin/sessions/6527bd55-e8ca-42ab-8a59-63115fd1298c Co-authored-by: gensyn <36128035+gensyn@users.noreply.github.com>
Stabilize CI test suite after merged `show_icon`/`BaseCore` behavior changes
Removed GitHub badge and support section from README.
Yet another try to fix the crashes
ed7ca0d
into
copilot/fix-home-assistant-crash-issue
2 checks passed
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the “Show Icon” action to support browsing/selecting local image/GIF files (in addition to MDI icons) and introduces a settings version field with a migration hook executed during BaseCore.on_ready().
Changes:
- Add “Browse…” file pickers to the Show Icon action UI and customization window, plus localization strings and README updates for image support.
- Adjust icon rendering logic so non-MDI values (e.g., image paths) bypass color/opacity handling.
- Introduce a settings
versionfield with a migration entrypoint invoked on action readiness.
Reviewed changes
Copilot reviewed 16 out of 20 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
actions/show_icon/icon_window.py |
Adds browse button + icon-change handling; adjusts validation and UI sensitivity. |
actions/show_icon/icon_action.py |
Adds browse button to action config UI; disables color/opacity when not an MDI icon. |
actions/show_icon/icon_helper.py |
Changes icon resolution to support non-MDI values (e.g., file paths). |
actions/show_icon/icon_const.py |
Adds new i18n label keys for browse/image/not-supported messaging. |
actions/cores/base_core/migrate.py |
Adds initial migration scaffold for settings versioning. |
actions/cores/base_core/base_core.py |
Calls migration on ready; keeps combo items alive while clearing. |
actions/cores/base_core/base_settings.py |
Adds default version to base settings. |
actions/const.py |
Introduces SETTING_VERSION_NUMBER. |
locales/en_US.json |
Adds new “Browse…”, “Image:”, and “Only supported for icons” strings. |
locales/de_DE.json |
Adds German equivalents for new strings. |
README.md |
Documents image/GIF support and adds support section. |
test/actions/show_icon/test_icon_window.py |
Updates init expectations and icon validation test. |
test/actions/show_icon/test_icon_action.py |
Updates tests for new browse button and icon detection logic. |
test/actions/cores/base_core/test_base_core_on_ready.py |
Asserts migration is invoked during on_ready(). |
test/actions/cores/base_core/test_base_core_on_change_domain.py |
Mocks get_n_items() for new keep-alive logic. |
.github/FUNDING.yml |
Adds Ko-fi funding configuration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
30
to
+35
| name, color, scale, opacity = _get_icon_settings(state, settings) | ||
|
|
||
| if name not in MDI_ICONS: | ||
| # color and opacity only have an effect on icons | ||
| return name, scale | ||
|
|
Comment on lines
+108
to
+111
| icon_value = self.settings.get_icon() | ||
| has_icon = bool(icon_value) and icon_value in icon_helper.MDI_ICONS | ||
| not_supported = self.lm.get(icon_const.LABEL_ICON_ONLY_SUPPORTED_FOR_ICONS) if not has_icon else icon_const.EMPTY_STRING | ||
|
|
Comment on lines
+156
to
+158
| if self.check_icon.get_active() and not self.icon.get_text(): | ||
| self.icon.add_css_class(icon_const.ERROR) | ||
| return |
Comment on lines
+182
to
+186
| def _on_icon_changed(self, *_) -> None: | ||
| icon_value = self.icon.get_text() | ||
| has_icon = bool(icon_value) and icon_value in icon_helper.MDI_ICONS | ||
| for widget in [self.check_color, self.color, self.check_opacity, self.opacity, self.opacity_entry]: | ||
| widget.set_sensitive(has_icon) |
Comment on lines
+31
to
+33
| "actions.home_assistant.icon.browse.label": "Browse...", | ||
| "actions.home_assistant.icon.image.label": "Image:", | ||
| "actions.home_assistant.icon.only_supported_for_icons.label": "Only supported for icons", |
Comment on lines
+1
to
+15
| from HomeAssistantPlugin.actions import const | ||
| from HomeAssistantPlugin.actions.cores.customization_core import customization_const | ||
| from HomeAssistantPlugin.actions.show_icon import icon_const | ||
| from HomeAssistantPlugin.actions.show_icon.icon_settings import ShowIconSettings | ||
|
|
||
|
|
||
| def migrate_settings(action) -> None: | ||
| settings = action.get_settings() | ||
|
|
||
| if settings.get(const.SETTING_VERSION) is not None: | ||
| return | ||
|
|
||
| migrate_v0_v1(action) | ||
|
|
||
| def migrate_v0_v1(action) -> None: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.