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

Remove @requires_credentials decorator #61

Closed
wants to merge 8 commits into from

Conversation

epenet
Copy link
Contributor

@epenet epenet commented May 11, 2020

This is a fix for issue #10

marcnesello and others added 3 commits April 29, 2020 19:55
It looks like the Renault API is inconsistent in reporting chargingInstantaneousPower.
The CLI assumes that it is reported as Watt, but in my case it is reported as kiloWatt.
The result is that the value for Charge Rate is to small by the factor 1000.

Therefore I added a new cli argument --kw for the status command which interprets chargingInstantaneousPower as kW.
The default behaviour without --km argument the same as the current behaviour.
@jamesremuscat
Copy link
Owner

I'm not sure that removing the decorator was the desired outcome of #10, only that it would use the credentials store from the object it's being used within.

I'm willing to hear the argument for removing it wholesale, though?

@epenet
Copy link
Contributor Author

epenet commented Jun 1, 2020

The decorator only works when there is a "singleton" credential store.

For example, if you create a custom store, add the credentials to that store, then run the code with the decorator, then the decorator will generator a new singleton, find if empty and reject the method.

I couldn't find a way to access the custom store rather than the singleton from the requires_credentials method.

If you have a way for the decorator to use the "local" CredentialStore instead of the "global/singleton" CredentialStore then that's great...

@epenet
Copy link
Contributor Author

epenet commented Jun 2, 2020

Hi @jamesremuscat
I've managed to get access to the Kamereon/Gygia/Vehicle parent object from within the decorator, so I've created a new PR #68

@epenet epenet closed this Jun 2, 2020
@epenet epenet deleted the Credential-check branch June 2, 2020 14:20
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

Successfully merging this pull request may close these issues.

3 participants