Sending 3D Printer Notifications with Home Assistant
September 10, 2022This is one of those projects that's so obvious in hindsight that I have no idea why I did not set it up years earlier. But let's take a step back ... what is this about?
The Problem
I already blogged about my 3D printing obession in the past and also about the frustration that comes with it from time to time when prints go sideways.
For that reason I upgraded my 3D printer with an attached camera and a WIFI power socket so I can check my prints remotely and even turn off the printer if something has gone wrong.

Note: I'm aware of solutions like OctoPrint for remotely monitoring 3D printers, but my model (a Flashforge Creator Pro) is unfortunately a closed-source device and there's no useful OctoPrint integration. This is why I have to come up with these custom solutions.
But in addition to that, wouldn't it be just nice if my printer could just send me a notification as soon as a print was finished?
Well, it turns out I had all the components in place for that:
- A WIFI socket that reports power consumption.
- A Home Assistant installation.
The Solution
So by simply monitoring the power consumption of my 3D printer, I can tell in which of those states it is:
OffIdlePrinting

Those states can than be modelled in Home Assistant's configuration.yaml file:
input_select:
3dprinter_status:
name: 3D Printer
options:
- "Off"
- "Idle"
- "Printing"
initial: "Off"
Then, in automations.yaml I created a few simple rules:
- If power consumption is between 1 and 20 watts and the current state is
Off, it goes into theIdlestate.
- alias: Set 3D Printer state to Idle when turned on
trigger:
- platform: numeric_state
entity_id: sensor.3d_drucker_current_consumption
above: 1
- platform: numeric_state
entity_id: sensor.3d_drucker_current_consumption
below: 20
condition:
- condition: state
entity_id: input_select.3dprinter_status
state: "Off"
action:
- service: input_select.select_option
data:
entity_id: input_select.3dprinter_status
option: Idle
- If the printer is
Idleand the power consumption falls below 2 watts, this means it isOffagain.
- alias: Set 3D Printer state to Off
trigger:
- platform: numeric_state
entity_id: sensor.3d_drucker_current_consumption
below: 2
condition:
- condition: state
entity_id: input_select.3dprinter_status
state: Idle
action:
- service: input_select.select_option
data:
entity_id: input_select.3dprinter_status
option: "Off"
- If the current state is
Idleand power consumption goes above 30 watts, this meansPrintinghas started.
- alias: Set 3D Printer state to printing when power detected
trigger:
- platform: numeric_state
entity_id: sensor.3d_drucker_current_consumption
above: 30
condition:
- condition: state
entity_id: input_select.3dprinter_status
state: Idle
action:
- service: input_select.select_option
data:
entity_id: input_select.3dprinter_status
option: Printing
- And most importantly, when the current state is
Printingand the consumption falls below 30 watts, we know that the print has finished, so the new state isIdleand we can send a notification.
- alias: Set 3D Printer state to Idle when done and send an alert
trigger:
- platform: numeric_state
entity_id: sensor.3d_drucker_current_consumption
below: 30
for:
minutes: 3
condition:
- condition: state
entity_id: input_select.3dprinter_status
state: Printing
action:
- service: input_select.select_option
data:
entity_id: input_select.3dprinter_status
option: Idle
- service: notify.mobile_app_iphone_von_wolfgang
data:
message: "The 3D Printer has finished printing."
title: "3D Printer"
Works like a charm!
