-
Notifications
You must be signed in to change notification settings - Fork 441
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
Implementation of popup cards #42
Conversation
Popup for outlet and light
Initial popup version
Initial popup version
Initial popup version
Initial popup version
Initial popup version
Initial popup version
Initial popup version
Hi @schumijo I'm having some problems getting my theme variables into the popup card. |
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 added some comments to center the popup_light brightness slider better.
Let me know what you think 😉
background: none !important; | ||
box-shadow: none !important; | ||
} | ||
.off { |
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.
You can use .slider-container input[type="range"]
to merge the .on
and .off
css classes into one statement
} | ||
.on { | ||
border: 1px solid rgba(var(--color-theme),0.3) !important; | ||
} |
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 have added a flexbox to the slider card because it was not centered in most of my screens. Flexbox is a easy solution to center things in every browser that supports it.
.slider-container {
display: flex;
justify-content: center;
align-items: center;
}
And in the slider-container input from above:
.slider-container input[type="range"]{
position: revert !important;
}
$: | | ||
#interactionLayer{ z-index: 1; filter: opacity(0.6);} | ||
#backgroundLayer{ | ||
filter: blur(20px); |
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.
you can use the smooth_color_wheel
property from the light-entity-card
instead of blurring the wheel yourself.
state: | ||
- operator: template | ||
value: > | ||
[[[ return new URL(window.location.href).hash !== '#color' ]]] |
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.
This does not work for me 😞 I don't know why. Still looking for a solution.
Hi Bavo, Thank you for your comments. I will take a look. |
background: none !important; | ||
box-shadow: none !important; | ||
padding: 10px 0 10px 0 !important; | ||
} |
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.
} | |
} | |
color_temp: | |
type: custom:button-card | |
styles: | |
grid: | |
- grid-template-areas: '"item1"' | |
- grid-template-columns: 1fr | |
- grid-template-rows: min-content | |
card: | |
- background: none | |
- box-shadow: none | |
- padding: 4% | |
custom_fields: | |
item1: | |
card: | |
type: "custom:my-slider" | |
entity: "[[[ return entity.entity_id ]]]" | |
minBar: "[[[ return entity.attributes.min_mireds ]]]" | |
minSet: "[[[ return entity.attributes.min_mireds ]]]" | |
maxBar: "[[[ return entity.attributes.max_mireds ]]]" | |
maxSet: "[[[ return entity.attributes.max_mireds ]]]" | |
function: 'Warmth' | |
radius: 20px | |
rotate: 270 | |
containerHeight: 320px | |
width: 250px | |
height: 100px | |
thumbHorizontalPadding: 0px | |
thumbWidth: 2% | |
thumbHeight: 85px | |
thumbColor: '#000' | |
mainSliderColor: rgba(255, 255, 255, 0) | |
mainSliderColorOff: rgba(255, 255, 255, 0) | |
card_mod: | |
style: | | |
ha-card { | |
background: none !important; | |
box-shadow: none !important; | |
} | |
.slider-container input[type="range"] { | |
position: revert !important; | |
border: 1px solid rgba(208, 208, 208, 1) !important; | |
background: linear-gradient(90deg, #c9f2fc, #fff, #f3db6d); | |
--thumb-top: 1px !important; | |
} | |
.slider-container input[type="range"]::-webkit-slider-thumb { | |
margin-top: 7px; | |
background-color: rgba(1, 1, 1, 0); | |
} | |
.slider-container input[type="range"]::-moz-range-thumb { | |
background-color: rgba(1, 1, 1, 0); | |
} | |
.slider-container { | |
display: flex; | |
justify-content: center; | |
align-items: center; | |
} |
I've added an extra slider to change the color temperature of the light.
UPDATE: Added color temperature to the card.
This is achieved by making the mainSliderColor transparent and using a css gradient function as a secondary slider color. The thumb is a small black bar, but I had to add some custom styling to make them look the same on all the different browser.
icon: | ||
- color: "rgba(var(--color-blue),1)" | ||
img_cell: | ||
- background-color: "rgba(var(--color-blue), 0.2)" |
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.
- background-color: "rgba(var(--color-blue), 0.2)" | |
- background-color: "rgba(var(--color-blue), 0.2)" | |
item3: | |
card: | |
icon: "mdi:sun-thermometer-outline" | |
name: Temperatuur | |
type: "custom:button-card" | |
template: popup_button | |
tap_action: | |
action: navigate | |
navigation_path: "#color_temp" | |
state: | |
- operator: template | |
value: > | |
[[[ return !entity.attributes.supported_color_modes.includes("color_temp"); ]]] | |
styles: | |
card: | |
- display: none | |
- operator: template | |
value: > | |
[[[ return new URL(window.location.href).hash === '#color_temp' ]]] | |
styles: | |
icon: | |
- color: "rgba(var(--color-blue),1)" | |
img_cell: | |
- background-color: "rgba(var(--color-blue), 0.2)" |
The extra button for changing the color temperature. I'm not sure about the icon for the color temperature, but i don't know what else to use.
UPDATE: Do not display the color temp option when the light does not support it.
The next step would be to show the color, color temperature, and brightness buttons only when the light supports these operations. Thats the next thing i'll look into 😉 |
Hi @bavo Excellent work ! I am really interested about your changes. That is the target of this PR : everybody can add some improvements |
Okey, I've updated the code for the brightness slider in my original comment to reduce spam 😉 |
item3: | ||
card: | ||
type: custom:button-card | ||
template: popup_list_items |
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.
template: popup_list_items | |
styles: | |
grid: | |
- grid-template-areas: > | |
[[[ | |
var areas = []; | |
var brightness_modes = ["brightness", "hs", "color_temp", "rgb", "rgbw"]; | |
var color_modes = ["hs", "rgb", "rgbw"]; | |
var color_temp_modes = ["color_temp"]; | |
if (entity.attributes.supported_color_modes.some(r => brightness_modes.includes(r))) { | |
areas.push("item1"); | |
} | |
if (entity.attributes.supported_color_modes.some(r => color_modes.includes(r))) { | |
areas.push("item2"); | |
} | |
if (entity.attributes.supported_color_modes.some(r => color_temp_modes.includes(r))) { | |
areas.push("item3"); | |
} | |
return "\"" + areas.join(" ") + "\""; | |
]]] | |
- grid-template-columns: > | |
[[[ | |
var columns = []; | |
var brightness_modes = ["brightness", "hs", "color_temp", "rgb", "rgbw"]; | |
var color_modes = ["hs", "rgb", "rgbw"]; | |
var color_temp_modes = ["color_temp"]; | |
if (entity.attributes.supported_color_modes.some(r => brightness_modes.includes(r))) { | |
columns.push("1fr"); | |
} | |
if (entity.attributes.supported_color_modes.some(r => color_modes.includes(r))) { | |
columns.push("1fr"); | |
} | |
if (entity.attributes.supported_color_modes.some(r => color_temp_modes.includes(r))) { | |
columns.push("1fr"); | |
} | |
return columns.join(" "); | |
]]] | |
- grid-template-rows: min-content | |
- column-gap: 0px | |
card: | |
- background: none | |
- box-shadow: none | |
- padding: 0px |
I've ditched the popup_list_items and created my own grid layout. The layout is calculated on how many features are supported by the entity. I don't know why, but you also need a 'display: none' on the items below. (see the next change) I would think that not specifying items here in the grid layout removes them from the layout. But there just appended to the grid. So the solution is a bit verbose, but it works quite well.
tap_action: | ||
action: navigate | ||
navigation_path: "#brightness" | ||
state: |
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.
state: | |
state: | |
- operator: template | |
value: > | |
[[[ | |
var brightness_modes = ["brightness", "hs", "color_temp", "rgb", "rgbw"]; | |
return !entity.attributes.supported_color_modes.some(r => brightness_modes.includes(r)); | |
]]] | |
styles: | |
card: | |
- display: none |
Do not display the brightness options when the light does not support it.
tap_action: | ||
action: navigate | ||
navigation_path: "#color" | ||
state: |
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.
state: | |
state: | |
- operator: template | |
value: > | |
[[[ | |
var color_modes = ["hs", "rgb", "rgbw"]; | |
return !entity.attributes.supported_color_modes.some(r => color_modes.includes(r)); | |
]]] | |
styles: | |
card: | |
- display: none |
Do not display the color wheel when the light does not support it
👍 |
Hi @CM000n |
@schumijo I'm also working on a pull request into this pull-request for my changes 😉 But I'm hoping to finish in a couple of days. |
Hi @bavo |
Hi @schumijo, How do you see the implementation of the popup with a fire-dom? |
Wrong copy paste logic 🤦
By putting a fire-dom event on brightness button instead of hash reference, it will replace the current popup with the new one (I hope it's clear) |
Hi @bavo, You can find my quick and dirty code here : https://github.com/schumijo/UI/blob/light_popup_fire_dom/config/minimalist-templates/popup_templates.yaml New templates are popup_light_2, popup_light_brightness and popup_light_color Sorry, I didn't add you beautiful modifications on my code. This code needs to be cleaned/optimized. |
Np, I’ll have a look. 👍 I don’t know if you have seen the pull request i have send to your branch to include my changes? I’ll update the pull request to include your changes. |
Yes I see it. Good job ! |
WIP: started a new pull request to include my changes
Hi Screenshots of work in progress on updated power_outlet popup. I manage to create "responsive" popup. |
Hi @CM000n Oups I did something wrong with the source branch on my repo :( |
Oups, nope, sorry. 😱 |
New PR #132 |
No problem |
Hi,
Implementation of popup cards for lights, power outlets and airconditionner.
Need some documentation on Wiki.