La météo de Weather Underground dans Domoticz

Un article précédent nous décrivait comment ajouter la météo depuis le service Forecast.io, voyons ici comment configurer Domoticz pour afficher la météo récupérée depuis le service Weather Underground.

Certains développements d’interfaces utilisant ce service météo plutôt que Forecast.io m’ont donné envie d’en présenter la mise en place.

Librement traduit depuis le wiki anglophone dont voici la source http://www.domoticz.com/wiki/Virtual_weather_devices

1 – Obtention d’une clé API

Afin de pouvoir récupérer notre météo depuis le site il nous faut une clé obtenue sur le site http://www.wunderground.com/weather/api
  • Cliquez sur le bouton orange marqué « Sign Up for FREE! »
  • Remplissez les champs e-mail/mot de passe, puis le « Handle » qui est votre surnom  🙄  sous  « Create Your Free Account! »,  acceptez les conditions  puis cliquez « Sign Up »
  • Vous recevez un e-mail d’activation contenant une URL, cliqez pour activer le compte.
  • Vous pouvez vous connecter sur le site.

2015-03-01 22_06_15

 

 

  •  * ANVIL PLAN
       * Yes, give me access to the daily weather archives
       * Developer

     

 

2015-03-01 22_08_26

 

Je tiens à faire remarquer que nous serons limités à 500 appels par jour ET 10 par minute, donc pas d’interrogations intempestives.

  • On clique sur « Purchase Key » en bleu.
  • On emplit le formulaire

 

   * Contact name: (votre nom)
   * Project contact e-mail: (votre adresse mail)
   * Project name: Domoticz
   * Project website: http://www.domoticz.com
   * Where will the API be used: Website
   * Will the API be used for commercial use: No
   * Will the API be used for manufacturing mobile chip processing: No
   * Votre Pays
   * A brief description: "J'aime avoir la méteo dans Domoticz (ou autre chose comme cela;) )
      • Cochez les deux cases en dessous
      • Cliquez « Purchase Key »
      • Nous avons notre clé API.
      • Ne fermez pas la page, nous avons des copier/coller à faire plus tard.

2 – Localisons une station météo à proximité.

  • Allez à http://www.wunderground.com/wundermap
  • Trouvez sur la carte une station à proximité de chez vous
  • Cliquez sur la station représente par un marquer avec la température dedans

Dans la fenêtre qui s’ouvre, copiez le « Station ID »

2015-03-01 22_41_30

3 – Domoticz

Configurons Domoticz.

  •  Allez dans « Configuration puis « Matériel »
  • Dans la partie du bas , déroulez tout en bas pour trouver « Weather Underground »
  • Ne forcez pas la récupération par le champ « Délai d’attente de données » toutes les minutes car c’est inutile d’avoir la météo minute par minute.Domoticz interroge le site toutes les 10 minutes automatiquement. Souvenez vous que la version gratuite de Weather Underground ne nous offre que 10 appels par minutes et 500/jour.
  • Activez le composant, nommez le, puis récupérer la clé API par des copier/coller dans le champ du bas.
  • Le champ « Localisation » DOIT COMMENCER par pws: puis votre Station ID relevé plus haut. Toutefois les mise à jour récentes semblent ne plus avoir besoin du pws: 😯

IL FAUT METTRE pws: ou pas !!

2015-03-01 23_17_47

  • Cliquez sur « Ajouter »
  • Allez voir les logs Domoticz, cette étape n’est pas facultative, faites le !!

si vous avez ça :

15-03-01 22:49:53.690 (Compteur EDF) P1 Smart Meter (EDF)
2015-03-01 22:50:00.683 Hardware Monitor: Fetching data (System sensors)
2015-03-01 22:50:01.260 Error: WUnderground: Invalid data received, or unknown location!

C’est pas bon,

si vous avez mis pws: , supprimez le et ne laissez que le nom de la station.

Si vous n’avez pas mis pws: et que cela ne fonctionne pas ajoutez le devant Station ID tout seul. 👿

Dans tous les cas seul les logs vous diront si c’est correct.

2015-03-01 22_49_59

 

 4 – Les périphériques.

L’activation réussie de Weather Undergroud , crée 6 dispositifs dans Domoticz.

2015-03-02 11_18_15

  • Rain : Pluie en mm
  • Visibility : Visibilité en Km
  • Solar Radiation : Radiation solaires
  • Temp+Hum+Baro : Température, Humidité, Pression Barométrique
  • Wind : Direction, Vitesse du vent, Rafales,
  • UV : index UV

Le bouton vert à droite permet, comme à notre habitude, d’ajouter les composants désirés à notre interface web en les nommant.

Voila nous sommes prêts à afficher notre météo  dans nos jolies interfaces.

 


Laissez un commentaire

Connecté en tant que patrice. Se déconnecter ?

Vous pouvez utiliser ces balises et attributs HTML : <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

 

 

Pour toute question technique concernant cet article, veuillez utiliser les forum situés à https://easydomoticz.com/forum/
Posted in Débutants, domoticz.

6 Comments

  1. Est t’il possible de pouvoir récupérer la valeur de la condition météo (nuageux, ensoleillé, etc…) dans une variable via un script pour pouvoir l’utiliser sur des events par la suite ?

  2. Oui bien sur avec le langage de ton choix tu recuperes ta valeur.
    Dans Domotice cree une variable texte
    Par Json tu la valorise
    Et tu peux l’ utiliser partout

  3. sur le forum anglophone il y a cette discussion qui corresponds à ce que tu cherche
    http://www.domoticz.com/forum/viewtopic.php?f=23&t=6085&sid=cf950d84395da0c14eed05e3867dcfb4

    le script Lua est celui ci , (les premieres lignes decodent une meteo et l’assignent a X valeurs)
    cela te fait un bon début

    commandArray = {}

    –Weatherstation data:
    sWeatherTemp, sWeatherHumidity, sWeatherUV, sWeatherPressure, sWeatherUV2 = otherdevices_svalues[‘Barometer’]:match(« ([^;]+);([^;]+);([^;]+);([^;]+);([^;]+) »)
    sWeatherTemp = tonumber(sWeatherTemp);
    sWeatherHumidity = tonumber(sWeatherHumidity);
    sWeatherPressure = tonumber(sWeatherPressure);
    sWeatherUV = tonumber(sWeatherUV);
    sWeatherUV2 = tonumber(sWeatherUV2);

    print(« ______________________________________________________________________________________ »)
    print(« Weather station: Temperature is  » .. sWeatherTemp ..  » « );
    print(« Weather station: Humidity is  » .. sWeatherHumidity ..  » « );
    print(« Weather station: Pressure is  » .. sWeatherPressure ..  » « );
    print(« Weather station: UV is  » .. sWeatherUV ..  » « );
    print(« Weather station: UV2 is  » .. sWeatherUV2 ..  » « );
    print(« ______________________________________________________________________________________ »)

    ————————————————————————

    –Windmeter data:
    sWindDirectionDegrees, sWindDirection, sWindSpeed, sWindGust, sWindTemperature, sWindFeel = otherdevices_svalues[‘Wind’]:match(« ([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+) »)

    sWindDirectionDegrees = tonumber(sWindDirectionDegrees);
    sWindDirection = (sWindDirection);
    sWindSpeed = tonumber(sWindSpeed);
    sWindGust = tonumber(sWindGust);
    sWindTemperature = tonumber(sWindTemperature);
    sWindFeel = tonumber(sWindFeel);

    print(« ______________________________________________________________________________________ »)
    print(« Windmeter: Winddirection (in degrees) is:  » .. sWindDirectionDegrees ..  » « );
    print(« Windmeter: Winddirection is:  » .. sWindDirection ..  » « );
    print(« Windmeter: Windspeed is:  » .. sWindSpeed ..  » « );
    print(« Windmeter: Windgust is:  » .. sWindGust ..  » « );
    print(« Windmeter: Windtemperature is:  » .. sWindTemperature ..  » « );
    print(« Windmeter: Windfeel is:  » .. sWindFeel ..  » « );
    print(« ______________________________________________________________________________________ »)

    ————————————————————————

    –Rainmeter data:
    sRainmeterCurrent, sRainmeterTotal = otherdevices_svalues[‘Regen’]:match(« ([^;]+);([^;]+) »)

    sRainmeterCurrent = tonumber(sRainmeterCurrent);
    sRainmeterTotal = tonumber(sRainmeterTotal);

    print(« ______________________________________________________________________________________ »)
    print(« Rainmeter: Actual rain is:  » .. sRainmeterCurrent ..  » « );
    print(« Rainmeter: Total rain is:  » .. sRainmeterTotal ..  » « );
    print(« ______________________________________________________________________________________ »)
    ————————————————————————

    –UV data:
    sSolar = otherdevices_svalues[‘Solar’]:match(« ([^;]+) »)

    –sUV = tonumber(sUV);
    sSolar = tonumber(sSolar);

    –print(« UV: UV Strength is:  » .. sUV .. » « );
    print(« UV: Solar radiation is:  » .. sSolar .. » « );

    ————————————————————————

    –Sunscreen thresholds:
    — Windspeed = 100.0 (value is multiplied by 100)
    — Rain = 0.0
    — UV = 2.0
    — Temperature = 12.0
    — Closed = Down = On
    — Open = Up = Off

    ————————————————————————

    if (timeofday[‘Daytime’])
    then
    print(‘It is past sunrise, monitoring variables for sunscreen’)
    if (otherdevices[‘Zonnescherm’] == ‘Open’ )
    then
    print (‘Sunscreen is up’)
    else
    print (‘Sunscreen is down’)

    end

    if (otherdevices[‘Zonnescherm manual override’] == ‘Off’)
    then
    print(‘Manual override is turned off, follow the rest of the script’)
    else
    print(‘Manual override is turned on, goto the end of the script and do nothing’)
    goto done
    end

    if (otherdevices[‘Zonnescherm’] == ‘Open’
    and sRainmeterCurrent == 0
    and sWeatherTemp > 12.0
    and sSolar > 100
    and sWindSpeed < 50 and sWindGust < 150) then print ('Sun is shining, all thresholds OK, lowering sunscreen') print('______________________________________________________________________________________') commandArray['SendNotification']='Sunscreen#Sunscreen down --> Sun is shining’
    commandArray[‘Zonnescherm’]=’On’

    elseif (otherdevices[‘Zonnescherm’] == ‘Closed’ and sRainmeterCurrent > 0)
    then
    print (‘It is raining, raising sunscreen’)
    print(‘______________________________________________________________________________________’)
    commandArray[‘SendNotification’]=’Sunscreen#Sunscreen up –> It is raining’
    commandArray[‘Zonnescherm’]=’Off’

    elseif (otherdevices[‘Zonnescherm’] == ‘Closed’ and sWeatherTemp <11.0 and otherdevices['Zonnescherm manual override'] == 'Off')
    then
    print ('Temperature too low, raising sunscreen')
    print('______________________________________________________________________________________')
    commandArray['SendNotification']='Sunscreen#Sunscreen up --> It is too cold’
    commandArray[‘Zonnescherm’]=’Off’

    elseif (otherdevices[‘Zonnescherm’] == ‘Closed’ and sSolar < 80 and otherdevices['Zonnescherm manual override'] == 'Off') then print ('Sun not shining too bright, raising sunscreen') print('______________________________________________________________________________________') commandArray['SendNotification']='Sunscreen#Sunscreen up --> Sunshine not too bright’
    commandArray[‘Zonnescherm’]=’Off’

    elseif (otherdevices[‘Zonnescherm’] == ‘Closed’ and sWindSpeed > 50)
    then
    print (‘Windspeed too high, raising sunscreen’)
    print(‘______________________________________________________________________________________’)
    commandArray[‘SendNotification’]=’Sunscreen#Sunscreen up –> Windspeed too high’
    commandArray[‘Zonnescherm’]=’Off’

    elseif (otherdevices[‘Zonnescherm’] == ‘Closed’ and sWindGust > 150)
    then
    print (‘Windgust too high, raising sunscreen’)
    print(‘______________________________________________________________________________________’)
    commandArray[‘SendNotification’]=’Sunscreen#Sunscreen up –> Windgust too high’
    commandArray[‘Zonnescherm’]=’Off’

    else
    print(‘Sunscreen status OK –> No action’)
    print(‘______________________________________________________________________________________’)
    end

    ::done::
    print(« At the end of the script »)
    print(« ______________________________________________________________________________________ »)

    elseif (timeofday[‘Nighttime’]
    and otherdevices[‘Zonnescherm’] == ‘Closed’)
    then
    print(‘It is night, raising sunscreen’)
    print(‘______________________________________________________________________________________’)
    commandArray[‘SendNotification’]=’Sunscreen#Sunscreen up –> It is night’
    commandArray[‘Zonnescherm’]=’Off’
    else
    print(‘Sunscreen already up –> No action’)
    print(‘______________________________________________________________________________________’)
    end

    return commandArray

    Bonne lecture

  4. Pingback: Potager – interface avec une api de météo gratuite, script de probabilité de pluie. – Brico-Info – le blog de Bruno CATTEAU

Comments are closed.