Integrating a printer with Home Assistant – a smart home printer!

Published by Oliver on

A printer is part of most households. Integrating a printer with Home Assistant is the next step to get some cool automations and nice graphs. I recently had to buy a new printer and will describe here how to add it to Home Assistant and my Graphana dashboard.

The printer

Humanity can go to space but for some reason we are still not able to build simple printers that just work. My cheap inkjet printer recently died on me (again) after only one or two years and a couple hundred printed pages at most. Instead of throwing more money out of the window for the same printer I decided to go another route and buy a cheap laser printer.

I think most of my printers died because I am only rarely printing anything. While ink based printers are cheap(er) they tend to clog over time. The alternative are laser printers which use toner that does not have the same issue. Unfortunately they are also a bit more expensive but that is balanced out by cheaper toner prices (vs ink prices). I decided to go with a very small and relatively cheap device that can only print. I have a separate scanner which works better than the combined devices.

Brother HL-1212W laser Wifi printer
If you are looking for a new printer consider buying via the affiliate link to support this blog

In the end I decided to buy the HL-1212W model from Brother after reading a lot of good reviews and recommendations for the company. With around 25x35x20cm the printer easily fits into my shelf and only needs power nearby. It is connected to my network via Wifi. It only prints in black but that is enough for me most of the time.

The setup

Most printers can be directly connected to a computer but I was looking for a network printer to avoid the cables and to be able to print from other devices (like my smartphone) too. The setup was a bit more complicated than expected though as the device has no screen and can therefore not be setup independently.

Instead I had to connect it via USB (a USB B connector cable that was not included) to a laptop and use that to provide the access details for my Wifi network. I do not know why there was no simple setup method available via App or why setup via my PC did not work (it has no Wifi so the setup was stuck).

I should also add that the printer only work with 2.4Ghz Wifi and I was not able to connect it to my IOT Wifi. It worked with the normal one though. If your router supports WPS you can also use that for a simpler setup but my prosumer Unifi setup unfortunately does not support it because of the security issues.

After the setup was done the printer was working very well though. Windows found the printer automatically without any additional driver installation. Printing is pretty fast and the results look good. There is also no smearing that sometimes happened to me with the old ink based printers.

Integrating a printer with Home Assistant

Integrating printers with Home Assistant is pretty simple and works with most models. Usually you will be able to see some data about your printer and can use it as any other data to plot graphs or create automations. You can either go with the generic IPP protocol or use an integration for certain printer manufacturers.

Generic solution via IPP

The Internet Printing Protocol IPP is supported by most modern printers and has its own integration for Home Assistant. Just install that and it should automatically find your network printer. You should be to see ink levels in Home Assistant afterwards. I have used this for my old ink based printer and it worked very well. You can see the ink levels in my old Grafana dashboard as described here.

There is also another generic solution via CUPS but I have not used that myself.#

Via Brother printer integration

For some manufacturers there are specialized integrations and Brother is one of them. As I am using the HL-1212W from Brother I just installed the Brother integration. You might need to enable SNMP in the printers web interface according to the integration manual but in my case it was already enabled by default.

SNMP needs to be enabled for the integration

Afterwards the integration will automatically detect the printer. Just give it a proper name and a couple of new values should show up in your default dashboard. In my case those are a page counter, remaining toner and drum life and the general printer status.

integrating a printer with home assistant is done - showing status, page counter and remaining toner
Status values for my printer

Showing the values in Grafana

Having these values in the Home Assistant UI is nice but I prefer another program for a quick overview about my smart home: Grafana. If you follow my Grafana and InfluxDB setup guide and/or use my smart home server you already have all you need to see the printer data in Grafana.

Basically the guide will show you how to push data from Home Assistant to InfluxDB (I push all sensor data and the printer values are sensors) and use Grafana to view that data.

Printer data in my Grafana dashboard

I simply added two new counters to my dashboard to show the remaining toner and how many pages I have printed already. Of course you can also choose any other visualization like graphs and you can also directly integrate single graphs and full dashboard into your Home Assistant UI. The setup is quite simple.

Building automations

Last but not least you can also build any automation you might need based on the printer. For example you could signal the end of a print by flashing your lights. I chose to go with a simple but useful automation for now: an alert to my phone once the toner has reached less than 10%.

For the push notification I used Pushover as described here. The automation itself looks like this:

alias: Alert when printer toner is low
description: Sending push notification when the printer toner is under 10%
trigger:
  - type: value
    platform: device
    device_id: abcdefghi123
    entity_id: sensor.hl_1210w_black_toner_remaining
    domain: sensor
    below: 10
condition: []
action:
  - service: notify.pushover
    data:
      message: Printer toner is under 10%
      title: Toner level low
      data:
        priority: -1
mode: single

It will send a message to my phone that shows up but does not vibrate as this is not really critical.

Conclusion

Overall this is pretty neat in my opinion. Nothing groundbreaking but again using smart home technology you can make more out of hardware you already own anyways by integrating and connecting it.

This was about plain old 2D printers but I also 3D print from time to time. Home Assistant also offers great integrations for those, more about that in the future!

Categories: HomeAssistant