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

updated Thermostat and Homecoach #90

Merged
merged 14 commits into from
Nov 23, 2024
Merged

Conversation

JurgenLB
Copy link
Contributor

This is to restore the old behavior for the Thermostat.
Now the code search for a ID or Name for the Relaystation and than for the Thermostat module.

The valves are not accessible by the class Thermostat

This class is deprecated in the last API from Netatmo 

Most devices are in HomesData with HomeStatus
some rewrite for successful selftest
@JurgenLB
Copy link
Contributor Author

I have also changed HomeData.
This works for me with Self-test and a Test-script I have.
If you want me to change something, let me know

@JurgenLB
Copy link
Contributor Author

This will fix and close #88
I believe.

The thermostat is the Module and the Relay is the Bridge for the Thermostat and Valves are also Modules,
but the valves are not accessible by the Thermostat class, they are in HomesData/HomeStatus.

I think Netatmo is going to put all devices in HomesData/HomeStatus.

@philippelt
Copy link
Owner

Hello @JurgenLB ,

could you explain the following code:

if device.get('time_utc',limit+10) > limit :
    return {'When': ds, '_id': hid, }
else:
    return {'When': 0, 'id': hid}

In the else clause, the '_id' property has become 'id'. Is it a typo ?
In this case, you could simplify your code with

return { '_id': hid, 'When': ds if device.get('time_utc',limit+10) > limit else 0}

@JurgenLB
Copy link
Contributor Author

yes your correct, its a typo from me.
I will change this.

@philippelt
Copy link
Owner

Hello Jurgen,

you have done a very great job of refactoring.

I don't understand the benefit of saving the access_token considering that it will be discarded before any use (with expiration still forced) ?

@JurgenLB
Copy link
Contributor Author

JurgenLB commented Nov 19, 2024

When we generate a token in the portal from Netatmo.
We get a access_token and a refresh_token, now we only use the refresh_token to get a new access_token.
I was thinking is it not beter to use the generated access_token and only if that fails use the refresh_token.

So its only on the first run that the access_token is imported, after that it can be stored or only the key remains
also the access_token is short living so its important to use it quick after generating.
I do see that when I run this library with a correct refresh_token after
+/- 1u. the login gives error message for not correct anymore.
This is the reason I was looking to the authentication.
I think the refresh_token is longer than 1u. but the access_token can be expired after +/- 1u.

kind regards

Jurgen

@JurgenLB
Copy link
Contributor Author

maybe it is better to undo the changes off the Token and save that for an other time.

@philippelt
Copy link
Owner

I agree with you, until Netatmo allow longer lived access token, it is not necessary to save it in the credential file considering it will probably immediately be discarded on new authentication.

@philippelt philippelt changed the base branch from master to homecoach November 23, 2024 09:16
@philippelt philippelt merged commit caf8058 into philippelt:homecoach Nov 23, 2024
1 check passed
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.

2 participants