Skip to content

hondzik/printer-toner-level-feature

Repository files navigation

Printer toner level feature for Home Assistant Tile card

GitHub Release License Project Maintenance Github GitHub Activity

My Home Assistant

This 'card feature' is used to display the current toner levels of printers.

Color Black & White

Before using it, you first need to define your own template sensor, which stores the level of each toner in its attributes:

- sensor:
    - name: "HP Color LasetJet Pro MFP M283fdw"
      state: "{{ states('sensor.hp_colorlaserjet_mfp_m282_m285_2') }}"
      icon: mdi:printer
      attributes:
        domain: "printer"
        ip: "{{ state_attr ('sensor.hp_colorlaserjet_mfp_m282_m285_2', 'uri_supported').split('/')[2] }}"
        cyan_level: "{{ states('sensor.hp_colorlaserjet_mfp_m282_m285_cyan_cartridge_hp_w2211a_2') }}"
        magenta_level: "{{ states('sensor.hp_colorlaserjet_mfp_m282_m285_magenta_cartridge_hp_w2213a_2') }}"
        yellow_level: "{{ states('sensor.hp_colorlaserjet_mfp_m282_m285_yellow_cartridge_hp_w2212a_2') }}"
        black_level: "{{ states('sensor.hp_colorlaserjet_mfp_m282_m285_black_cartridge_hp_w2210a_2') }}"

The way you fill in the individual attributes may vary depending on the integration used (I use IPP) and the type of printer. The only required attributes are domain and black_level; the others are optional.

Next, you need to create a Tile card and select the created template sensor as the entity. In the Feature selection, you should be able to choose Printer toner level (the option will appear based on the attribute domain: "printer").

For black-and-white printers, just set the grid_options.rows to 2; for color printers, you need to set the grid_options.rows to 3.

Configuration for a color printer may look like this:

type: tile
entity: sensor.hp_color_lasetjet_pro_mfp_m283fdw
features_position: bottom
vertical: false
state_content:
  - state
  - ip
features:
  - type: custom:printer-toner-level-feature
grid_options:
  columns: 6
  rows: 3

The feature allows you to hide the percentage display and change the color of the black toner display. For this, use these configuration variables:

features:
  - type: custom:printer-toner-level-feature
    show_percent: false
    black_as_white: false

You can use "Edit feature" icon to use settings dialog: Edit feature icon Edit feature dialog

About

Custom Printer Toner Level Feature for Home Assistant Tile cards

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors