- Notifications
You must be signed in to change notification settings - Fork18
Python3 API for the Netatmo Weather Station
License
rene-d/netatmo
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Important: due to changes made by Netatmo to authentication, this project is no longer functional and will not be updated.
Please fork it and update it, or use another library, likenetatmo-api-python.
Original README follows...
Python 3 API to retrieve data from the Netatmo connectedweather station.
The library implements theauthentication, thetoken refresh and the both weather station methodsGetstationdata andGetmeasure.
Although Netatmo providessamples written in Python, this library provides - I hope! - more high level methods to access the data.
The easiest way to install the library is usingpip:
pip3 install netatmo
You can also download or clone the GitHub repository and install the module:
cd /path/to/repopython3 setup.py install
Finally, you may get thenetatmo.py source file and use it in your projects.
- Python 3 (sorry if you live inlegacy)
- Therequests module (should be included in any decent Python distribution)
- A valid Netatmo account with at least one weather station
- A client_id / client_secret pair from Netatmo developper program (seeCreate your app)
netatmo -hnetatmo<command> -h
where<command>
can be one of these keywords:config
,fetch
,list
,test
,dump
.
The library reads the username/password and client id/secret from a .rc file. By default, it is ~/.netatmorc. It could be edited by hand, or written by the library with theconfig
command.
netatmo config -u user@mail -p password -i client_id -s client_secret -d 70:ee:50:xx:xx:xx
Without any option,config
only prints the current configuration.
$ netatmo configRead configusername: user@mailpassword: passwordclient_id: 1234567890abcdef12345678client_secret: ABCdefg123456hijklmn7890pqrsdefault_station: 70:ee:50:xx:xx:xx
netatmo list
netatmo fetch
This command will write two CSV files,netatmo_station.csv
andnetatmo_module.csv
. The most recent measures are appended to these files depending on the last timestamps.
test
tests the connection. On success, exit code is zero. On failure, non zero, like any shell command.
dump
displays more data from the weather station.
Each option-v
increases the verbosity. The option-c
can be use to use an alternate configuration file.
Both-v
and-c
have to be placed before the command.
#! /usr/bin/env python3importnetatmo# fetch data using ~/.netatmorc credentialsnetatmo.fetch()# credentials as parametersws=netatmo.WeatherStation( {'client_id':'1234567890abcdef12345678','client_secret':'ABCdefg123456hijklmn7890pqrs','username':'user@mail','password':'password','device':'70:ee:50:XX:XX:XX' } )ws.get_data()print(ws.devices)
None and none.
It is NOT an official software from Netatmo and it is not endorsed or supported by this company.
This library has been written as a personal work. Feel free to improve or adapt it to your own needs.
This library has been tested only with the weather station and its interior module. I don't know if it works well with the windgauge or the pluviometer. Other devices are unsupported, but their methods could be easily added. SeeNetatmo Connect APIs.
Synology provides a Python 3 package that lacks therequests module. Here is an simple download method, without git, pip or setup.py:
curl -sL https://api.github.com/repos/kennethreitz/requests/tarball/v2.20.0| tar -xzf - --strip-components=1 --wildcards'*/requests'
Alternately, you can useAnaconda as Python3 distribution.
About
Python3 API for the Netatmo Weather Station