Skip to content

Commit

Permalink
Merge branch 'main' into frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
basbruss authored May 3, 2023
2 parents 2666135 + f8c33b7 commit deac9a1
Show file tree
Hide file tree
Showing 14 changed files with 74 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ custom_card_person_chip:
label: >
[[[
let state = states[variables.ulm_custom_card_person_chip_entity].state;
return hass.resources[hass["language"]]["component.person" + ".state._." + state] || state;
return hass.resources[hass["language"]]["component.person.entity_component._.state." + state] || state;
]]]
show_entity_picture: true
entity_picture: "[[[ return states[variables.ulm_custom_card_person_chip_entity].attributes.entity_picture ]]]"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ ulm_translation_engine:
[[[
if (typeof(entity) !== 'undefined' && entity !== undefined){
let not_active = ['disarmed','off','closed','not_home','standby','idle','docked','unknown','unavailable','paused']
return !not_active.includes(entity.state)
function containsNumbers(str) {
return /\d/.test(str);
}
return (!not_active.includes(entity.state) && !containsNumbers(entity.state))
}
]]]
ulm_translation_hour: >
Expand Down Expand Up @@ -67,7 +70,7 @@ ulm_translation_engine:
let def = ["unknown", "unavailable"];
let lang = hass["language"];
let domain = entity.entity_id.substr(0, entity.entity_id.indexOf("."));
var translation = hass.resources[lang]["component." + domain + ".state._." + state]
var translation = hass.resources[lang]["component." + domain + ".entity_component._.state." + state]
const now = new Date();
const timestamp = (new Date(state)).getTime();
const nowTimeStamp = now.getTime();
Expand All @@ -87,7 +90,7 @@ ulm_translation_engine:
var translation = hass.resources[lang]["state.default." + state ];
}
else if (domain == "binary_sensor" && d_class != ''){
var translation = hass.resources[lang]["component." + domain + ".state." + d_class + "." + state]
var translation = hass.resources[lang]["component." + domain + ".entity_component." + d_class + ".state." + state]
}
else if (d_class == 'timestamp'){
var translation = formatter.format(diff, scale)
Expand Down Expand Up @@ -137,20 +140,20 @@ ulm_translation_engine:
else if (Math.abs(minutesDiff) < 60){ scale = 'minute'; diff = minutesDiff }
else if (Math.abs(hoursDiff) < 24){ scale = 'hour'; diff = hoursDiff }
if(hass.resources[lang]["component." + domain + ".state._." + state]){
var translation = hass.resources[lang]["component." + domain + ".state._." + state] + unit
if(hass.resources[lang]["component." + domain + ".entity_component._.state." + state]){
var translation = hass.resources[lang]["component." + domain + ".entity_component._.state." + state] + unit
} else {
var translation = state + unit;
}
if (def.includes(state)) {
var translation = hass.resources[lang]["state.default." + state ];
}
else if (domain == "binary_sensor" && d_class != ''){
var translation = hass.resources[lang]["component." + domain + ".state." + d_class + "." + state]
var translation = hass.resources[lang]["component." + domain + ".entity_component." + d_class + ".state." + state]
}
else if (domain == "media_player" && d_class != ''){
if (state == 'idle' || state == 'paused')
var translation = hass.resources[lang]["component." + domain + ".state." + state];
var translation = hass.resources[lang]["component." + domain + ".entity_component._.state." + state];
else {
var translation = (entity.attributes.source) + ' • ' + ( Math.round(entity.attributes.volume_level / 0.01)) + '%' ;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ card_graph:
ulm_card_graph_points: "0.5"
ulm_card_graph_group_by: "interval"
ulm_card_graph_line_width: 5
ulm_card_graph_icon_color: ""
triggers_update: "all"
custom_fields:
item1:
Expand All @@ -24,7 +25,33 @@ card_graph:
variables:
ulm_card_generic_icon: "[[[ return variables.ulm_card_graph_icon; ]]]"
ulm_card_generic_name: "[[[ return variables.ulm_card_graph_name; ]]]"

custom_fields:
item1:
card:
type: "custom:button-card"
custom_fields:
item1:
card:
type: "custom:button-card"
styles:
icon:
- color: >
[[[
var color = variables.ulm_card_graph_icon_color;
if (variables.ulm_card_graph_icon_color){
return 'rgba(var(--color-' + color + '),1)';
}
return 'rgba(var(--color-theme),0.2)';
]]]
img_cell:
- background-color: >
[[[
var color = variables.ulm_card_graph_icon_color;
if (variables.ulm_card_graph_icon_color){
return 'rgba(var(--color-' + color + '),0.2)';
}
return 'rgba(var(--color-theme),0.05)';
]]]
item2:
card:
type: "custom:mini-graph-card"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ card_binary_sensor:
card:
- background-color: >
[[[
if (variables.ulm_card_binary_sensor_force_background_color || hass.themes.darkMode) {
if (variables.ulm_card_binary_sensor_force_background_color) {
var color = variables.ulm_card_binary_sensor_color;
return 'rgba(var(--color-' + color + '),var(--opacity-bg))';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ card_binary_sensor_alert:
card:
- background-color: >
[[[
if (variables.ulm_card_binary_sensor_alert_force_background_color || hass.themes.darkMode) {
if (variables.ulm_card_binary_sensor_alert_force_background_color) {
var color = variables.ulm_card_binary_sensor_alert_color;
return 'rgba(var(--color-' + color + '),var(--opacity-bg))';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ card_cover:
- background-color: >
[[[
if (variables.ulm_card_cover_color) {
if (variables.ulm_card_cover_force_background_color || hass.themes.darkMode) {
if (variables.ulm_card_cover_force_background_color) {
var color = variables.ulm_card_cover_color;
return 'rgba(var(--color-' + color + '),var(--opacity-bg))';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ card_fan:
- background-color: >
[[[
if (variables.ulm_card_fan_color) {
if (variables.ulm_card_fan_force_background_color || hass.themes.darkMode) {
if (variables.ulm_card_fan_force_background_color) {
var color = variables.ulm_card_fan_color;
return 'rgba(var(--color-' + color + '),var(--opacity-bg))';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ card_generic:
card:
- background-color: >
[[[
if (variables.ulm_card_generic_force_background_color || hass.themes.darkMode) {
if (variables.ulm_card_generic_force_background_color) {
var color = variables.ulm_card_generic_color;
return 'rgba(var(--color-' + color + '),var(--opacity-bg))';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ card_generic_swap:
card:
- background-color: >
[[[
if (variables.ulm_card_generic_swap_force_background_color || hass.themes.darkMode) {
if (variables.ulm_card_generic_swap_force_background_color) {
var color = variables.ulm_card_generic_swap_color;
return 'rgba(var(--color-' + color + '),var(--opacity-bg))';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ card_input_boolean:
card:
- background-color: >
[[[
if (variables.ulm_card_input_boolean_force_background_color || hass.themes.darkMode) {
if (variables.ulm_card_input_boolean_force_background_color) {
var color = variables.ulm_card_input_boolean_color;
return 'rgba(var(--color-' + color + '),var(--opacity-bg))';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ card_light:
card:
- background-color: >
[[[
var color_set = variables.ulm_card_light_enable_color ? entity.attributes.rgb_color : variables.ulm_card_light_color;
var color_set = (variables.ulm_card_light_enable_color && entity.attributes.rgb_color) ? entity.attributes.rgb_color : variables.ulm_card_light_color;
var color = 'rgba(var(--color-' + color_set + '),var(--opacity-bg))'
if(variables.ulm_card_light_enable_color){
if(variables.ulm_card_light_enable_color && entity.attributes.rgb_color){
color = 'rgba(' + color_set + ',var(--opacity-bg))'
}
if (variables.ulm_card_light_force_background_color || hass.themes.darkMode) {
if (variables.ulm_card_light_force_background_color) {
return color
}
]]]
Expand Down Expand Up @@ -150,9 +150,9 @@ card_light:
icon:
- color: >
[[[
var color_set = variables.ulm_card_light_enable_color ? entity.attributes.rgb_color : variables.ulm_card_light_color;
var color_set = variables.ulm_card_light_enable_color && entity.attributes.rgb_color ? entity.attributes.rgb_color : variables.ulm_card_light_color;
var color = 'rgba(var(--color-' + color_set + '),1)'
if(variables.ulm_card_light_enable_color){
if(variables.ulm_card_light_enable_color && entity.attributes.rgb_color){
color = 'rgba(' + color_set + ',1)'
}
if (entity.state != "on") {
Expand All @@ -163,9 +163,9 @@ card_light:
img_cell:
- background-color: >
[[[
var color_set = variables.ulm_card_light_enable_color ? entity.attributes.rgb_color : variables.ulm_card_light_color;
var color_set = variables.ulm_card_light_enable_color && entity.attributes.rgb_color ? entity.attributes.rgb_color : variables.ulm_card_light_color;
var color = 'rgba(var(--color-' + color_set + '),0.2)'
if(variables.ulm_card_light_enable_color){
if(variables.ulm_card_light_enable_color && entity.attributes.rgb_color){
color = 'rgba(' + color_set + ',0.2)'
}
if (entity.state != "on") {
Expand Down Expand Up @@ -226,9 +226,9 @@ card_light:
maxSet: "[[[ return variables.ulm_card_light_enable_slider_maxSet ]]]"
mainSliderColor: >
[[[
var color_set = variables.ulm_card_light_enable_color ? entity.attributes.rgb_color : variables.ulm_card_light_color;
var color_set = variables.ulm_card_light_enable_color && entity.attributes.rgb_color ? entity.attributes.rgb_color : variables.ulm_card_light_color;
var color = 'rgba(var(--color-' + color_set + '),1)'
if(variables.ulm_card_light_enable_color){
if(variables.ulm_card_light_enable_color && entity.attributes.rgb_color){
color = 'rgba(' + color_set + ',1)'
}
if (entity.state == "unavailable") {
Expand All @@ -241,9 +241,9 @@ card_light:
]]]
secondarySliderColor: >
[[[
var color_set = variables.ulm_card_light_enable_color ? entity.attributes.rgb_color : variables.ulm_card_light_color;
var color_set = variables.ulm_card_light_enable_color && entity.attributes.rgb_color ? entity.attributes.rgb_color : variables.ulm_card_light_color;
var color = 'rgba(var(--color-' + color_set + '),0.2)'
if(variables.ulm_card_light_enable_color){
if(variables.ulm_card_light_enable_color && entity.attributes.rgb_color){
color = 'rgba(' + color_set + ',0.2)'
}
if (entity.state == "unavailable") {
Expand All @@ -253,9 +253,9 @@ card_light:
]]]
thumbColor: >
[[[
var color_set = variables.ulm_card_light_enable_color ? entity.attributes.rgb_color : variables.ulm_card_light_color;
var color_set = variables.ulm_card_light_enable_color && entity.attributes.rgb_color ? entity.attributes.rgb_color : variables.ulm_card_light_color;
var color = 'rgba(var(--color-' + color_set + '),1)'
if(variables.ulm_card_light_enable_color){
if(variables.ulm_card_light_enable_color && entity.attributes.rgb_color){
color = 'rgba(' + color_set + ',1)'
}
if (entity.state == "unavailable") {
Expand Down Expand Up @@ -306,9 +306,9 @@ card_light:
[[[
if (variables.ulm_card_light_force_background_color) {
if (entity.state != "off") {
var color_set = variables.ulm_card_light_enable_color ? entity.attributes.rgb_color : variables.ulm_card_light_color;
var color_set = variables.ulm_card_light_enable_color && entity.attributes.rgb_color ? entity.attributes.rgb_color : variables.ulm_card_light_color;
var color = 'rgba(var(--color-' + color_set + '),0.2)'
if (variables.ulm_card_light_enable_color) {
if (variables.ulm_card_light_enable_color && entity.attributes.rgb_color) {
color = 'rgba(' + color_set + ',0.2)';
}
return color;
Expand All @@ -320,9 +320,9 @@ card_light:
[[[
if (variables.ulm_card_light_force_background_color) {
if (entity.state != "off") {
var color_set = variables.ulm_card_light_enable_color ? entity.attributes.rgb_color : variables.ulm_card_light_color;
var color_set = variables.ulm_card_light_enable_color && entity.attributes.rgb_color ? entity.attributes.rgb_color : variables.ulm_card_light_color;
var color = 'rgba(var(--color-' + color_set + '),1)';
if (variables.ulm_card_light_enable_color) {
if (variables.ulm_card_light_enable_color && entity.attributes.rgb_color) {
color = 'rgba(' + color_set + ',1)';
}
return color;
Expand Down Expand Up @@ -358,9 +358,9 @@ card_light:
[[[
if (variables.ulm_card_light_force_background_color) {
if (entity.state != "off") {
var color_set = variables.ulm_card_light_enable_color ? entity.attributes.rgb_color : variables.ulm_card_light_color;
var color_set = variables.ulm_card_light_enable_color && entity.attributes.rgb_color ? entity.attributes.rgb_color : variables.ulm_card_light_color;
var color = 'rgba(var(--color-' + color_set + '),0.2)'
if (variables.ulm_card_light_enable_color) {
if (variables.ulm_card_light_enable_color && entity.attributes.rgb_color) {
color = 'rgba(' + color_set + ',0.2)';
}
return color;
Expand All @@ -372,9 +372,9 @@ card_light:
[[[
if (variables.ulm_card_light_force_background_color) {
if (entity.state != "off") {
var color_set = variables.ulm_card_light_enable_color ? entity.attributes.rgb_color : variables.ulm_card_light_color;
var color_set = variables.ulm_card_light_enable_color && entity.attributes.rgb_color ? entity.attributes.rgb_color : variables.ulm_card_light_color;
var color = 'rgba(var(--color-' + color_set + '),1)';
if (variables.ulm_card_light_enable_color) {
if (variables.ulm_card_light_enable_color && entity.attributes.rgb_color) {
color = 'rgba(' + color_set + ',1)';
}
return color;
Expand Down Expand Up @@ -410,9 +410,9 @@ card_light:
[[[
if (variables.ulm_card_light_force_background_color) {
if (entity.state != "off") {
var color_set = variables.ulm_card_light_enable_color ? entity.attributes.rgb_color : variables.ulm_card_light_color;
var color_set = variables.ulm_card_light_enable_color && entity.attributes.rgb_color ? entity.attributes.rgb_color : variables.ulm_card_light_color;
var color = 'rgba(var(--color-' + color_set + '),0.2)'
if (variables.ulm_card_light_enable_color) {
if (variables.ulm_card_light_enable_color && entity.attributes.rgb_color) {
color = 'rgba(' + color_set + ',0.2)';
}
return color;
Expand All @@ -424,9 +424,9 @@ card_light:
[[[
if (variables.ulm_card_light_force_background_color) {
if (entity.state != "off") {
var color_set = variables.ulm_card_light_enable_color ? entity.attributes.rgb_color : variables.ulm_card_light_color;
var color_set = variables.ulm_card_light_enable_color && entity.attributes.rgb_color ? entity.attributes.rgb_color : variables.ulm_card_light_color;
var color = 'rgba(var(--color-' + color_set + '),1)';
if (variables.ulm_card_light_enable_color) {
if (variables.ulm_card_light_enable_color && entity.attributes.rgb_color) {
color = 'rgba(' + color_set + ',1)';
}
return color;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ card_media_player:
- background-color: >
[[[
if (variables.ulm_card_media_player_color) {
if (variables.ulm_card_media_player_force_background_color || hass.themes.darkMode) {
if (variables.ulm_card_media_player_force_background_color) {
var color = variables.ulm_card_media_player_color;
return 'rgba(var(--color-' + color + '),var(--opacity-bg))';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ card_power_outlet:
card:
- background-color: >
[[[
if (variables.ulm_card_power_outlet_force_background_color || hass.themes.darkMode) {
if (variables.ulm_card_power_outlet_force_background_color) {
var color = variables.ulm_card_power_outlet_color;
return 'rgba(var(--color-' + color + '),var(--opacity-bg))';
}
Expand Down
Loading

0 comments on commit deac9a1

Please sign in to comment.