You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,8 @@ I am trying to make this library survive to continuous Netatmo changes but their
13
13
14
14
>NEW MAJOR BREAKING CHANGE (december 2023): Web generated refresh_tokens are no more long lived tokens, they will be automatically refreshed. Consequences : No more static authentication in the library source and ~/.netatmo-credentials file will be updated to reflect change in the refresh token. This file MUST be writable and if you run Netatmo tools in container, remember to persist this file between container run. **This new token policy will completely forbid you to use your credentials on two or more systems if you can't share the .netatmo-credentials file**.
15
15
16
+
There is no longer credential load at library import, credentials are loaded at `ClientAuth` class initialization and a new parameter `credentialFile` allow to specify private name and location for the credential file.
Copy file name to clipboardExpand all lines: usage.md
+19-11Lines changed: 19 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,8 @@ Python Netatmo API programmers guide
19
19
20
20
>2023-12-04, New update to Netatmo authentication rules, no longer long lived refresh token -> credentials MUST be writable, Hard coding credentials in the library no longer possible (bad luck for small home automation device)
21
21
22
+
>2024-01-03, New authentication method priorities, credential file as a parameter
23
+
22
24
No additional library other than standard Python library is required.
23
25
24
26
Both Python V2.7x and V3.x.x are supported without change.
@@ -50,31 +52,36 @@ Copy the lnetatmo.py file in your work directory (or use pip install lnetatmo).
50
52
51
53
Authentication data can be supplied with 3 different methods (each method override any settings of previous methods) :
52
54
53
-
1. Some or all values can stored in ~/.netatmo.credentials (in your platform home directory) file containing the keys in JSON format
55
+
1. Some or all values can be defined by explicit call to initializer of ClientAuth class
56
+
57
+
̀```bash
58
+
# Example: REFRESH_TOKEN supposed to be defined by an other method
2. Some or all values can stored in ~/.netatmo.credentials (in your platform home directory) or a file path specified using the ̀`credentialFile` parameter. The file containing the keys in JSON format
54
64
65
+
̀̀```bash
55
66
$ cat .netatmo.credentials # Here all values are defined but it is not mandatory
56
67
{
57
68
"CLIENT_ID" : "`xxx",
58
69
"CLIENT_SECRET" : "xxx",
59
70
"REFRESH_TOKEN" : "xxx"
60
71
}
61
72
$
73
+
̀̀```
62
74
63
-
> Due to Netatmo continuous changes, this method is the only one available for production use as the refresh token will be frequently refreshed and this file MUST be writable by the library to keep a usable refresh token.
64
-
65
-
2. Some or all values can be overriden by environment variables. This is the easiest method if your are packaging your application with Docker. It also allow you to do some testing with other accounts without touching your current ~/.netatmo.credentials file
75
+
3. Some or all values can be overriden by environment variables. This is the easiest method if your are packaging your application with Docker.
66
76
77
+
̀̀```bash
67
78
$ export REFRESH_TOKEN="yyy"
68
79
$ python3 MyCodeUsingLnetatmo.py
69
-
...
80
+
̀̀```
70
81
71
-
3. Some or all values can be overriden by explicit call to initializer of ClientAuth class
72
-
73
-
# Example: REFRESH_TOKEN supposed to be defined by one of the previous methods
> Due to Netatmo continuous changes, the credential file is the recommended method for production use as the refresh token will be frequently refreshed and this file MUST be writable by the library to keep a usable refresh token. You can also recover the `authorization.refreshToken` before your program termination and save it to be able to pass it back when your program restart.
76
83
77
-
If you provide all the values, using any method or mix except 3, you can test that everything is working properly by simply running the package as a standalone program.
84
+
If you provide all the values in a credential file, you can test that everything is working properly by simply running the package as a standalone program.
78
85
79
86
This will run a full access test to the account and stations and return 0 as return code if everything works well. If run interactively, it will also display an OK message.
0 commit comments