bar-card
bar-card copied to clipboard
[Feature Request] Allow 'min' and 'max' to be an entity or float/int
I'd like to see the min and max options be able to defined via an entity (dynamic).
Like to have the same, but not only entity, but also attribute of an entity.
Would love this as well!
It's doable via the config-template-card
.
Example:
- type: custom:config-template-card
variables:
max_containers: states['sensor.total_containers'].state
entities:
- ${max_containers}
card:
type: custom:bar-card
entities:
- entity: sensor.total_containers_running
positions:
icon: 'off'
name: Running
height: 20px
color: green
max: ${max_containers}
target: 48
- entity: sensor.total_containers_stopped
positions:
icon: 'off'
height: 20px
name: Stopped
color: red
max: ${max_containers}
- entity: sensor.total_containers_paused
name: Paused
height: 20px
color: darkorange
positions:
icon: 'off'
max: ${max_containers}
Above worked great. Thanks.
I'm still learning so pls forgive if a silly question... I am looking for something similar, where I would like to have the target inheriting a value from an entity called "estimated_prod"
Looking the piece of code it's basically about replacing the '40' with "estimated_prod"
` type: custom:bar-card entities:
- entity: sensor.deye_daily_production max: '50' target: '40' ` Any hints/directions? I am looking at the suggestion from firstof9 but I don't know where to place it.
It's doable via the
config-template-card
.Example:
- type: custom:config-template-card variables: max_containers: states['sensor.total_containers'].state entities: - ${max_containers} card: type: custom:bar-card entities: - entity: sensor.total_containers_running positions: icon: 'off' name: Running height: 20px color: green max: ${max_containers} target: 48 - entity: sensor.total_containers_stopped positions: icon: 'off' height: 20px name: Stopped color: red max: ${max_containers} - entity: sensor.total_containers_paused name: Paused height: 20px color: darkorange positions: icon: 'off' max: ${max_containers}
I use you tips and it's working but when using it with custom:config-template-card
, the animation is not working anymore.
a example , the first one, the animation is working but not in the second one :
type: entities
entities:
- entity: sensor.circuit_1_power
type: custom:bar-card
animation:
state: 'on'
speed: '2'
- type: custom:config-template-card
variables:
max_containers: states['sensor.phase_a_power'].state
entities:
- ${max_containers}
card:
entity: sensor.circuit_1_power
type: custom:bar-card
animation:
state: 'on'
speed: '2'
ps : on this example, i don't use the variable as it's just to reflect the issue with a minimal configuration.
It's a bug/limitation on custom:bar-card
or in custom:config-template-card
or i use it badly ?
I tried to apply this for my scenario as well. I like to visualize to which extend am I utilizing the predicted solar energy on my roof.
What am I doing wrong?
type: custom:config-template-card
variables:
forecast_today: states['sensor.forecast_pv_ertrag_ost_west'].state
entities:
- $(forecast_today)
card:
type: custom:bar-card
entities:
- entity: sensor.plenticore_energy_yield_day
unit_of_measurement: kwh
title: PV-Ertrag vs. Forecast
columns: '1'
max: $(forecast_today)