Hello! I have this possibly far fetched suggestion that would get the cost of electricity from an API instead of manually inputing it in the settings.
Specially now that in Europe electricity costs vary so wildly between hours (for instance here in Spain, price can vary more than 150% from the cheapest to the most expensive hour).
The main problem is that every API is different and that would be very complicated for the plugin to parse. One solution would to use a system command like curl and parse it there. Of course that would be the job of the user.
It could even be possible to show which is the cheapest hour to print, or many other things depending on what the API publishes.
Another problem is that the user would have to find the API link on its own, but that's entirely the user's problem. 😈
A partial solution to both problems would be to add a Wiki to this project to list publicly available endpoints that users find and the parsing settings they created. The user would have to open an issue listing the URI and parsing used for it to be added to that wiki.
Then I do curl -s -H "Content-Type: application/json" https://api.preciodelaluz.org/v1/prices/now?zone=PCB | jq --raw-output '.price'/1000 to get the cost in €/Kwh and that would be fed into the cost estimator.
I had to install jq with apt, so that's something to consider.
Hello! I have this possibly far fetched suggestion that would get the cost of electricity from an API instead of manually inputing it in the settings. Specially now that in Europe electricity costs vary so wildly between hours (for instance here in Spain, price can vary more than 150% from the cheapest to the most expensive hour).
The main problem is that every API is different and that would be very complicated for the plugin to parse. One solution would to use a system command like
curl
and parse it there. Of course that would be the job of the user. It could even be possible to show which is the cheapest hour to print, or many other things depending on what the API publishes.Another problem is that the user would have to find the API link on its own, but that's entirely the user's problem. 😈
A partial solution to both problems would be to add a Wiki to this project to list publicly available endpoints that users find and the parsing settings they created. The user would have to open an issue listing the URI and parsing used for it to be added to that wiki.
Example:
For my use case I'd call precidelaluz.org's API that gives me the current price in €/Mwh: https://api.preciodelaluz.org/v1/prices/now?zone=PCB
Then I do
curl -s -H "Content-Type: application/json" https://api.preciodelaluz.org/v1/prices/now?zone=PCB | jq --raw-output '.price'/1000
to get the cost in €/Kwh and that would be fed into the cost estimator.I had to install
jq
withapt
, so that's something to consider.