-
-
Notifications
You must be signed in to change notification settings - Fork 341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(graph): add graph card #454
base: main
Are you sure you want to change the base?
Conversation
* feat: graph * fix: credits * fix: translations * fix: action * fix: margin * fix: bugs / doc / samples * fix: review * fix: add secondary / primary info customization Co-authored-by: Paul Bottein <[email protected]>
If someone, like me, needs this card, they can temporarily use a combination of type: custom:stack-in-card
cards:
- type: custom:mushroom-template-card
primary: Temperatura
secondary: '{{ states(entity) }} °C'
icon: mdi:thermometer
icon_color: |-
{% if is_state(entity, 'unknown') %}
{% elif states(entity) | float >= 45 %}
red
{% elif states(entity) | float >= 42 %}
orange
{% elif states(entity) | float >= 39 %}
amber
{% elif states(entity) | float >= 36 %}
yellow
{% else %}
green
{% endif %}
entity: sensor.cpu_temperature
- type: custom:mini-graph-card
entities:
- sensor.cpu_temperature
group: true
show:
icon: false
name: false
state: false
hours_to_show: 6
points_per_hour: 3
color_thresholds:
- value: 0
color: '#47a04b'
- value: 36
color: '#ffeb3b'
- value: 39
color: '#ffc107'
- value: 42
color: '#ff9800'
- value: 45
color: '#f44336' |
Hey @alessandroias Really thank you for sharing, I've took your code and updated it to my needs. I'm sharing it below.
|
Thanks for the template @raphaeleduardo42 but it does seem to have an error. When the temperatur is at for example 22° the graph and the icon dont have the same color. The icon is light-blue and the graph is amber in this case. Any idea whats wrong?
|
The repository decluttering-card can also be used to create "templates". Example that was added on top of the Lovelace configuration: decluttering_templates:
mushroom-graph-card:
card:
type: custom:stack-in-card
cards:
- type: custom:mushroom-template-card
primary: '[[name]]'
secondary: '{{ states(entity) }} [[unit]]'
icon: '[[icon]]'
icon_color: '[[color]]'
entity: '[[entity]]'
tap_action:
action: more-info
hold_action:
action: none
double_tap_action:
action: none
- type: custom:mini-graph-card
entities:
- '[[entity]]'
line_color: '[[color]]'
group: true
show:
icon: false
name: false
state: false
views:
- ... How the template can be used in a card: type: horizontal-stack
cards:
- type: custom:decluttering-card
template: mushroom-graph-card
variables:
- name: Temperatur
- unit: °C
- color: red
- icon: mdi:thermometer
- entity: sensor.aqara_sensor_schlafzimmer_temperature
- type: custom:decluttering-card
template: mushroom-graph-card
variables:
- name: Humidity
- unit: '%'
- color: blue
- icon: mdi:water-percent
- entity: sensor.aqara_sensor_schlafzimmer_humidity
- type: custom:decluttering-card
template: mushroom-graph-card
variables:
- name: Pressure
- unit: hPa
- color: grey
- icon: mdi:car-cruise-control
- entity: sensor.aqara_sensor_schlafzimmer_pressure
This way, you can kind of "fake" a new card and only need to provide the variables to change the values. |
Hi Im curious, what is holding this back? |
Any news on this? |
This feature would be really awesome |
Fixes #74
TODO : merge graph and entity card for simplicity.