Skip to content

Commit e1cc4dd

Browse files
authored
Merge branch 'release' into popup_weather_forecast_fix
2 parents 95cff61 + f34ac86 commit e1cc4dd

File tree

30 files changed

+860
-57
lines changed

30 files changed

+860
-57
lines changed

custom_cards/custom_card_esh_room/README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ hide:
1313

1414
## Credits
1515

16-
- Authors: Everything Smart Home - 2022 and mpeterson
16+
- Authors:
17+
- Everything Smart Home - 2022
18+
- mpeterson
19+
- rensknoors
1720
- Full credit to user [bms on the forum](https://community.home-assistant.io/t/lovelace-ui-minimalist/322687/192), they created the design and base of it in full, EverythingSmartHome put it into a PR as the basis
1821
- beasthouse and basbruss on the EverythingSmartHome discord channel for emoji/humidity customization
1922
- mpeterson added support for a switch to control climate and also to remove the need to have an entity associated
@@ -44,6 +47,10 @@ Fixes text overflow issue over the climate button.
4447
<summary>2.1.1</summary>
4548
Add support for the new popup framework while maintaining backwards compatibility with the old one.
4649
</details>
50+
<details>
51+
<summary>2.2.0</summary>
52+
Introduces a new variable that lets you set the card background to the color of a light entity.
53+
</details>
4754

4855
## Description
4956

@@ -62,6 +69,7 @@ This is an alternative room card to the standard one that is more rectangular th
6269
| ulm_custom_card_esh_room_climate_entity | | No | The entity to use for the climate button |
6370
| ulm_card_light_enable_popup | `false` | No | Enable `popup_light` |
6471
| ulm_card_thermostat_enable_popup | `false` | No | Enable `popup_thermostat` |
72+
| ulm_card_ulm_card_dynamic_color | `false` | No | Enables dynamic background color (requires `ulm_custom_card_esh_room_light_entity`) |
6573

6674
## Usage
6775

custom_cards/custom_card_esh_room/custom_card_esh_room.yaml

Lines changed: 126 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -14,45 +14,95 @@ card_esh_room:
1414
ulm_custom_card_esh_room_climate_entity: null
1515
ulm_card_thermostat_enable_popup: false
1616
ulm_card_light_enable_popup: false
17+
ulm_card_dynamic_color: false
1718
label: >-
1819
[[[
19-
if (!entity) {
20-
return "<br/>";
21-
} else if (entity.state == "on"){
22-
var bri = Math.round(entity.attributes.brightness / 2.55);
23-
return (bri ? bri + "%" : variables.ulm_translation_state) ;
24-
} else {
25-
return variables.ulm_translation_state;
26-
}
20+
var label_entity = variables.ulm_custom_card_esh_room_light_entity
21+
? states[variables.ulm_custom_card_esh_room_light_entity]
22+
: entity;
23+
if (!label_entity) {
24+
return "<br />";
25+
} else if (label_entity.state == "on") {
26+
var bri = Math.round(label_entity.attributes.brightness / 2.55);
27+
return (bri ? bri + "%" : variables.ulm_translation_state);
28+
} else {
29+
return variables.ulm_translation_state;
30+
}
2731
]]]
2832
styles:
2933
card:
3034
- border-radius: "20px"
3135
- box-shadow: "var(--box-shadow)"
3236
- padding: "12px"
37+
- background-color: >-
38+
[[[
39+
if (variables.ulm_custom_card_esh_room_light_entity) {
40+
var color = states[variables.ulm_custom_card_esh_room_light_entity].attributes.rgb_color;
41+
if (states[variables.ulm_custom_card_esh_room_light_entity].state == "on") {
42+
if (color && variables.ulm_card_dynamic_color) {
43+
return 'rgba(' + color + ', 0.2)';
44+
}
45+
return 'rgba(var(--color-background-yellow), 0.2)';
46+
}
47+
}
48+
return 'var(--ha-card-background, var(--card-background-color, white))';
49+
]]]
3350
grid:
3451
- grid-template-areas: >-
3552
[[[
3653
if (variables.ulm_custom_card_esh_room_light_entity && variables.ulm_custom_card_esh_room_climate_entity) {
37-
return "'i light' 'n climate' 'l climate'";
54+
return "'i light' 'n climate' 'l climate'";
3855
} else if (variables.ulm_custom_card_esh_room_light_entity) {
39-
return "'i light' 'n n' 'l l'";
56+
return "'i light' 'n n' 'l l'";
4057
} else if (variables.ulm_custom_card_esh_room_climate_entity) {
41-
return "'i .' 'n climate' 'l climate'";
58+
return "'i .' 'n climate' 'l climate'";
4259
} else {
43-
return "'i .' 'n n' 'l l'";
60+
return "'i .' 'n n' 'l l'";
4461
}
4562
]]]
4663
- grid-template-columns: "1fr 1fr"
4764
- grid-template-rows: "min-content"
4865
icon:
49-
- color: "rgba(var(--color-theme),0.2)"
66+
- filter: >-
67+
[[[
68+
if (variables.ulm_custom_card_esh_room_light_entity
69+
&& states[variables.ulm_custom_card_esh_room_light_entity].state == "on"
70+
&& variables.ulm_card_dynamic_color) {
71+
return "contrast(0.6) saturate(1.7)";
72+
}
73+
]]]
74+
- color: >-
75+
[[[
76+
if (variables.ulm_custom_card_esh_room_light_entity) {
77+
var color = states[variables.ulm_custom_card_esh_room_light_entity].attributes.rgb_color;
78+
if (states[variables.ulm_custom_card_esh_room_light_entity].state == "on") {
79+
if (color && variables.ulm_card_dynamic_color) {
80+
return 'rgba(' + color + ', 1)';
81+
}
82+
return 'rgba(var(--color-yellow), 1)';
83+
}
84+
}
85+
return 'rgba(var(--color-theme), 0.2)';
86+
]]]
5087
img_cell:
51-
- background-color: "rgba(var(--color-theme),0.05)"
5288
- border-radius: "50%"
53-
- place-self: "center"
89+
- place-self: "flex-start"
5490
- width: "42px"
5591
- height: "42px"
92+
- margin-left: "12px"
93+
- background-color: >-
94+
[[[
95+
if (variables.ulm_custom_card_esh_room_light_entity) {
96+
var color = states[variables.ulm_custom_card_esh_room_light_entity].attributes.rgb_color;
97+
if (states[variables.ulm_custom_card_esh_room_light_entity].state == "on") {
98+
if (color && variables.ulm_card_dynamic_color) {
99+
return 'rgba(' + color + ', 0.3)';
100+
}
101+
return 'rgba(var(--color-yellow), 0.2)';
102+
}
103+
}
104+
return 'rgba(var(--color-theme), 0.05)';
105+
]]]
56106
name:
57107
- align-self: "end"
58108
- justify-self: "start"
@@ -62,25 +112,47 @@ card_esh_room:
62112
- margin-top: >-
63113
[[[
64114
if (variables.ulm_custom_card_esh_room_light_entity && variables.ulm_custom_card_esh_room_climate_entity) {
65-
return "8px";
115+
return "8px";
66116
} else if (variables.ulm_custom_card_esh_room_light_entity) {
67-
return "12px";
117+
return "12px";
68118
} else if (variables.ulm_custom_card_esh_room_climate_entity) {
69-
return "8px";
119+
return "8px";
70120
} else {
71-
return "12px";
121+
return "12px";
72122
}
73123
]]]
74124
- max-width: >-
75125
[[[
76126
if (variables.ulm_custom_card_esh_room_light_entity && variables.ulm_custom_card_esh_room_climate_entity) {
77-
return "85%";
127+
return "85%";
78128
} else if (variables.ulm_custom_card_esh_room_light_entity) {
79-
return "100%";
129+
return "100%";
80130
} else if (variables.ulm_custom_card_esh_room_climate_entity) {
81-
return "85%";
131+
return "85%";
82132
} else {
83-
return "100%";
133+
return "100%";
134+
}
135+
]]]
136+
- color: >-
137+
[[[
138+
if (variables.ulm_custom_card_esh_room_light_entity) {
139+
var color = states[variables.ulm_custom_card_esh_room_light_entity].attributes.rgb_color;
140+
if (states[variables.ulm_custom_card_esh_room_light_entity].state == "on") {
141+
if (color && variables.ulm_card_dynamic_color) {
142+
return 'rgba(' + color + ', 1)';
143+
}
144+
return 'rgba(var(color-yellow-text), 1)';
145+
}
146+
return 'rgba(var(--color-theme), 0.6)';
147+
}
148+
return 'rgba(var(--color-theme), 0.6)';
149+
]]]
150+
- filter: >-
151+
[[[
152+
if (variables.ulm_custom_card_esh_room_light_entity
153+
&& states[variables.ulm_custom_card_esh_room_light_entity].state == "on"
154+
&& variables.ulm_card_dynamic_color) {
155+
return "contrast(0.6) saturate(1.7)";
84156
}
85157
]]]
86158
label:
@@ -93,25 +165,25 @@ card_esh_room:
93165
- margin-bottom: >-
94166
[[[
95167
if (variables.ulm_custom_card_esh_room_light_entity && variables.ulm_custom_card_esh_room_climate_entity) {
96-
return "0px";
168+
return "0px";
97169
} else if (variables.ulm_custom_card_esh_room_light_entity) {
98-
return "3px";
170+
return "3px";
99171
} else if (variables.ulm_custom_card_esh_room_climate_entity) {
100-
return "0px";
172+
return "0px";
101173
} else {
102-
return "3px";
174+
return "3px";
103175
}
104176
]]]
105177
- max-width: >-
106178
[[[
107179
if (variables.ulm_custom_card_esh_room_light_entity && variables.ulm_custom_card_esh_room_climate_entity) {
108-
return "85%";
180+
return "85%";
109181
} else if (variables.ulm_custom_card_esh_room_light_entity) {
110-
return "100%";
182+
return "100%";
111183
} else if (variables.ulm_custom_card_esh_room_climate_entity) {
112-
return "85%";
184+
return "85%";
113185
} else {
114-
return "100%";
186+
return "100%";
115187
}
116188
]]]
117189
state:
@@ -125,20 +197,20 @@ card_esh_room:
125197
light:
126198
- display: >
127199
[[[
128-
if (variables.ulm_custom_card_esh_room_light_entity) {
129-
return "block";
130-
} else {
131-
return "none";
132-
}
200+
if (variables.ulm_custom_card_esh_room_light_entity) {
201+
return "block";
202+
} else {
203+
return "none";
204+
}
133205
]]]
134206
climate:
135207
- display: >
136208
[[[
137-
if (variables.ulm_custom_card_esh_room_climate_entity) {
138-
return "block";
139-
} else {
140-
return "none";
141-
}
209+
if (variables.ulm_custom_card_esh_room_climate_entity) {
210+
return "block";
211+
} else {
212+
return "none";
213+
}
142214
]]]
143215
custom_fields:
144216
light:
@@ -150,9 +222,18 @@ card_esh_room:
150222
icon: "mdi:lightbulb"
151223
styles:
152224
icon:
153-
- color: "rgba(var(--color-yellow),1)"
225+
- color: "rgba(var(--color-yellow), 1)"
154226
img_cell:
155-
- background-color: "rgba(var(--color-yellow), 0.2)"
227+
- background-color: >-
228+
[[[
229+
if (variables.ulm_custom_card_esh_room_light_entity) {
230+
var color = states[variables.ulm_custom_card_esh_room_light_entity].attributes.rgb_color;
231+
if (color && variables.ulm_card_dynamic_color) {
232+
return 'rgba(' + color + ', 0.3)';
233+
}
234+
}
235+
return 'rgba(var(--color-yellow), 0.2)';
236+
]]]
156237
- value: "off"
157238
icon: "mdi:lightbulb-off"
158239
type: "custom:button-card"
@@ -163,8 +244,7 @@ card_esh_room:
163244
[[[
164245
let vars = {};
165246
vars.ulm_card_light_enable_popup = variables.ulm_card_light_enable_popup;
166-
167-
if(variables.ulm_card_light_enable_popup) {
247+
if (variables.ulm_card_light_enable_popup) {
168248
vars.ulm_custom_popup = {
169249
'template': 'popup_light_brightness',
170250
'popup_variables': {
@@ -174,7 +254,6 @@ card_esh_room:
174254
}
175255
return vars;
176256
]]]
177-
178257
climate:
179258
card:
180259
entity: "[[[ return variables.ulm_custom_card_esh_room_climate_entity ]]]"
@@ -235,8 +314,7 @@ card_esh_room:
235314
[[[
236315
let vars = {};
237316
vars.ulm_card_thermostat_enable_popup = variables.ulm_card_light_enable_popup;
238-
239-
if(variables.ulm_card_thermostat_enable_popup) {
317+
if (variables.ulm_card_thermostat_enable_popup) {
240318
vars.ulm_custom_popup = {
241319
'template': 'popup_thermostat_temperature',
242320
'popup_variables': {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
ulm_custom_card_irmajavi_speedtest_language_variables:
3+
variables:
4+
## Latvian ##
5+
ulm_custom_card_irmajavi_speedtest_speedtest: "Ātruma tests"
6+
ulm_custom_card_irmajavi_speedtest_download: "lejuplādes ātrums"
7+
ulm_custom_card_irmajavi_speedtest_upload: "augšupielādes ātrums"
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
title: Custom Template Battery Info
3+
hide:
4+
- toc
5+
---
6+
7+
<!-- markdownlint-disable MD046 -->
8+
9+
# Custom Template "Battery Info"
10+
11+
<img width="249" alt="ui_minimalist_battery_info_example" src="https://user-images.githubusercontent.com/63370033/184395981-7fce5840-aa76-453d-8756-39b15e36d26c.png">
12+
13+
## Credits
14+
15+
- Full credit to user [basbruss](https://github.com/basbruss), who created the design and base of it in his person card
16+
17+
## Changelog
18+
19+
<details>
20+
<summary>1.0.0</summary>
21+
Initial release
22+
</details>
23+
24+
## Description
25+
26+
This is an template to add the battery level to every ui minimalist card
27+
28+
## Variables
29+
30+
| Variable | Default | Required | Notes |
31+
| -------------------------------------------- | ------- | -------- | ------------------------------------------------------------------------ |
32+
| ulm_battery_entity | | No | The entity to represent the battery_level
33+
34+
## Usage with battery or battery_level attribute from entity
35+
36+
```yaml
37+
38+
- type: 'custom:button-card'
39+
template:
40+
- card_binary_sensor
41+
- battery_info
42+
entity: binary_sensor.badezimmer_tuer_contact
43+
variables:
44+
ulm_show_last_changed: false
45+
46+
```
47+
48+
## Usage with variable ulm_battery_entity
49+
50+
```yaml
51+
52+
- type: 'custom:button-card'
53+
template:
54+
- card_binary_sensor
55+
- battery_info
56+
entity: binary_sensor.badezimmer_tuer_contact
57+
variables:
58+
ulm_show_last_changed: false
59+
ulm_battery_entity: sensor.badezimmer_tuer_battery_level
60+
61+
```

0 commit comments

Comments
 (0)