Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
OllisGit opened this issue Apr 14, 2018 · 10 comments
Open

Comments

@OllisGit
Copy link

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
Copy link
Owner

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
Copy link
Author

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 OllisGit/OctoPrint-DisplayLayerProgress#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
Copy link
Owner

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 😉

@OllisGit
Copy link
Author

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

BR
Olli

@malnvenshorn
Copy link
Owner

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:

  • wait for the print done event
  • request the power usage for the print time
  • save the power usage to the metadata, like OctoPrint does it with the print time
  • use that value for future cost estimations

@OllisGit
Copy link
Author

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
Copy link
Owner

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

@jneilliii
Copy link

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

@OllisGit
Copy link
Author

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.

  • via the plugin-manager I am picking up the plugin-implementation
  • direct calling of the methods
    For my own plugins I define a method-naming pattern (each public methode start with api_.
    So, if the PrintJobHistory-Plugin wants to read spool values, it looks like this:
if (self._isSpoolManagerPluginInstalledAndEnabled()):
  spoolValues = spoolManagerImplementation.api_readSpoolValues()

@jneilliii
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants