-
-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(cover): possibility to set a color per cover state with theme #384
feat(cover): possibility to set a color per cover state with theme #384
Conversation
Hi @bramstroker Instead of adding another option, you can add custom theme variables like Exemple : Lock Card / Alarm card / Person Card / Update card |
Thanks for the PR 🙂 By default we will keep the colored state for open for all cover (shutters, garage, etc...) because it's defined like this in Apple Homekit and Google Home. Example in Google Home (sorry for the french Screenshot 😅): I agree with @acesyde may be we can add theme variables for open and closed state color like the lock card to allow user to change the default behaviour. |
The Google Home approach seems also counter intuitive to me, but I understand you want to streamline this. The problem with this theme variable is this would apply to the whole dashboard, so when I set another color for Maybe we can introduce a configuration for the cover card |
@piitaya @acesyde Could you please have another look? I introduced a bunch of theme variables for the different states (as suggested) and removed the deviceclass logic I added. I can now change the colors on a per card base with card_mod plugin. type: custom:mushroom-cover-card
entity: cover.garage_door
card_mod:
style: |
:host {
--rgb-state-cover-closed: var(--rgb-red);
--rgb-state-cover-closing: var(--rgb-red);
--rgb-state-cover-open: var(--rgb-grey);
--rgb-state-cover-opening: var(--rgb-grey);
} It's not perfect, especially for not so tech savy people. And you'll need an additional plugin to do this. But for me it's workable this way. |
Thanks for the changes. |
Good question. I did not use the position control myself currently so did not check. |
Yep, but the logic of the slider is not inverted. You are using grey for open color so the slider will be grey. |
I need some time to study the real issue. I think it's more a UX issue between open and closed state than just a color issue. |
The issue is about devices which are covering the window. For example a roller shutter. So my garage door in this screenshot is actually a bad example. I want to see in a glance which of my devices are in an active state. The roller shutters are now shown active all the time which is very confusing. This PR solves this case, but also allow to define other colors than the default blue. |
Hi ! I'm coming back to you with a good news 🙂 I merged a PR to add disabled color. So you can now use : type: custom:mushroom-cover-card
entity: cover.garage_door
card_mod:
style: |
:host {
--rgb-state-cover-closed: var(--rgb-red);
--rgb-state-cover-closing: var(--rgb-red);
--rgb-state-cover-open: var(--rgb-disabled);
--rgb-state-cover-opening: var(--rgb-disabled);
} I also have 2 comments :
|
Hi both, I am not that deep in HA yet, not using styles. With the option to set color/icon available on the template card lot of flexibility is available for end users. Would it be an option to implement the same templating flexibility in the cover card ? This would allow to select icon as well as color per state of any entity. Or am I missing anything ? |
That's great. Will be able to do some development on this PR tomorrow.
Ok, I will revert this changes. What's the reason why this logic is all copied from HA base, can't we just import these components from the core HA frontend somehow, which keeps the code DRY and bug fixing can happen upstream.
I think |
I would also like an icon selection and color picker for the |
@bramstroker Thank you. I do understand things need to stay manageable but I think this would bring real added value |
Could be something like this. @piitaya what do you think? |
I do not prefer to propose icon depending of state. Just choose the correct |
HA front-end doesn't propose to import code so we need to copy all the rules 😅 |
@piitaya Yes I agree, choosing icon per state would really be overkill and polute the GUI for an edge case.
|
Ah, that's a pitty, maybe in the future.. |
I plan to add a GUI to edit mushroom variables to avoid using card_mod for color editing per state. To have a better customization for advanced users like you but from GUI 🙂 |
No problem, learned a bit trying to implement it. will finish the PR without this feature. |
PR is ready for final review now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put some comments about the color rules.
I also have good news for you : I will add a theme option to allow users to override theme for each card directly from the UI and without card_mod
#423
Co-authored-by: Paul Bottein <paul.bottein@gmail.com>
That's awesome. Your comments about the colors are resolved. Also resolved the merge conflicts again, for #417 and #422 |
Description
For shutters, curtains etc. it's more logical to show the cover in an active state when it is closed. My first proposal was to introduce a toggle in the config to invert this logic.
In this PR I solved it by looking at the device class of the entity.
Also cleaned up the code a bit by introducing enums for the possible device classes and states of covers.
Related Issue
Fixes #227
Motivation and Context
See above
How Has This Been Tested
Tested with 3 different covers of different device classes (garage, shutter and window). When the shutter was closed the icon was in active state as expected, for the other devices the old logic still applies and did not see any regressions here.
Types of changes
Checklist