Power Usage Logging


#1

I was thinking about how we have a plugin that tracks filament used, and run time. So, why not add power logging into the mix?

Of course, this wouldn't just be a "simple" coding feature. It would require some external hardware as well. Which comes with its own set of problems.

So, why not just use a plug based power monitor? Well, it is mostly just nice to have all of the data at your finger tips. Just think about the possibility of tracking exactly how much power usage there is for each print. You could provide far better pricing per a print, or simply see exactly how much power you are using for each print.

Though, honestly, I just love having more data. So I would enjoy having one more set of data to look at. There can be practical uses for it, but that is secondary. Thoughts, feelings, suggestions?


#2

Some people have requested that I incorporate that data into my TPLink-Smartplug and Tasmota Plugins. Just haven't had the time to do it.


#3

That would be really cool! No worries, life tends to get busy. Considering that it is something you are not getting paid for, you have every right to focus on other things. :slight_smile:

If possible, it would be great to see this kind of functionality added to your plugin! At your leisure of course. :slight_smile:

After looking into your plugin, another thought comes to mind. Would it be possible to have something like a smoke alarm connected to the Pi, which would trigger an emergency power off?
I know this is a little jaunt off of the original suggestion, but it has just been on my mind a bit. Since printer fires are a possibility.


#4

I use a "Sonoff POW" Switch (<10€) to remotely turn on my printer and also for a automatic safe shutdown of printer plus raspi after print. Works pretty good!
The next step is to use the measuring feature and put this to the CostEstimation Plugin.

But at the moment I am thinking about the best implementation-strategy (mqtt vs. rest)...so it could take some time.

Do you have an other "measuring-device" in mind?

BR
Olli


#5

There is a plugin that handles power statistics, its at the bottom https://plugins.octoprint.org/plugins/stats/


#6

That plugin estimates the power usage. This thread is talking about incorporating hardware that will measure the power usage. If they get something working, it will be interesting to compare the two methods.


#7

@OllisGit Use the MQTT protocol. It is more lightweight and you can subscribe to topics. With REST you have more overhead and you have to poll the data.


#8

Hey there,

we are using two different printers each one with a Sonoff POW and a Octopi. For us it would be also helpfull to switch an unmodified Sonoff with the Octoprint software.
The Sonoff switches the Printer and the Raspberry. It would be great if you can say "set Sonoff Timer 5 Minutes then shut off" and "shut down Raspberry". So you have a save shutdown for the Raspberry and the extruder can cool off before shutdown.

It would be great if this feature is coming one day. The Fanbase of Sonoff devices are also growing.

Greetings and a nice Day
HS-Drucke


#9

I've actually got a TP-Link HS100 (Smart Plug) on my 3D printer. Let's see what we can get from that:

From the tplink-smarthome-api repository's code's getSysInfo() method...

{ err_code: 0,
  sw_ver: '1.2.5 Build 171129 Rel.174814',
  hw_ver: '1.0',
  type: 'IOT.SMARTPLUGSWITCH',
  model: 'HS100(US)',
  mac: '50:C7:BF:00:00:00',
  deviceId: '80069AD7319B764961265EE8--REDACTED--435A',
  hwId: '5EACBE93FB9--REDACTED--ADE6DDE11',
  fwId: '00000000000000000000000000000000',
  oemId: '37589AA1F5C--REDACTED--7760127E5',
  alias: 'my 3D printer',
  dev_name: 'Wi-Fi Smart Plug',
  icon_hash: '',  relay_state: 1,  on_time: 4177,  active_mode: 'none',
  feature: 'TIM',  updating: 0,  rssi: -33,  led_off: 0,
  latitude: 32.717157,  longitude: -117.138388 }

Calling the emeter.getmonthstats() method seems to be throwing...

  response: { err_code: -1, err_msg: 'module not support' } }

So maybe the power monitoring is in other products. I'll do a little research on this one.


#10

The HS110 is the model that has power monitoring. The lastest version of the TPLink-Smartplug plugin does now support the display of the emeter data. Eventually I will look into logging that data by print/gcode file name. Was wondering if any developers here know right away if there is a way to extend the metadata of the file list? Seems like that would make the most sense to add to rather than keeping an entirely separate db mechanism.


#11

I bought the HS110, btw. I was able to pull in the power-related information. This is JavaScript.

const { Client } = require('tplink-smarthome-api');

const client = new Client();
// https://github.com/plasticrake/tplink-smarthome-api
var fPricePerKWH = 0.16;
var fChargePerKWH = fPricePerKWH * 3;
function calculateCost(jsonPower) {
  console.log('$' +
    (jsonPower.power * fChargePerKWH).toFixed(2).toString()
    );
}
// Look for devices, log to console, and turn them on
client.startDiscovery().on('device-new', (device) => {
  if (device.model == 'HS110(US)') {
    //console.log('Found');
    device.emeter.getRealtime().then(calculateCost);
  }
});

#12

Nice, basically the same thing I'm doing now. What I found interesting is that the US model returns the data in a different way then the EU models, involving additional math in the situation when supporting both.


#13

My perma-vaporware Pi addon sniffs how much power is coming in (as 12-26v) and observes power usage there. As a subset I have the output of the bucket circuit. That'll tell us what a Pi is using at 'idle', among other things.


#14

I've got a killer app based around that thing. I just don't have any time these days.