[FR] Keep track of power usage during a print

I was thinking that since Klipper knows when it heats the bed and hot end, could it reasonably estimate the amount of power consumed in running a print? If so this would be a useful addition to the print history. Some additional factors such as the power consumption of the MCU, Raspberry Pi and steppers would also have to be calculated in.

If you run Klipper on OctoPrint you could use this plugin:

Thanks, but I’m actually a FLUIDD/Moonraker user.

I have the same request, I’d like to add to this:

I think it should be displayed just as filament usage (in moonraker), during the actual printing, but also in the print history.
Possible implementations to get the data:

-A smart plug with energy metering that is being sent a request to
-Support for an ammeter that is connected inside the printer between the psu and the mainboard’s power input. The device would use a simple shunt resistor with an opamp-clamping circuit, relaying the information to an adc pin of the mcu, or a hall-effect sensor based approach.
-Software only. This would be based on estimates with initial calibration and the implementation would be fairly low level. Klipper knows the voltage the system is running add, the duty cycle of the heaters and fans, and also the current and usage of the motors. Initial calibration would require specifying heater, bed, and fan resistance and a baseline power consumption for other accessories like the mainboard itself.

Why would I like to have this? To optimize power consumption and display costs. I noticed I have prints where energy cost is minuscule compared to the cost of the filament used, but I also have prints, especially minis, where the energy cost makes up pretty much the entire cost of the print.
I’m sure print farms would be interested in a build-in implementation of this as well for optimization and pricing.

Since print farms are using free OSS software for commercial purposes, it would only be right to be a contributor or sponsor of such a requirement.

I think this is a task for the frontends Fluidd and Mainsail.