Python3 API for the Netatmo Weather Station
Reason this release was yanked:
no longer functional due to Netatmo changes to authentication
Project description
netatmo.py
Python 3 API to retrieve data from the Netatmo connected weather station.
The library implements the authentication, the token refresh and the both weather station methods Getstationdata and Getmeasure.
Although Netatmo provides samples written in Python, this library provides - I hope! - more high level methods to access the data.
Installation
The easiest way to install the library is using pip:
pip3 install netatmo
You can also download or clone the GitHub repository and install the module:
cd /path/to/repo
python3 setup.py install
Finally, you may get the netatmo.py source file and use it in your projects.
Requirements
- Python 3 (sorry if you live in legacy)
- The requests 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 (see Create your app)
Command-line usage
Help
netatmo -h
netatmo <command> -h
where <command>
can be one of these keywords: config
, fetch
, list
, test
, dump
.
Credentials
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 the config
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 config
Read config
username: user@mail
password: password
client_id: 1234567890abcdef12345678
client_secret: ABCdefg123456hijklmn7890pqrs
default_station: 70:ee:50:xx:xx:xx
Display the authorized stations
netatmo list
Fetch data into CSV files
netatmo fetch
This command will write two CSV files, netatmo_station.csv
and netatmo_module.csv
. The most recent measures are appended to these files depending on the last timestamps.
Other commands and options
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.
Usage as a Python module
#! /usr/bin/env python3
import netatmo
# fetch data using ~/.netatmorc credentials
netatmo.fetch()
# credentials as parameters
ws = 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)
License and warranty
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.
Notes
Other Netatmo devices
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. See Netatmo Connect APIs.
Installation on a Synology NAS
Synology provides a Python 3 package that lacks the requests 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 use Anaconda as Python3 distribution.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file netatmo-1.0.7.tar.gz
.
File metadata
- Download URL: netatmo-1.0.7.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fec0474ebe96c7ee469fe26d066c8f7fb3d06826e3dee4c9d2b9b0bc5eb20a66 |
|
MD5 | 0d6959610c4122bbe832bc7906cc1d0f |
|
BLAKE2b-256 | ee83ccb23b89b4bcab8a29c8346c0bb523fa741ca2115316ad75545e1c4537b5 |
File details
Details for the file netatmo-1.0.7-py3.8.egg
.
File metadata
- Download URL: netatmo-1.0.7-py3.8.egg
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57b2e76f730c40220fe8dcfe7818263e3099b2e61a1838a55ce8a04304a80a4a |
|
MD5 | 0606e1fdacc1f1a8a02d43d157f7555b |
|
BLAKE2b-256 | db12e7a219ac040798a408c3abb7ee3fef3173d8af41c7838e916f94e722d7f9 |
File details
Details for the file netatmo-1.0.7-py3.7.egg
.
File metadata
- Download URL: netatmo-1.0.7-py3.7.egg
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b95d0ae26b6a11e1f7b482aff242dcbb1cc6e3042bab8bf1e7b54803640eefc |
|
MD5 | f7cddf8f088603c994025167c8e22e49 |
|
BLAKE2b-256 | 491a2daf632fd8f3cf37bc84fdd448990b918eac8955da01fba1c5b7d0305ba9 |
File details
Details for the file netatmo-1.0.7-py3.6.egg
.
File metadata
- Download URL: netatmo-1.0.7-py3.6.egg
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1dfc80a57635f27dfed95aed5dc30af7d7e8810cc3cbdeac87ef7026aa47db10 |
|
MD5 | e992b303e951e4d2cd6bc187a81184ee |
|
BLAKE2b-256 | b49ef217f5e3dd40bd7530e13b1ad5f0ba67cb0c3974c10924c2b3f9bedb97be |
File details
Details for the file netatmo-1.0.7-py3-none-any.whl
.
File metadata
- Download URL: netatmo-1.0.7-py3-none-any.whl
- Upload date:
- Size: 11.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1dbbb318ff74c51a50205c9e2599de0c1229b6a4a57303623be003008328af3d |
|
MD5 | a2544cd879f9ae4325ca028c358456d4 |
|
BLAKE2b-256 | b6e2b9034954de0ee0e918c53c4937928c28c4436468c95180366598cf30238f |