Last active
February 12, 2022 11:10
-
-
Save lambdan/e0b7d24ec997482bc9eacd5726984a75 to your computer and use it in GitHub Desktop.
Dump netatmo JSON to terminal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import netatmo, json, sys | |
if len(sys.argv) < 5: | |
# get clientid/secret from here https://dev.netatmo.com/apps/ | |
print("usage: script.py clientid clientsecret username password") | |
sys.exit(1) | |
ws = netatmo.WeatherStation( { | |
'client_id': sys.argv[1], | |
'client_secret': sys.argv[2], | |
'username': sys.argv[3], | |
'password': sys.argv[4] | |
} | |
) | |
ws.get_data() | |
json_output = "" | |
for d in ws.devices: | |
j = json.dumps(d, indent=4, ensure_ascii=False) | |
json_output += j | |
print(json_output) | |
sys.exit(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment