Mushroom-Printer-State-Card v2
Made with Mushroom-Card and Button-Card.
The card shows
- the state of my printer (sensor from IPP-Integration)
- the fill of the toners Cyan, Magenta, Yellow, Black (sensors from IPP-Integration)
You just to need to fill in your entities in the “variables:”-section.
YAML-Code
(little update - just found out that i need to add “triggers_update” so that updates to the entities will show as they happen)
type: custom:button-card
variables:
printer_state: sensor.ecosys_m5521cdn
c_state: sensor.ecosys_m5521cdn_cyan_tk_5230cs
y_state: sensor.ecosys_m5521cdn_yellow_tk_5230y
m_state: sensor.ecosys_m5521cdn_magenta_tk_5230m
k_state: sensor.ecosys_m5521cdn_black_tk_5230k
triggers_update:
- sensor.ecosys_m5521cdn
- sensor.ecosys_m5521cdn_cyan_tk_5230cs
- sensor.ecosys_m5521cdn_yellow_tk_5230y
- sensor.ecosys_m5521cdn_magenta_tk_5230m
- sensor.ecosys_m5521cdn_black_tk_5230k
show_name: false
show_state: false
show_icon: false
styles:
card:
- padding: 3px
grid:
- grid-template-areas: '"oben" "unten"'
- grid-template-columns: 100%
- grid-template-rows: 2fr 1fr
custom_fields:
oben:
- filter: opacity(100%)
- overflow: visible
unten:
- filter: opacity(100%)
- overflow: visible
custom_fields:
oben:
card:
type: custom:mushroom-entity-card
entity: '[[[ return variables.printer_state ]]]'
tap_action:
action: more-info
icon: mdi:printer-outline
card_mod:
style: |
ha-card {
padding: 0px !important;
padding-bottom: 3px !important;
text-align: left !important;
border: none !important;
box-shadow: none !important;
}
unten:
card:
type: grid
columns: 4
square: false
cards:
- type: custom:button-card
entity: '[[[ return variables.k_state ]]]'
size: 100%
styles:
grid:
- grid-template-areas: '"s"'
- grid-template-columns: 100%
- grid-template-rows: 100%
icon:
- color: var(--primary-text-color)
state:
- font-size: 1rem
- font-weight: bold
- color: var(--primary-text-color)
name:
- font-size: 0.7rem
- color: var(--primary-text-color)
card:
- background: >-
[[[ return "linear-gradient(to top, rgba(150,150,150,0.2) 0%,
rgba(150,150,150,0.2) " + states[variables.k_state].state + "%,
rgba(150,150,150,0.1) " + states[variables.k_state].state + "%,
rgba(150,150,150,0.1) 100%)" ]]]
- height: 3rem
show_name: false
show_state: true
show_label: false
show_icon: false
name: >-
[[[ return states[variables.k_state].attributes.friendly_name
]]]
state_display: >-
[[[ return
Math.round(Number(states[variables.k_state].state)).toFixed(0) +
states[variables.k_state].attributes.unit_of_measurement; ]]]
icon: mdi:water
card_mod:
style: |
ha-card {
padding: 3px !important;
margin: 0px !important;
border: none !important;
box-shadow: none !important;
}
- type: custom:button-card
entity: '[[[ return variables.c_state ]]]'
size: 100%
styles:
grid:
- grid-template-areas: '"s"'
- grid-template-columns: 100%
- grid-template-rows: 100%
icon:
- color: darkcyan
state:
- font-size: 1rem
- font-weight: bold
- color: darkcyan
name:
- font-size: 0.7rem
- color: darkcyan
card:
- background: >-
[[[ return "linear-gradient(to top, rgba(0,139,139,0.2)
0%, rgba(0,139,139,0.2) " +
states[variables.c_state].state + "%, rgba(0,139,139,0.1)
" + states[variables.c_state].state + "%,
rgba(0,139,139,0.1) 100%)" ]]]
- height: 3rem
show_name: false
show_state: true
show_label: false
show_icon: false
label: >-
[[[ return states[variables.c_state].attributes.friendly_name
]]]
state_display: >-
[[[ return
Math.round(Number(states[variables.c_state].state)).toFixed(0) +
states[variables.c_state].attributes.unit_of_measurement; ]]]
icon: mdi:water
card_mod:
style: |
ha-card {
padding: 3px !important;
margin: 0px !important;
border: none !important;
box-shadow: none !important;
}
- type: custom:button-card
entity: '[[[ return variables.m_state ]]]'
size: 100%
styles:
grid:
- grid-template-areas: '"s"'
- grid-template-columns: 100%
- grid-template-rows: 100%
icon:
- color: magenta
state:
- font-size: 1rem
- font-weight: bold
- color: magenta
name:
- font-size: 0.7rem
- color: magenta
card:
- background: >-
[[[ return "linear-gradient(to top, rgba(255,0,255,0.2)
0%, rgba(255,0,255,0.2) " +
states[variables.m_state].state + "%, rgba(255,0,255,0.1)
" + states[variables.m_state].state + "%,
rgba(255,0,255,0.1) 100%)" ]]]
- height: 3rem
show_name: false
show_state: true
show_label: false
show_icon: false
label: >-
[[[ return states[variables.m_state].attributes.friendly_name
]]]
state_display: >-
[[[ return
Math.round(Number(states[variables.m_state].state)).toFixed(0) +
states[variables.m_state].attributes.unit_of_measurement; ]]]
icon: mdi:water
card_mod:
style: |
ha-card {
padding: 3px !important;
margin: 0px !important;
border: none !important;
box-shadow: none !important;
}
- type: custom:button-card
entity: '[[[ return variables.y_state ]]]'
size: 100%
styles:
grid:
- grid-template-areas: '"s"'
- grid-template-columns: 100%
- grid-template-rows: 100%
icon:
- color: darkorange
state:
- font-size: 1rem
- font-weight: bold
- color: darkorange
name:
- font-size: 0.7rem
- color: darkorange
card:
- background: >-
[[[ return "linear-gradient(to top, rgba(255, 140, 0,0.2)
0%, rgba(255, 140, 0,0.2) " +
states[variables.y_state].state + "%, rgba(255, 140,
0,0.1) " + states[variables.y_state].state + "%, rgba(255,
140, 0,0.1) 100%)" ]]]
- height: 3rem
show_name: false
show_state: true
show_label: false
show_icon: false
label: >-
[[[ return states[variables.y_state].attributes.friendly_name
]]]
state_display: >-
[[[ return
Math.round(Number(states[variables.y_state].state)).toFixed(0) +
states[variables.y_state].attributes.unit_of_measurement; ]]]
icon: mdi:water
card_mod:
style: |
ha-card {
padding: 3px !important;
margin: 0px !important;
border: none !important;
box-shadow: none !important;
}
You can also have the cards above in this way
All you need to to ist to change this
grid:
- grid-template-areas: '"oben" "unten"'
- grid-template-columns: 100%
- grid-template-rows: 1.3fr 1fr
to that
grid:
- grid-template-areas: '"oben unten"'
- grid-template-columns: 1fr 1fr
- grid-template-rows: 100%
```**Mushroom-Printer-State-Card v2**
![image|379x112](upload://4dExhDegjWuZr4tmRibru9QboN0.png)
![image|385x117](upload://lSxlEMndlYqcQ7A7CdvLqEMcw0W.png)
Made with Mushroom-Card and Button-Card.
The card shows
* the state of my printer (sensor from IPP-Integration)
* the fill of the toners Cyan, Magenta, Yellow, Black (sensors from IPP-Integration)
You just to need to fill in your entities in the “variables:”-section.
[u]YAML-Code[/u]
(little update - just found out that i need to add “triggers_update” so that updates to the entities will show as they happen)
type: custom:button-card
variables:
printer_state: sensor.ecosys_m5521cdn
c_state: sensor.ecosys_m5521cdn_cyan_tk_5230cs
y_state: sensor.ecosys_m5521cdn_yellow_tk_5230y
m_state: sensor.ecosys_m5521cdn_magenta_tk_5230m
k_state: sensor.ecosys_m5521cdn_black_tk_5230k
triggers_update:
- sensor.ecosys_m5521cdn
- sensor.ecosys_m5521cdn_cyan_tk_5230cs
- sensor.ecosys_m5521cdn_yellow_tk_5230y
- sensor.ecosys_m5521cdn_magenta_tk_5230m
- sensor.ecosys_m5521cdn_black_tk_5230k
show_name: false
show_state: false
show_icon: false
styles:
card:
- padding: 3px
grid:
- grid-template-areas: ‘“oben” “unten”’
- grid-template-columns: 100%
- grid-template-rows: 2fr 1fr
custom_fields:
oben:
- filter: opacity(100%)
- overflow: visible
unten:
- filter: opacity(100%)
- overflow: visible
custom_fields:
oben:
card:
type: custom:mushroom-entity-card
entity: ‘[[[ return variables.printer_state ]]]’
tap_action:
action: more-info
icon: mdi:printer-outline
card_mod:
style: |
ha-card {
padding: 0px !important;
padding-bottom: 3px !important;
text-align: left !important;
border: none !important;
box-shadow: none !important;
}
unten:
card:
type: grid
columns: 4
square: false
cards:
- type: custom:button-card
entity: ‘[[[ return variables.k_state ]]]’
size: 100%
styles:
grid:
- grid-template-areas: ‘“s”’
- grid-template-columns: 100%
- grid-template-rows: 100%
icon:
- color: var(–primary-text-color)
state:
- font-size: 1rem
- font-weight: bold
- color: var(–primary-text-color)
name:
- font-size: 0.7rem
- color: var(–primary-text-color)
card:
- background: >-
[[[ return "linear-gradient(to top, rgba(150,150,150,0.2) 0%,
rgba(150,150,150,0.2) " + states[variables.k_state].state + "%,
rgba(150,150,150,0.1) " + states[variables.k_state].state + “%,
rgba(150,150,150,0.1) 100%)” ]]]
- height: 3rem
show_name: false
show_state: true
show_label: false
show_icon: false
name: >-
[[[ return states[variables.k_state].attributes.friendly_name
]]]
state_display: >-
[[[ return
Math.round(Number(states[variables.k_state].state)).toFixed(0) +
states[variables.k_state].attributes.unit_of_measurement; ]]]
icon: mdi:water
card_mod:
style: |
ha-card {
padding: 3px !important;
margin: 0px !important;
border: none !important;
box-shadow: none !important;
}
- type: custom:button-card
entity: ‘[[[ return variables.c_state ]]]’
size: 100%
styles:
grid:
- grid-template-areas: ‘“s”’
- grid-template-columns: 100%
- grid-template-rows: 100%
icon:
- color: darkcyan
state:
- font-size: 1rem
- font-weight: bold
- color: darkcyan
name:
- font-size: 0.7rem
- color: darkcyan
card:
- background: >-
[[[ return "linear-gradient(to top, rgba(0,139,139,0.2)
0%, rgba(0,139,139,0.2) " +
states[variables.c_state].state + "%, rgba(0,139,139,0.1)
" + states[variables.c_state].state + “%,
rgba(0,139,139,0.1) 100%)” ]]]
- height: 3rem
show_name: false
show_state: true
show_label: false
show_icon: false
label: >-
[[[ return states[variables.c_state].attributes.friendly_name
]]]
state_display: >-
[[[ return
Math.round(Number(states[variables.c_state].state)).toFixed(0) +
states[variables.c_state].attributes.unit_of_measurement; ]]]
icon: mdi:water
card_mod:
style: |
ha-card {
padding: 3px !important;
margin: 0px !important;
border: none !important;
box-shadow: none !important;
}
- type: custom:button-card
entity: ‘[[[ return variables.m_state ]]]’
size: 100%
styles:
grid:
- grid-template-areas: ‘“s”’
- grid-template-columns: 100%
- grid-template-rows: 100%
icon:
- color: magenta
state:
- font-size: 1rem
- font-weight: bold
- color: magenta
name:
- font-size: 0.7rem
- color: magenta
card:
- background: >-
[[[ return "linear-gradient(to top, rgba(255,0,255,0.2)
0%, rgba(255,0,255,0.2) " +
states[variables.m_state].state + "%, rgba(255,0,255,0.1)
" + states[variables.m_state].state + “%,
rgba(255,0,255,0.1) 100%)” ]]]
- height: 3rem
show_name: false
show_state: true
show_label: false
show_icon: false
label: >-
[[[ return states[variables.m_state].attributes.friendly_name
]]]
state_display: >-
[[[ return
Math.round(Number(states[variables.m_state].state)).toFixed(0) +
states[variables.m_state].attributes.unit_of_measurement; ]]]
icon: mdi:water
card_mod:
style: |
ha-card {
padding: 3px !important;
margin: 0px !important;
border: none !important;
box-shadow: none !important;
}
- type: custom:button-card
entity: ‘[[[ return variables.y_state ]]]’
size: 100%
styles:
grid:
- grid-template-areas: ‘“s”’
- grid-template-columns: 100%
- grid-template-rows: 100%
icon:
- color: darkorange
state:
- font-size: 1rem
- font-weight: bold
- color: darkorange
name:
- font-size: 0.7rem
- color: darkorange
card:
- background: >-
[[[ return "linear-gradient(to top, rgba(255, 140, 0,0.2)
0%, rgba(255, 140, 0,0.2) " +
states[variables.y_state].state + "%, rgba(255, 140,
0,0.1) " + states[variables.y_state].state + “%, rgba(255,
140, 0,0.1) 100%)” ]]]
- height: 3rem
show_name: false
show_state: true
show_label: false
show_icon: false
label: >-
[[[ return states[variables.y_state].attributes.friendly_name
]]]
state_display: >-
[[[ return
Math.round(Number(states[variables.y_state].state)).toFixed(0) +
states[variables.y_state].attributes.unit_of_measurement; ]]]
icon: mdi:water
card_mod:
style: |
ha-card {
padding: 3px !important;
margin: 0px !important;
border: none !important;
box-shadow: none !important;
}
You can also have the cards above in this way
![image|474x66](upload://8mJ27BHfhGblPRoyfQxWlF0ZSuA.png)
![image|478x69](upload://rR0ApCnGgG2oznIFhrPcgXBPpyl.png)
All you need to to ist to change this
grid:
- grid-template-areas: '"oben" "unten"'
- grid-template-columns: 100%
- grid-template-rows: 1.3fr 1fr
to that
grid:
- grid-template-areas: ‘“oben unten”’
- grid-template-columns: 1fr 1fr
- grid-template-rows: 100%