A simple Netatmo Client written in Python, useful for accessing the data from embedded devices (Arduino Yún).
Python
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
README.md
netatmo-client.py

README.md

Netatmo Python Client

A simple Netatmo Client written in Python, useful for accessing the data from embedded devices (Arduino Yún).

The current Indoor/Outdoor Temperature, Pressure and CO2 concentration are currently included in the output.

Project goal

The main goal of this project was to create a self-contained python 2.x script not having any dependencies on external python-libraries like e.g. python-oauth2 or httplib2 - these libraries being quite huge for a tiny embedded device like the Arduino Yún, where there are only <10MB available for external libraries.

###Prerequisites

Setup

Deploy netatmo-client.py

Just copy the netatmo-client.py script to a directory of your choice on the target server. (e.g. /opt):

wget --no-check-certificate https://raw.githubusercontent.com/remuslazar/netatmo-python/master/netatmo-client.py

Make also sure that this directory is writable for the user you want to run this script as, because a runtime database will be created in that directory on runtime.

Edit/Create netatmo.conf

Create a Netatmo Developer Account and save the autogenerated Client id/secret in a file named "netatmo.conf" in the same folder where the netatmo-client.py is located.

[api]
client_id = MY_CLIENT_ID
client_secret = MY_CLIENT_SECRET

Initial run

While running this script for the first time, the Netatmo-Credentials (Username/Password) will be requested.

The credentials are used to request an access token, which is saved in a local runtime database for all future requests.

Examples

Human Readable Text-Output

$ ./netatmo-client.py
Indoor: 23.7°C (45%, 1023mbar, 1163ppm CO2), outdoor: 6.7°C (46%)

CSV-Output

$ ./netatmo-client.py -c
23.7;45;1023.2;1163;6.7;46

Debug Output

$ ./netatmo-client.py -d
"body": {
    "modules": [
      {
        "_id": "02:00:00:00:d8:0a",
        "main_device": "70:ee:50:00:d5:d6",
        "module_name": "Au\u00dfen",
        "type": "NAModule1",
        "firmware": 42,
        "last_message": 1421099053,
        "last_seen": 1421099008,
        "rf_status": 90,
        "battery_vp": 5067,
        "dashboard_data": {
          "time_utc": 1421099008,
          "Temperature": 6.8,
          "Humidity": 43,
          "date_max_temp": 1421066816,
          "date_min_temp": 1421033650,
          "min_temp": 3.1,
          "max_temp": 7.4
        },
        "data_type": [
          "Temperature",
          "Humidity"
        ]
      }
    ],
    "devices": [
      {
        "_id": "70:ee:50:00:d5:d6",
        "access_code": "VWcmmZlG7RGB",
        "alarm_config": {
          "default_alarm": [
            {
              "db_alarm_number": 0,
              "desactivated": true
            },
            {
              "db_alarm_number": 1
            },
            {
              "db_alarm_number": 2
            },
            {
              "db_alarm_number": 6
            },
            {
              "db_alarm_number": 4,
              "desactivated": true
            },
            {
              "db_alarm_number": 5
            },
            {
              "db_alarm_number": 7
            }
          ],
          "personnalized": [

          ]
        },
        "battery_vp": 0,
        "cipher_id": "enc:16:jPjfCcN+6bQNTLyafypbCnqaZL9zzqXOD5qojqlpZCveXtSvLFicA84bTeiE9S0h",
        "co2_calibrating": false,
        "date_setup": {
          "sec": 1369817870,
          "usec": 757000
        },
        "firmware": 98,
        "friend_users": [
          "51a5fb7318775961c3000011",
          "5297444418775901147b25dd"
        ],
        "invitation_disable": false,
        "last_status_store": 1421099063,
        "meteo_alarms": [

        ],
        "module_name": "Innen",
        "modules": [
          "02:00:00:00:d8:0a"
        ],
        "place": {
          "altitude": 439.001923,
          "bssid": "70:73:cb:b5:50:d3",
          "country": "DE",
          "geoip_city": "Filderstadt",
          "location": [
            9.119375,
            48.729682
          ],
          "meteoalarm_area": "Baden-W\u00fcrttemberg",
          "timezone": "Europe\/Berlin"
        },
        "public_ext_data": true,
        "service": {
          "meteo_alarm": false
        },
        "station_name": "Spitalackerweg",
        "type": "NAMain",
        "user_owner": [
          "51a5c22418775984ab000009"
        ],
        "wifi_status": 56,
        "dashboard_data": {
          "AbsolutePressure": 970.8,
          "time_utc": 1421099048,
          "Noise": 63,
          "Temperature": 23.7,
          "Humidity": 46,
          "Pressure": 1022.9,
          "CO2": 1298,
          "date_max_temp": 1421067426,
          "date_min_temp": 1421082497,
          "min_temp": 22.1,
          "max_temp": 24.3
        },
        "data_type": [
          "Temperature",
          "Co2",
          "Humidity",
          "Noise",
          "Pressure"
        ]
      }
    ]
}