Custom Component for printer ink levels

command_line sensor is a great idea!!

What if I need to login into a website? I need to use it for my netro sprinkler @nalipaz

https://netrohome.com/login.html?source=WebUI

@jg.balcombe lcombe

Works fine here colors and all:
image

I checked this morning again after restarting my PC, the colors are back! Very strange…

I can’t get the padding to work with the newest bar-card. How did you fix this?

Check out my card -
https://pastebin.com/aMeGq05x

I know it works on the latest 109 release
+++++++++++++++++++++++++++++++++++

cards:
  - cards:
      - entities:
          - entity: sensor.brother_mfc_j485dw
        type: glance
      - entity: sensor.brother_mfc_j485dw
        type: entity
    type: horizontal-stack
  - cards:
      - cards:
          - columns: 4
            direction: up
            entities:
              - color: MediumTurquoise
                entity: sensor.brother_mfc_j485dw_c
                name: Cyan
              - color: MediumOrchid
                entity: sensor.brother_mfc_j485dw_m
                name: Magenta
              - color: Gold
                entity: sensor.brother_mfc_j485dw_y
                name: Yellow
              - color: Black
                entity: sensor.brother_mfc_j485dw_bk
                name: Black
            height: 200px
            max: 100
            min: 0
            padding: 2px
            type: 'custom:bar-card'
            unit_of_measurement: '%'
            width: 100%
        title: Brother Printer Ink Levels
        type: 'custom:vertical-stack-in-card'
    type: horizontal-stack
  - entities:
      - entity: sensor.mfc_j485dw_page_counter
        name: Pages Printed
      - entity: sensor.mfc_j485dw_b_w_counter
        name: B/W Printed
      - entity: sensor.mfc_j485dw_color_counter
        name: Color Printed
    type: glance
type: vertical-stack

Hi, Can you help me and explain how to setup MQTT?
I have also Canon printer so if you can share your setup I will be grateful.

Hi, Can you help me and explain how to setup MQTT?

Sorry no, I’m not using MQTT. I’m using SNMP to get my printer levels.

Sorry for not getting back to you before. I am not using MQTT. I am using Brother Printers HA integration

Has no one else tried the IPP integration? Seems to work well for my Cannon.

Appreciate you all sharing your code. Did a copy paste and enhanced it with a conditional card, so the ink-card is not displayed when the printer is shut off.

type: vertical-stack
cards:
  - type: glance
    entities:
      - entity: sensor.canon_printer_mf643cdw
        name: Canon Printer
  - type: conditional
    conditions:
      - entity: sensor.canon_printer_mf643cdw
        state: idle
    card:
      type: 'custom:bar-card'
      title: Toner cartridge levels
      height: 200px
      max: 100
      min: 0
      padding: 2px
      title_position: bottom
      icon_position: inside
      unit_of_measurement: '%'
      width: 100%
      direction: up
      columns: 4
      entities:
        - color: black
          entity: sensor.canon_printer_mf643cdw_cartridge_054_black_toner
          name: Black
          positions:
            icon: inside
            indicator: inside
            name: outside
        - color: MediumTurquoise
          entity: sensor.canon_printer_mf643cdw_cartridge_054_cyan_toner
          name: Cyan
          positions:
            icon: inside
            indicator: inside
            name: outside
        - color: MediumOrchid
          entity: sensor.canon_printer_mf643cdw_cartridge_054_magenta_to
          name: Magenta
          positions:
            icon: inside
            indicator: inside
            name: outside
        - color: Gold
          entity: sensor.canon_printer_mf643cdw_cartridge_054_yellow_ton
          name: Yellow
          positions:
            icon: inside
            indicator: inside
            name: outside

Hello Tomahawk, I do have Canon MF724cdw, tried to use IPP integration and failed connecting to the printer using IP address - what integration do you use?
thanks in advance for help

I used the IPP integration.
The printer is connected with a LAN cable. And the printers IP address is reserver at the router so it have a “fixed” ip-address. Hope it helps.

Thanks, this explains and helps in confirming that it does work for you.
When I tried, IPP integration did not want to connect to my printer (using IP address). Few factors are on the way (self-signed cert used, maybe also the subnet mask) I may want to diagnose, but with your comment I know I should not give-up too easy. In my case printer uses WiFi, what might be an additional factor, but I don’t have any issues with printing the materials from my phone (also over wifi). Magement interface is available but I don’t like page-scrapping techniques having IPP or SNMP.
I will go your route digging harder :slight_smile:

You might try the ink2mqtt-addon from this repository: https://github.com/james-fry/hassio-addons. That one should work for Canon-printers.
This one requires the Mosquitto Broker addon to present.

Thank you, issue here is to force the printer “talking” any way, so far it responds only to https management portal. Obviously to printing requests too :slight_smile:
I will give it a try.

Hello, I used your code and it works perfectly fine. Visually I would like to customize the boxes because the box “Canon Printer idle” looks a little lost. How and where can I do that? Which template do I need to edit?

 - type: glance # Card no 1 - you an change this card or use  another card which you can customize more...
    entities:
      - entity: sensor.canon_printer_mf643cdw
        name: Canon Printer

  - type: conditional # Card no 2 - This only displays when sensor.canon_printer_mf643cdw is idle
    conditions:
      - entity: sensor.canon_printer_mf643cdw
        state: idle
    card:
1 Like

Hi, could I use this for printer connected via usb?
Or is this only for networked printers