malnvenshorn / OctoPrint-CostEstimation

OctoPrint plugin to display the estimated print cost for the loaded model
GNU Affero General Public License v3.0
23 stars 19 forks source link

Idea: Connecting "Sonoff POW" (WiFi switch and measure power cunsumption) #11

Open OllisGit opened 6 years ago

OllisGit commented 6 years ago

I use a Sonoff POW for switching my Printer on/off. The module can also measure the power consumption and with the "right" firmware (Tasmota) you can collect the information via MQTT or REST APIs.

I think it is a cool idea to measure the "real"-power consumption and then calculate the price.

What do you thing?

Regards Olli

malnvenshorn commented 6 years ago

I agree that it would be great to measure the real power consumption and use those values to calculate the estimated cost. But the issue is that I don't have such hardware. Of course it would be possible if someone else would do the testing but it would be far from an ideal situation. This even gets worth when in comes to maintain the support for it. In the worst case it could be necessary to remove the feature again and this is something I don't want to do.

OllisGit commented 6 years ago

I totaly understand your concerns. I have the same problem with my plugin. I want to provide a feature which is not supported by my printers firmeware (see https://github.com/OllisGit/OctoPrint-DisplayLayerProgress/issues/20). Someone else needs to test it.

It's up to you: If you agree, I can impement and test it and than I will create a pull-request.

By the way you could buy the POW for under 10€ at banggood or aliexpress ;-)

Regards Olli

malnvenshorn commented 6 years ago

It's up to you: If you agree, I can impement and test it and than I will create a pull-request.

The issue with this is the same as before - I cannot test it. Therefore I probably won't accept a pull request. But feel free to fork this project and implement the feature yourself.

By the way you could buy the POW for under 10€ at banggood or aliexpress ;-)

Yes, but I cannot spend money every time someone wants to have a hardware specific feature implemented :wink:

OllisGit commented 6 years ago

Okay, thanks for your fast reply. I will take the "Fork-Task" on my todo-list

BR Olli

malnvenshorn commented 6 years ago

I took a look at the documentation of the Tasmota firmware, but it's to insufficient to implement this without having the real device.

If it helps I would implement it the following way:

OllisGit commented 6 years ago

Sounds good! How do you "request the power usage for the print time"..via MQTT or via REST-Call...or is it possible to define an "interface" that an other plugin could implement?

malnvenshorn commented 6 years ago

If you just use the EnergyReset command to request the power meter reading the simplest solution is to use REST API.

jneilliii commented 4 years ago

@OllisGit not sure if you knew but my Tasmota plugin (non-MQTT version) will log this power data on those devices...

OllisGit commented 3 years ago

Hi @jneilliii, I am cleaning up my backlog and found this entry...I looked into your plugin and on a "first look" I can't identify how I can grab such data. Is there an api or a "public" method where I can read such values?

I am not sure, maybe there is a mechanism in OP, but currently I use this approach to read data from an other plugin.

jneilliii commented 3 years ago

So my plugin has get_energy_data API command, that wil pull data from sqlite db in the plugin's data folder based on a date range.

https://github.com/jneilliii/OctoPrint-Tasmota/blob/e325c895c40469166519f971ce9a0ccc78952e79/octoprint_tasmota/__init__.py#L636-L663

The data itself is pulled from the Tasmota device here to insert into the database.