Re: DZVents : DarkSky et probabilité de pluie
Publié : 31 juil. 2019, 22:34
aucune erreur car les devices pluie se mettent a jour j'ai juste vent et lune qui se mette pas a jour
Reprenez le contrôle de votre domotique
https://easydomoticz.com/forum/
Code : Tout sélectionner
2019-08-07 06:00:15.111 Error: Error opening url: https://api.darksky.net/forecast/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/49.331234,0.351804?units=ca&exclude=currently,minutely,daily,alerts,flags
2019-08-07 06:00:53.520 Error: dzVents: Error: (2.4.26) Darksky Rain Probability v1.0 : HTTP/1.1 response: 28 ==>> Timeout was reachedBonjour à tous,jmv75013 a écrit : 07 août 2019, 10:55 Bonjour,
J'ai mis en place ce script et il semble fonctionner correctement. Toutefois régulièrement j'ai le message suivant :Ces derniers jours, je l'ai eu :Code : Tout sélectionner
2019-08-07 06:00:15.111 Error: Error opening url: https://api.darksky.net/forecast/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/49.331234,0.351804?units=ca&exclude=currently,minutely,daily,alerts,flags 2019-08-07 06:00:53.520 Error: dzVents: Error: (2.4.26) Darksky Rain Probability v1.0 : HTTP/1.1 response: 28 ==>> Timeout was reached
-le 4/8 à 23h30
-le 5/8 à 23h30
- le 6/8 à 17h00
- le 6/8 à 23h30
- le 7/8 à 06H00
Voila est-ce que quelqu'un a le même phénomène ou à une idée de ce qui se passe ?
Merci
Code : Tout sélectionner
--[[ darksky.lua for [ domoticzVents >= 2.4 ]
author/auteur = papoo
update/mise à jour = 15/09/2018
creation = 15/09/2018
https://pon.fr/dzvents-darksky-et-probabilite-de-pluie/
This script requires prior registration to the DarkSky API
Ce script nécessite l'inscription préalable à l'API DarkSky
Enter the URL and request a free API key
Entrez l'URL et demandez une clé API gratuite
https://darksky.net/dev
]]--
local proba_pluie_h = {}
--[[
Add, modify or delete variables proba_pluie_h [] by changing the number (hour) between []
the name "in quotation marks" or the idx without quotes (avoid accents) of the device of percentage of rain at [x] associated time, nil if not used
This script can potentially retrieve the 48 available time forecasts. Create as many percent virtual sensors as you would expect from the hourly forecasts.
for my part, I only get the forecasts at 1 hour, 2 hours, 4 hours, 6 hours, 12 hours and 24 hours.
Only 48 possible forecasts
Ajoutez, modifiez ou supprimez les variables proba_pluie_h[] en changeant le nombre (heure) entre []
renseigner ensuite le nom "entre guillemets" ou l'idx sans guillemets (évitez les accents) du device pourcentage probabilité pluie à [x] heure associé, nil si non utilisé
Ce script peut potentiellement récupérer les 48 prévisions horaires disponible. Créez autant de capteurs virtuels pourcentage correspondant aux prévisions horaires que vous souhaitez.
pour ma part, je ne récupère que les prévisions à 1 heure, 2 heures, 4 heures, 6 heures, 12 heures et 24 heures.
Seulement 48 prévisions possible
My DarkSky secret key, the latitude and longitude of my home are contained in 3 user variables
Ma clé secrète DarkSky, la latitude et la longitude de mon domicile sont contenus dans 3 variables utilisateurs
--local DarkSkyAPIkey = domoticz.variables('api_forecast_io').value
--local geolocalisation = domoticz.variables('Latitude').value..","..domoticz.variables('Longitude').value
If you want to enter this information directly into the script, comment on the two lines above, uncomment the following two lines
Si vous souhaitez inscrire ces informations dans le script, commentez les deux lignes ci-dessus, décommentez les deux lignes suivantes
local DarkSkyAPIkey = "4252xxxxxxxxxxxxxxxxf34b3786c"
local geolocalisation = "99.9999,9.9999" -- latitude,longitude
by personalizing them with your personal data
finally, you can choose the level of logs, only one level can be active; comment on others in the section
en les personnalisant avec vos données personnelles.
enfin vous pouvez choisir le niveau de "verbiage" des logs, seulement un niveau peut être actif; commenter les autres dans la section logging
]]--
proba_pluie_h[1]= "Proba Pluie 1h"
proba_pluie_h[2]= nil
proba_pluie_h[3]= "Proba Pluie 3h"
proba_pluie_h[4]= nil
proba_pluie_h[5]= "Proba Pluie 5h"
proba_pluie_h[6]= nil
proba_pluie_h[7]= "Proba Pluie 7h"
proba_pluie_h[8]= nil
proba_pluie_h[9]= "Proba Pluie 9h"
proba_pluie_h[10]= nil
proba_pluie_h[11]= "Proba Pluie 11h"
proba_pluie_h[12]= nil
proba_pluie_h[13]= "Proba Pluie 13h"
proba_pluie_h[14]= nil
proba_pluie_h[15]= "Proba Pluie 15h"
proba_pluie_h[16]= nil
proba_pluie_h[17]= "Proba Pluie 17h"
proba_pluie_h[18]= nil
proba_pluie_h[19]= "Proba Pluie 19h"
proba_pluie_h[20]= nil
proba_pluie_h[21]= "Proba Pluie 21h"
proba_pluie_h[22]= nil
proba_pluie_h[23]= nil
proba_pluie_h[24]= "Proba Pluie 24h"
return {
active = true,
on = { timer = { 'every 30 minutes' }, -- remember only 1000 requests by day, 30mn = 48 requests
httpResponses = { "trigger" } -- Trigger the handle Json part
},
logging = { level = domoticz.LOG_INFO, -- Seulement un niveau peut être actif; commenter les autres
-- level = domoticz.LOG_ERROR, -- Only one level can be active; comment others
-- level = domoticz.LOG_DEBUG,
-- level = domoticz.LOG_MODULE_EXEC_INFO,
marker = "Darksky Rain Probability v1.0 " },
data = { rainForecast = {initial = {} }, -- Keep a copy of last json just in case
},
execute = function(domoticz, item)
--local DarkSkyAPIkey = domoticz.variables('api_forecast_io').value
--local geolocalisation = domoticz.variables('Latitude').value..","..domoticz.variables('Longitude').value
local DarkSkyAPIkey = "425287a117dcc6bdc97f666f34b3786c"
local geolocalisation = "49.0533,6.3446" -- latitude,longitude
local Forecast_url = "https://api.darksky.net/forecast/" -- url
local extraData = "?units=ca&exclude=currently,minutely,daily,alerts,flags"
local function debugMessage(message)
domoticz.log(message,domoticz.LOG_DEBUG)
end
if (item.isTimer) then
domoticz.openURL({
url = Forecast_url..DarkSkyAPIkey.."/"..geolocalisation..extraData,
callback = 'trigger'
})
end
if (item.isHTTPResponse and item.ok) then
-- we know it is json but dzVents cannot detect this
-- convert to Lua
local json = domoticz.utils.fromJSON(item.data)
-- json is now a Lua table
if #item.data > 0 then
domoticz.data.rainForecast = domoticz.utils.fromJSON(item.data)
rt = domoticz.utils.fromJSON(item.data)
else
domoticz.log("Problem with response from DarkSky (no data) using data from earlier run",domoticz.LOG_ERROR)
rt = domoticz.data.rainForecast -- json empty. Get last valid from domoticz.data
if #rt < 1 then -- No valid data in domoticz.data either
domoticz.log("No previous data. are DarkSkyAPIkey and geolocalisation ok?",domoticz.LOG_ERROR)
return false
end
end
debugMessage("heure systeme")
debugMessage(os.date('%Y-%m-%d %H:%M:%S', time))
local now = tonumber(os.time(os.date("*t")))
j = 1
for i = 1,48 do
if now > tonumber(json.hourly.data[j].time) then
local h = domoticz.utils.round((now - tonumber(json.hourly.data[j].time)) / 3600,0)
j = j+h
debugMessage("j : "..j)
end
if proba_pluie_h[i] then
debugMessage("heure "..i)
debugMessage(os.date('%Y-%m-%d %H:%M:%S', json.hourly.data[j].time))
debugMessage(json.hourly.data[j].time)
debugMessage(json.hourly.data[j].precipProbability)
domoticz.devices(proba_pluie_h[i]).updatePercentage(json.hourly.data[j].precipProbability*100)
end
if j == 48 then break end
j = j +1
end
end
end
}