magico13 / PyEmVue

Python Library for the Emporia Vue Energy Monitor
MIT License
185 stars 36 forks source link

Write a Prometheus exporter using PyEmVue #43

Closed sbates130272 closed 1 year ago

sbates130272 commented 1 year ago

It would be very nice to take the metrics that PyEmVue can GET from the Emporia Vue cloud and present them for scraping via Prometheus. Someone may already have done this. If so, I would appreciate a link. Otherwise I can give this a shot or get someone to do it.

sbates130272 commented 1 year ago

I see someone has already done something similar for InfluxdB but I am more of a Prometheus person myself.

sbates130272 commented 1 year ago

So we have been working on this. @magico13 your feedback would be appreciated,

https://github.com/sbates130272/emvue-exporter/tree/dlsloan/start

Also @magico13 can you comment on the benfits of using the token-based login method? Is this faster than the username based method or less load on the API servers?

magico13 commented 1 year ago

can you comment on the benfits of using the token-based login method?

It's a standard system called OAuth2 used by most everything these days. Passing around a password is a good way to have that info stolen, so you use tokens instead. I definitely recommend looking into it more if you have any interest in security. Anyway, you need a token to prove your identity to the API, which you can either get from username and password or from some previous tokens. Ideally you take in the username and password to get the first tokens, then never store the password and use the tokens exclusively going forward. Then you never need to worry about leaking a password.

I can try to look through that repo to see if I've got any recommendations.

sbates130272 commented 1 year ago

Thanks @magico13. We will look into extending the exporter to support tokens. Any feedback you can add to that exporter would be appreciated.