Netatmo PHP Widget

Download Version 0.5.6

Overview

Netatmo is a weather station quickly presented here.

I wrote a web widget in PHP to display weather information of several locations and modules. I put it in my Mac OS X Dashboard via Safari and works like a charm.

Post all requests, new features, bug and more in the GitHub repository. You can find additional informations in this forum.

Live Demo

Take a look on the sideshow above !

These are 3 weather stations attached to my Netatmo account :

  • Home location
  • TCPCode location (at the office)
  • Digne location (merry christmas dad !)

Installation

  1. Grab the code on GitHub
  2. Just put your credentials on top of file config.inc.php
  3. Launch index.php in your favorite web browser

If APC is enabled on your web server, weather station informations will be cached in order to call the Netatmo API no more than one time every five minutes.

Options

You can call :

  1. index.php in a web browser. The widget will display all weather stations attached to your Netatmo account.
  2. index.php?n=stationname in a web browser. The widget will display only the selected weather station with parameter  n
  3. index.php?cc=whatever in a web browser to delete cache informations and force the widget to fetch weather station informations from the Netatmo API.
  4. index.php?l=fr_FR to display informations in french for example.
  5. index.php?nu=USER_EMAIL&np=USER_PASS&nc=APP_CLIENT_ID&ns=APP_CLIENT_SECRET to display informations of a specific app and user.
  6. index.php?u=1 to display temperature informations in Fahrenheit. Use 0 for Celcius.
  7. index.php?up=1 to display atmospheric pressure in inHg. Use 0 for mbar.
  8. index.php?up=2 to display atmospheric pressure in mmHg. Use 0 for mbar.
  9. index.php?do=TemperatureMin, TemperatureMax, PressureMin, Pressure, PressureMax, NoiseMin, Noise, NoiseMax, HumidityMin, Humidity, HumidityMax, CO2 to select and manage order elements of the inner Device station.
  10. index.php?mo=TemperatureMin, TemperatureMax, HumidityMin, Humidity, HumidityMax, CO2, Rain, RainSum to select and manage order elements of the external Module station.
  11. index.php?scd=1month to set scale for Min and Max value of the inner Device station. Accepted values are  1day, 1week, 1month.
  12. index.php?scm=1day to set scale for Min and Max value of the external Module station. Accepted values are 1day, 1week, 1month. If not set, scd value will be used.
  13. index.php?mm=1 to display date for minimal and maximal values.

Remote access

Remote access by sending your accounting informations in GET url is disabled by default.

You can enable this feature by setting the constant  ALLOW_REMOTE_ACCOUNTING in file config.inc.php to true :

define( 'ALLOW_REMOTE_ACCOUNTING' , true );

Supported locales

The widget can be displayed in your tongue :

  1. It first takes a look on your browser language.
  2. Then constant WIDGET_LOCALE defined  in config.inc.php will take precedence.
  3. Then GET parameter l will take precedence.

You can contribute by translating the lang/messages.po file in your locale. Available languages are :

  • Dutsh - nl_NL  (by B.J. de Jong)
  • English - en_GB - en_US
  • French - fr_FR
  • German - de_DE (by Handyman1983)
  • Italian - it_IT (by Luca Volpone)
  • Polish - pl_PL (by Karol Zak)
  • Spanish - es_ES (by Andrew Kurtis @ WebHostingHub )

Supported units

The widget can display temperatures in Celcius or Fahrenheit :

  1. It first takes a look on your Netatmo user preferences.
  2. Then constant WIDGET_UNIT_METRIC defined  in config.inc.php will take precedence if defined.
  3. Then GET parameter u will take precedence.

This is the same thing for atmospheric pressures with constant WIDGET_UNIT_PRESSURE.

Change Log

Version 0.5
  • Enhancement : Add rain modules support
Version 0.4
  • Enhancement : Add user stylesheets customisation
  • Fix : display fixed when several modules
Version 0.3.2
  • Enhancement : best locale management for french and german
  • Enhancement : display min and max dates on a new line for large display
Version 0.3.1
  • Change : sc parameter becomes scd and sci parameter becomes scm
  • Bug fix : float temperatures instead of integer
  • Enhancement : scd and scm change cache informations
Version 0.3
  • New feature : Atmospheric pressure units
  • New feature : Choose what measure to display for inner and external sensors
  • Enhancement : White style
Version 0.2
  • New feature : Metric units

Licensing & Terms of use

This plugin is licensed under the GNU General Public License and is copyright 2012 potsky.

Special thanks

A special thanks goes out to Netatmo and their fabulous API !