You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your enhancement request related to a problem? Please describe.
I have a general room status group that I assign as the main entity for the room_card so that the button is red if something is left on, or green if all is ok. This group entity isn't compatible with either label_use_temperature or label_use_brightness variables, so I would like to specify another entity to display the room temperature in the label field when the main entity doesn't contain any temperature attributes.
Describe the solution you'd like
I propose the ability to specify a different entity variable to display the temperature in the label field. I have worked out the following code to do this:
(label field from card_room.yaml)
label: |-
[[[
if (variables.label_use_temperature) {
if (variables.label_temperature_entity != null){
var temp = Math.round(states[variables.label_temperature_entity].state);
return temp + '°C';
} else {
return (entity.attributes.current_temperature || entity.attributes.temperature || entity.state || '-') + (entity.attributes.unit_of_measurement || '°C');
}
} else if (variables.label_use_brightness) {
if (entity.state){
if (entity.state == "off"){
return variables.ulm_off;
} else if (entity.state == "on"){
if (entity.attributes.brightness != null){
var bri = Math.round(entity.attributes.brightness / 2.55);
return (bri ? bri : "0") + "%";
} else {
return variables.ulm_on
}
}
} else {
return variables.ulm_unavailable;
}
} else if (entity.state == "on") {
return variables.ulm_on
} else if (entity.state == "off") {
return variables.ulm_off
} else {
return entity.state
}
]]]
Is your enhancement request related to a problem? Please describe.
I have a general room status group that I assign as the main entity for the room_card so that the button is red if something is left on, or green if all is ok. This group entity isn't compatible with either
label_use_temperature
orlabel_use_brightness
variables, so I would like to specify another entity to display the room temperature in the label field when the main entity doesn't contain any temperature attributes.Describe the solution you'd like
I propose the ability to specify a different entity variable to display the temperature in the label field. I have worked out the following code to do this:
(label field from card_room.yaml)
Specifying the variable in the card:
The text was updated successfully, but these errors were encountered: