Skip to content

Instantly share code, notes, and snippets.

@lambdan
Last active February 12, 2022 11:10
Show Gist options
  • Save lambdan/e0b7d24ec997482bc9eacd5726984a75 to your computer and use it in GitHub Desktop.
Save lambdan/e0b7d24ec997482bc9eacd5726984a75 to your computer and use it in GitHub Desktop.
Dump netatmo JSON to terminal
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