Thank you! I did just that, but I’m actually having another issue… The status badge ALWAYS says idle, even if it’s printing. Any troubleshooting steps?
Looking at my sensor history, it looks like it never changes for me either. Perhaps a fault with the, in my case, HP’s IPP?
Great solution. But my values always staying on the initial value.
printer_black:
friendly_name: "Printer Ink Black"
initial_value: 0
value_template: >-
{% if is_state('sensor.epson_xp_4150_series_black_ink', 'unavailable') -%}
{{ (states('var.printer_black')) }}
{%- else -%}
{{ (states('sensor.epson_xp_4150_series_black_ink')) }}
{%- endif %}
tracked_entity_id:
- sensor.epson_xp_4150_series_black_ink
printer_cyan:
friendly_name: "Printer Ink Cyan"
initial_value: 0
value_template: >-
{% if is_state('sensor.epson_xp_4150_series_cyan_ink', 'unavailable') -%}
{{ (states('var.printer_cyan')) }}
{%- else -%}
{{ (states('sensor.epson_xp_4150_series_cyan_ink')) }}
{%- endif %}
tracked_entity_id:
- sensor.epson_xp_4150_series_cyan_ink
printer_magenta:
friendly_name: "Printer Ink Magenta"
initial_value: 0
value_template: >-
{% if is_state('sensor.epson_xp_4150_series_magenta_ink', 'unavailable') -%}
{{ (states('var.printer_magenta')) }}
{%- else -%}
{{ (states('sensor.epson_xp_4150_series_magenta_ink')) }}
{%- endif %}
tracked_entity_id:
- sensor.epson_xp_4150_series_magenta_ink
printer_yellow:
friendly_name: "Printer Ink Yellow"
initial_value: 0
value_template: >-
{% if is_state('sensor.epson_xp_4150_series_yellow_ink', 'unavailable') -%}
{{ (states('var.printer_yellow')) }}
{%- else -%}
{{ (states('sensor.epson_xp_4150_series_yellow_ink')) }}
{%- endif %}
tracked_entity_id:
- sensor.epson_xp_4150_series_yellow_ink
The tracked entities are all fine and up to date with the current inkt levels.
Hi, I’m trying to implement the same layout (the four ink status on two rows), but unfortunately without results. Can you please help me by sharing the parts you modified to obtain it ?
Moreover, is there any way to “move” the card on the UI in order to place it in the center of the screen ? Because by default it extends itself from center towards the right of the screen. Thanks
hello, in your themes, we see a white text color. When I create my bar-card, my handwriting is black. As a result, we cannot read in the black and photo black cartridges. How do you get the text to be white? thank you
It worked!!. Thank you.
I had to change “unknown” to “unavailable” and then it already remembers the state of my toners once the printer is turned off.
Thanks this is working fine, one thing I want to change is the place of the white small rectangular with the colors on.
It seems that the color containers aren’t fully displayed I thinks it needs another 5 px to be compleet.
Where do I change the size of the 4 white rectangulars?
Hi,
I tried to implement your technique to keep the cartridge level when the printer is turned off but it does not work.
I installed the HACS Variable module, I put the code below in configuration.yaml
var:
printer_black:
friendly_name: "HP Color LaserJet Pro MFP 4302 black cartridge"
initial_value: 0
value_template: >-
{% if is_state('sensor.hp_color_laserjet_pro_mfp_4302_black_cartridge', 'unavailable') -%}
{{ (states('var.printer_black')) }}
{%- else -%}
{{ (states('sensor.hp_color_laserjet_pro_mfp_4302_black_cartridge')) }}
{%- endif %}
tracked_entity_id:
- sensor.hp_color_laserjet_pro_mfp_4302_black_cartridge
printer_cyan:
friendly_name: "HP Color LaserJet Pro MFP 4302 cyan cartridge"
initial_value: 0
value_template: >-
{% if is_state('sensor.hp_color_laserjet_pro_mfp_4302_cyan_cartridge', 'unavailable') -%}
{{ (states('var.printer_cyan')) }}
{%- else -%}
{{ (states('sensor.hp_color_laserjet_pro_mfp_4302_cyan_cartridge')) }}
{%- endif %}
tracked_entity_id:
- sensor.hp_color_laserjet_pro_mfp_4302_cyan_cartridge
printer_magenta:
friendly_name: "HP Color LaserJet Pro MFP 4302 magenta cartridge"
initial_value: 0
value_template: >-
{% if is_state('sensor.hp_color_laserjet_pro_mfp_4302_magenta_cartridge') -%}
{{ (states('var.printer_magenta')) }}
{%- else -%}
{{ (states('sensor.hp_color_laserjet_pro_mfp_4302_magenta_cartridge')) }}
{%- endif %}
tracked_entity_id:
- sensor.hp_color_laserjet_pro_mfp_4302_magenta_cartridge
printer_yellow:
friendly_name: "HP Color LaserJet Pro MFP 4302 yellow cartridge"
initial_value: 0
value_template: >-
{% if is_state('sensor.hp_color_laserjet_pro_mfp_4302_yellow_cartridge', 'unavailable') -%}
{{ (states('var.printer_yellow')) }}
{%- else -%}
{{ (states('sensor.hp_color_laserjet_pro_mfp_4302_yellow_cartridge')) }}
{%- endif %}
tracked_entity_id:
- sensor.hp_color_laserjet_pro_mfp_4302_yellow_cartridge
In my loveleace I put this code but when I turn off the printer it goes to unavailable
cards:
- cards:
- cards:
- columns: 4
direction: up
entities:
- color: MediumTurquoise
entity: sensor.hp_color_laserjet_pro_mfp_4302_cyan_cartridge
name: Cyan
- color: MediumOrchid
entity: sensor.hp_color_laserjet_pro_mfp_4302_magenta_cartridge
name: Magenta
- color: Gold
entity: sensor.hp_color_laserjet_pro_mfp_4302_yellow_cartridge
name: Yellow
- color: Black
entity: sensor.hp_color_laserjet_pro_mfp_4302_black_cartridge
name: Black
height: 100px
positions:
icon: inside
title: outside
max: 100
min: 0
padding: 2px
type: custom:bar-card
unit_of_measurement: '%'
width: 100%
title: HP LaserJet Pro 4302
type: custom:vertical-stack-in-card
type: horizontal-stack
type: vertical-stack
Thank you for your help.
Same problem here, did you find a solution?
When the printer is online you write the status or attribute to a helper. So when it gets offline you still have the value.
i would only suggest to use card mode the make a png without a white background like the example i have send earlier
I have just upgraded my printer to an IPP compatible one. I just wanted to say thank you for your fantastic card.