-
Notifications
You must be signed in to change notification settings - Fork 4
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Requirements
- I checked the README.
- I have updated entity-progress-card to the latest available version.
- I did a search to see if there is a similar issue.
What would you like to improve?
Support config.entity in template
Why is this improvement helpful?
Support config.entity in template to reduce the number of positions where the entity name needs to be used to a single place. This is beneficial as when using you card e.g., for many lights. Maintenance and initial setup would be much easier
Describe alternatives you've considered
No response
Additional context
I tried e.g., for the brightness at the percentage...
NOT working with config.entity
type: custom:entity-progress-card-template
entity: light.badezimmerambientebeleuchtung
name: Ambiente
secondary: "{{ state_translated(config.entity) }}"
percent: |-
{% if states(config.entity) == 'on' %}
{{ ((state_attr(config.entity, 'brightness') | int / 255) * 100) | round(0) }}
{% else %}
0
{% endif %}
icon: |-
{% if states(config.entity) == 'on' %}
mdi:lightbulb-group
{% else %}
mdi:lightbulb-group-off
{% endif %}
color: |-
{% if states(config.entity) == 'on' %}
var(--yellow-color)
{% else %}
var(--grey-color)
{% endif %}
bar_color: linear-gradient(90deg, lightyellow, var(--yellow-color))
card_mod:
style:
.icon-section: |
.shape {
background-color: transparent !important;
box-shadow: none !important;
}
Only working by giving the entity explicit at multiple places
type: custom:entity-progress-card-template
entity: light.badezimmerambientebeleuchtung
name: Ambiente
secondary: "{{ state_translated('light.badezimmerambientebeleuchtung') }}"
percent: |-
{% if states('light.badezimmerambientebeleuchtung') == 'on' %}
{{ ((state_attr('light.badezimmerambientebeleuchtung', 'brightness') | int / 255) * 100) | round(0) }}
{% else %}
0
{% endif %}
icon: |-
{% if states('light.badezimmerambientebeleuchtung') == 'on' %}
mdi:lightbulb-group
{% else %}
mdi:lightbulb-group-off
{% endif %}
color: |-
{% if states('light.badezimmerambientebeleuchtung') == 'on' %}
var(--yellow-color)
{% else %}
var(--grey-color)
{% endif %}
bar_color: linear-gradient(90deg, lightyellow, var(--yellow-color))
card_mod:
style:
.icon-section: |
.shape {
background-color: transparent !important;
box-shadow: none !important;
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request