Custom Component for printer ink levels

I really liked the idea of your custom component, but as I use hassio I dont think it will work since ink needs to be installed in the homeassistant docker container.

So instead I took the approach to create a hassio addon that will run ink periodically, parse the output into JSON and sent it to HA via MQTT.

Its very much a hack job (esp the shell script that calls ink and mosquitto client for MQTT) but it works great for my Canon Pixma 5300, and supports HA MQTT autodiscovery - albeit in a very hard coded way :wink:

You can find it in my hassio addons repo:

To get other printers working you will probably need to edit the ink2mqtt.sh script.

Here is my lovelace card to show ink levels using the superb custom cards bar-card and vertical-stack-in-card:

image

type: 'custom:vertical-stack-in-card'
title: Canon MG5300 Printer Ink
cards:
  - type: 'custom:bar-card'
    columns: 5
    direction: up
    entities:
      - color: MediumTurquoise
        entity: sensor.canon_mg5300_cyan_ink_level
      - color: MediumOrchid
        entity: sensor.canon_mg5300_magenta_ink_level
      - color: Gold
        entity: sensor.canon_mg5300_yellow_ink_level
      - color: Black
        entity: sensor.canon_mg5300_black_ink_level
      - color: Black
        entity: sensor.canon_mg5300_photoblack_ink_level
    height: 200px
    max: 100
    min: 0
    padding: 2px
    target: 20
    title_position: bottom
    icon_position: inside
    unit_of_measurement: '%'
    width: 100%

Hope it helps someone…

8 Likes