Table Of Content

Plugin rainhour

Purpose

The plugin allows you to display rain forecast from “Meteo France” for the next hour This service is available online here (Service only available for the cities of France):

http://www.meteofrance.com/previsions-meteo-france/previsions-pluie/lias

http://www.meteofrance.com/previsions-meteo-france/previsions-pluie/nancy/54000

_images/domoweb_Weather_Rainhour_8.png

This service gives the forecast chance of rain for the next hour with a precision of 5 minutes. Every 5 minutes, this forecast is updated.

For developpement, there is a API available to use the data provide (see dev page for information)

The cover of this service is not available on all cities because of reliefs, here is the coverage map “Météo France”:

_images/domoweb_Weather_Rainhour_9.png

The plugin display the data provided in the form of icons like this: With 5 cases of possible forecasts available in the “Meteo France” API :

  • No rain (value 1)
  • Light rain (value 2)
  • Moderate rain (value 3)
  • Heavy rain (value 4)
  • No data (value 0)
_images/domoweb_Weather_Rainhour_2.png

Dependencies

No dependencies needed

Plugin configuration

No configuration needed for the plugin

Create the domogik devices

Device parameters configuration

Two parameters are needed for a domogik device creation

Key Type Description
location DT_String ID “Meteo France” of the location
locationame DT_String Locaton Name (for displaying in widget)

Admin/Advanced page of the plugin can create the device with the location ID/Name with a search fonctionnality:

_images/domoweb_Weather_Rainhour_5.png

Just click on the link and you will be redirected to the device creation page with pre-filled parameters:

_images/domoweb_Weather_Rainhour_6.png

The plugin provided 2 sensors for use in a scenario:

  • RainInHour (Boolean ‘true’ if rain in the next hour)
  • heavyRainInHour (Boolean ‘true’ if heavy rain in the next hour)

Start the plugin

You can now start the plugin (start button) and use the created devices.

Set up your widgets on the user interface

You can now place the widgets of your devices features on the user interface.

This is 2 types of widgets to choose:

Here is the 2 widgets rainhour forecast and rainhour forecast 2 with the 2 sensors boolean widgets:

_images/domoweb_Weather_Rainhour_7.png

Development informations

“Meteo France” Rain Forecast API

Two URL are available for use:

  • One for the location ID search:
http://www.meteofrance.com/mf3-rpc-portlet/rest/lieu/facet/pluie/search/<string to search>

The result is a list of JSON object.

Example:

http://www.meteofrance.com/mf3-rpc-portlet/rest/lieu/facet/pluie/search/senlis
[ {
"id" : "606120",
"onTheSnowSkiiId" : 0,
"nomAffiche" : "Senlis (60300)",
"type" : "VILLE_FRANCE",
"slug" : "senlis",
"codePostal" : "60300",
"timezone" : "Europe/Paris",
"altitude" : 76,
"altitudeMin" : 0,
"altitudeMax" : 0,
"distance" : 0.0,
"nbHabitants" : 16907,
"lat" : 49.206837,
"lon" : 2.586072,
"directDisplay" : false,
"nbView" : 0,
"lastMareeDate" : null,
"parent" : null,
"positionAffichageCarteX" : 0,
"positionAffichageCarteY" : 0,
"value" : "Senlis (60300)",
"pluieAvalaible" : true
},
...
}, {
"id" : "807330",
"onTheSnowSkiiId" : 0,
"nomAffiche" : "Senlis-le-Sec (80300)",
"type" : "VILLE_FRANCE",
"slug" : "senlis-le-sec",
"codePostal" : "80300",
"timezone" : "Europe/Paris",
"altitude" : 82,
"altitudeMin" : 0,
"altitudeMax" : 0,
"distance" : 0.0,
"nbHabitants" : 286,
"lat" : 50.025027,
"lon" : 2.57755,
"directDisplay" : false,
"nbView" : 0,
"lastMareeDate" : null,
"parent" : null,
"positionAffichageCarteX" : 0,
"positionAffichageCarteY" : 0,
"value" : "Senlis-le-Sec (80300)",
"pluieAvalaible" : true
} ]

If the search is negative, the result is a empty list:

http://www.meteofrance.com/mf3-rpc-portlet/rest/lieu/facet/pluie//search/strasbourg
[]
  • The second URL is use to get the rain forecast for the next hour with the “id” provide in the previous search:
http://www.meteofrance.com/mf3-rpc-portlet/rest/pluie/<id>

The result is a list of JSON object.

Example:

http://www.meteofrance.com/mf3-rpc-portlet/rest/pluie/606120
{
"idLieu" : "606120",
"echeance" : "201604130810",
"lastUpdate" : "08h00",
"isAvailable" : true,
"hasData" : true,
"niveauPluieText" : [ "De08h10 à 08h15 : Précipitations faibles", "De08h15 à 08h30 : Précipitations modérées", "De08h30 à 09h00 : Précipitations faibles", "De09h00 à 09h10 : Pas de précipitations" ],
"dataCadran" : [ {
    "niveauPluieText" : "Précipitations faibles",
    "niveauPluie" : 2,
    "color" : "5ec5ed"
}, {
    "niveauPluieText" : "Précipitations modérées",
    "niveauPluie" : 3,
    "color" : "009ee0"
}, {
    "niveauPluieText" : "Précipitations modérées",
    "niveauPluie" : 3,
    "color" : "009ee0"
}, {
    "niveauPluieText" : "Précipitations modérées",
    "niveauPluie" : 3,
    "color" : "009ee0"
}, {
    "niveauPluieText" : "Précipitations faibles",
    "niveauPluie" : 2,
    "color" : "5ec5ed"
}, {
    "niveauPluieText" : "Précipitations faibles",
    "niveauPluie" : 2,
    "color" : "5ec5ed"
}, {
    "niveauPluieText" : "Précipitations faibles",
    "niveauPluie" : 2,
    "color" : "5ec5ed"
}, {
    "niveauPluieText" : "Précipitations faibles",
    "niveauPluie" : 2,
    "color" : "5ec5ed"
}, {
    "niveauPluieText" : "Précipitations faibles",
    "niveauPluie" : 2,
    "color" : "5ec5ed"
}, {
    "niveauPluieText" : "Précipitations faibles",
    "niveauPluie" : 2,
    "color" : "5ec5ed"
}, {
    "niveauPluieText" : "Pas de précipitations",
    "niveauPluie" : 1,
    "color" : "ffffff"
}, {
    "niveauPluieText" : "Pas de précipitations",
    "niveauPluie" : 1,
    "color" : "ffffff"
} ]
}

If the id is unknow, the result a JSON object with no rain data:

{
"idLieu" : "785131",
"echeance" : null,
"lastUpdate" : null,
"isAvailable" : false,
"hasData" : false,
"niveauPluieText" : null,
"dataCadran" : null
}

There ares 2 data types available in the JSON object of rain forecast:

  • one in texte format like that:
Exemple "niveauPluieText":

[ "De08h50 à 09h50 : Pas de précipitations" ]
[ "De08h10 à 08h15 : Précipitations faibles", "De08h15 à 08h30 : Précipitations modérées", "De08h30 à 09h00 : Précipitations faibles", "De09h00 à 09h10 : Pas de précipitations" ]
[ "De22h05 à 23h05 : Données indisponibles" ]

I use a fonction in plugin to convert this text data in a string use by “rainhour 2” widget:

Text forcast converted to value forcast:

[u'De20h05  20h10 : Pas de prcipitations', u'De20h10  20h15 : Prcipitations modres', u'De20h15  20h20 : Pas de prcipitations', u'De20h20  20h30 : Prcipitations faibles', u'De20h30  21h05 : Pas de prcipitations']
    => "20h05-20h10:1,20h10-20h15:3,20h15-20h20:1,20h20-20h30:2,20h30-21h05:1"
  • the second in value format like that:
{
    "niveauPluieText" : "Pas de précipitations",
    "niveauPluie" : 1,
    "color" : "ffffff"
}

For the 12 x 5mn period of a hour.

Possible value for “niveauPluie”:

0 : "Données indisponibles"
1 : "Pas de précipitations"
2 : "Précipitations faibles"
3 : "Précipitations modérées"
4 : "Précipitations fortes"

If sum of value = 12, no raining is provided : “Pas de précipitations”

If sum of value = 48 : heavy rain is expected in the all next hour.

Changelog

0.1

  • Plugin creation

1.0

  • First stable version