-
Compteur de contenus
1 503 -
Inscription
-
Dernière visite
Messages posté(e)s par couillerot
-
-
oui il doit être sans doute possible via l'api d'activer / désactiver le calendrier.
Stef
-
pas de soucis
Stef
-
à priori pas possible... et c'est bien dommage
Stef
-
tu peux remplacer le code par celui-ci ?
Stef
function QuickApp:onInit() self:loop() end ----- function QuickApp:loop() key_id = self:getVariable("key_id") lat = api.get("/settings/location").latitude lati = tostring(lat) lon = api.get("/settings/location").longitude long = tostring(lon) local http = net.HTTPClient() http:request("https://api.weatherbit.io/v2.0/forecast/daily?lat="..lati.."&lon="..long.."&days=5&lang=fr&key="..key_id, { options = { method = 'GET' }, success = function(response) if response.status == 200 then if response.data and response.data ~= "" then local jsonTable = json.decode(response.data) local gfx = jsonTable.data[2].weather.code local city = jsonTable.city_name local citycode = jsonTable.country_code ------------------------------------------------------------------------------ ----------------------------- CHOIX DE L'ICON -------------------------------- ------------------------------------------------------------------------------ codeicon = tonumber(gfx) id_icon1 = tonumber(self:getVariable("id_icon1")) id_icon2 = tonumber(self:getVariable("id_icon2")) id_icon3 = tonumber(self:getVariable("id_icon3")) id_icon4 = tonumber(self:getVariable("id_icon4")) id_icon5 = tonumber(self:getVariable("id_icon5")) id_icon6 = tonumber(self:getVariable("id_icon6")) id_icon7 = tonumber(self:getVariable("id_icon7")) id_icon8 = tonumber(self:getVariable("id_icon8")) id_icon9 = tonumber(self:getVariable("id_icon9")) id_icon10 = tonumber(self:getVariable("id_icon10")) id_icon11 = tonumber(self:getVariable("id_icon11")) if codeicon == tonumber("610") then self:updateProperty("deviceIcon", id_icon1) end if codeicon >= tonumber("803") and codeicon <= tonumber("804") then self:updateProperty("deviceIcon", id_icon2) end if codeicon >= tonumber("700") and codeicon <= tonumber("751") then self:updateProperty("deviceIcon", id_icon3) end if codeicon >= tonumber("500") and codeicon <= tonumber("522") then self:updateProperty("deviceIcon", id_icon4) end if codeicon >= tonumber("601") and codeicon <= tonumber("623") then self:updateProperty("deviceIcon", id_icon5) end if codeicon == tonumber("600") then self:updateProperty("deviceIcon", id_icon6) end if codeicon == tonumber("800") then self:updateProperty("deviceIcon", id_icon7) end if codeicon >= tonumber("801") and codeicon <= tonumber("802") then self:updateProperty("deviceIcon", id_icon8) end if codeicon >= tonumber("300") and codeicon <= tonumber("302") then self:updateProperty("deviceIcon", id_icon9) end if codeicon >= tonumber("230") and codeicon <= tonumber("233") then self:updateProperty("deviceIcon", id_icon10) end if codeicon >= tonumber("200") and codeicon <= tonumber("202") then self:updateProperty("deviceIcon", id_icon11) end Var_Heure = os.date("%d.%m.%Y à %Hh%M") local day2, day3, day4, day5 ------------------------------------------------------------------------------ -------------------------- CONSTRUCTION DES TABLES --------------------------- ------------------------------------------------------------------------------ week = { ["0"] = "DIMANCHE", ["1"] = "LUNDI", ["2"] = "MARDI", ["3"] = "MERCREDI", ["4"] = "JEUDI", ["5"] = "VENDREDI", ["6"] = "SAMEDI" } month = { ["01"] = "JANVIER", ["02"] = "FEVRIER", ["03"] = "MARS", ["04"] = "AVRIL", ["05"] = "MAI", ["06"] = "JUIN", ["07"] = "JUILLET", ["08"] = "AOUT", ["09"] = "SEPTEMBRE", ["10"] = "OCTOBRE", ["11"] = "NOVEMBRE", ["12"] = "DECEMBRE" } ------------------ ----- JOUR 1 ----- ------------------ precipday1 = jsonTable.data[1].precip day1weather = jsonTable.data[1].weather.description snowday1 = jsonTable.data[1].snow lowtempday_1 = jsonTable.data[1].low_temp maxtempday_1 = jsonTable.data[1].max_temp windspeed_1 = jsonTable.data[1].wind_spd winddir_1 = jsonTable.data[1].wind_cdir day_1 = jsonTable.data[1].datetime day = tostring(os.date("%w", os.time())) j_1 = string.sub(day_1, 9, 10) m_1 = string.sub(day_1, 6, 7) day1 = tonumber(day) ------------------ ----- JOUR 2 ----- ------------------ precipday2 = jsonTable.data[2].precip snowday2 = jsonTable.data[2].snow day_2 = jsonTable.data[2].datetime day2weather = jsonTable.data[2].weather.description lowtempday_2 = jsonTable.data[2].low_temp maxtempday_2 = jsonTable.data[2].max_temp windspeed_2 = jsonTable.data[2].wind_spd winddir_2 = jsonTable.data[2].wind_cdir j_2 = string.sub(day_2, 9, 10) m_2 = string.sub(day_2, 6, 7) day2 = tonumber(day1) + 1 ------------------ ----- JOUR 3 ----- ------------------ precipday3 = jsonTable.data[3].precip snowday3 = jsonTable.data[3].snow day_3 = jsonTable.data[3].datetime day3weather = jsonTable.data[3].weather.description lowtempday_3 = jsonTable.data[3].low_temp maxtempday_3 = jsonTable.data[3].max_temp windspeed_3 = jsonTable.data[3].wind_spd winddir_3 = jsonTable.data[3].wind_cdir j_3 = tostring(string.sub(day_3, 9, 10)) m_3 = tostring(string.sub(day_3, 6, 7)) day3 = tonumber(day2) + 1 ------------------ ----- JOUR 4 ----- ------------------ precipday4 = jsonTable.data[4].precip snowday4 = jsonTable.data[4].snow day_4 = jsonTable.data[4].datetime day4weather = jsonTable.data[4].weather.description lowtempday_4 = jsonTable.data[4].low_temp maxtempday_4 = jsonTable.data[4].max_temp windspeed_4 = jsonTable.data[4].wind_spd winddir_4 = jsonTable.data[4].wind_cdir j_4 = tostring(string.sub(day_4, 9, 10)) m_4 = tostring(string.sub(day_4, 6, 7)) day4 = tonumber(day3) + 1 ------------------ ----- JOUR 5 ----- ------------------ precipday5 = jsonTable.data[5].precip snowday5 = jsonTable.data[5].snow day_5 = jsonTable.data[5].datetime day5weather = jsonTable.data[5].weather.description lowtempday_5 = jsonTable.data[5].low_temp maxtempday_5 = jsonTable.data[5].max_temp windspeed_5 = jsonTable.data[5].wind_spd winddir_5 = jsonTable.data[5].wind_cdir j_5 = tostring(string.sub(day_5, 9, 10)) m_5 = tostring(string.sub(day_5, 6, 7)) day5 = tonumber(day4) + 1 ------------------------------ ------- BOUCLE SEMAINE ------- ------------------------------ if tonumber(day1) == tonumber("6") then day2 = 0 day3 = 1 day4 = 2 day5 = 3 end if tonumber(day2) == tonumber("6") then day1 = 5 day3 = 0 day4 = 1 day5 = 2 end if tonumber(day3) == tonumber("6") then day1 = 4 day2 = 5 day4 = 0 day5 = 1 end if tonumber(day4) == tonumber("6") then day1 = 3 day2 = 4 day3 = 5 day5 = 0 end if tonumber(day5) == tonumber("6") then day1 = 2 day2 = 3 day3 = 4 day4 = 5 end ---------------------------------- ---------- ALERTE NEIGE ---------- ---------------------------------- if (snowday2 > 0) or (snowday3 > 0) or (snowday4 > 0) or (snowday5 > 0) then self:updateProperty("log", "ALERTE NEIGE") elseif ( windspeed_2 > 30) or ( windspeed_3 > 30) or ( windspeed_4 > 30) or ( windspeed_5 > 30) then self:updateProperty("log", "ALERTE VENT") else self:updateProperty("log", "") end ------------------------------------------------------------------------------ --------------------------- CONSTRUCTION DES LABELS -------------------------- ------------------------------------------------------------------------------ self:updateView("labelday1", "text", week[tostring(day1)].." "..j_1.. " "..month[m_1].."\r"..day1weather.."\rT° mini : "..lowtempday_1.."°c - T° maxi : "..maxtempday_1.."°c\r" ..string.format("%.1f", precipday1) .." mm de pluie | " ..string.format("%.1f", snowday1).." mm de neige\rVent "..string.format("%.1f", windspeed_1 * 3.6).." km/h ("..winddir_1..")") self:updateView("labelday2", "text", week[tostring(day2)].." "..j_2.. " "..month[m_2].."\r"..day2weather.."\rT° mini : "..lowtempday_2.."°c - T° maxi : "..maxtempday_2.."°c\r" ..string.format("%.1f", precipday2) .." mm de pluie | " ..string.format("%.1f", snowday2).." mm de neige\rVent "..string.format("%.1f", windspeed_2 * 3.6).." km/h ("..winddir_2..")") self:updateView("labelday3", "text", week[tostring(day3)].." "..j_3.. " "..month[m_3].."\r"..day3weather.."\rT° mini : "..lowtempday_3.."°c - T° maxi ; "..maxtempday_3.."°c\r" ..string.format("%.1f", precipday3) .." mm de pluie | " ..string.format("%.1f", snowday3).." mm de neige\rVent "..string.format("%.1f", windspeed_3* 3.6).." km/h ("..winddir_3..")") self:updateView("labelday4", "text", week[tostring(day4)].." "..j_4.. " "..month[m_4].."\r"..day4weather.."\rT° mini : "..lowtempday_4.."°c - T° maxi : "..maxtempday_4.."°c\r" ..string.format("%.1f", precipday4) .." mm de pluie | " ..string.format("%.1f", snowday4).." mm de neige\rVent "..string.format("%.1f", windspeed_4 * 3.6).." km/h ("..winddir_4..")") self:updateView("labelday5", "text", week[tostring(day5)].." "..j_5.. " "..month[m_5].."\r"..day5weather.."\rT° mini : "..lowtempday_5.."°c - T° maxi : "..maxtempday_5.."°c\r" ..string.format("%.1f", precipday5) .." mm de pluie | " ..string.format("%.1f", snowday5).." mm de neige\rVent "..string.format("%.1f", windspeed_5 * 3.6).." km/h ("..winddir_5..")") self:updateView("labelMAJ", "text", "Station de "..city.." ("..citycode..") - MAJ le "..Var_Heure) ----------------------------- precipitation_arrosage = string.format("%.2f", precipday1 + precipday2) fibaro.setGlobalVariable("prevision_pluie", tostring(precipitation_arrosage)) fibaro.setGlobalVariable("precipday2", tostring(precipday2)) fibaro.setGlobalVariable("precipday3", tostring(precipday3)) ---------- else self:debug("Error : empty response data") end else self:debug("Error : status=" .. tostring(response.status)) end end, error = function(err) self:debug("Error : " .. err) end }) self:debug("Boucle PREVISIONS METEO") fibaro.setTimeout(1000 * 60 * 120, function() self:loop() end) end
- 1
-
qu'est-ce que le log t'indique ?
Stef
-
Salut,
l'api fonctionne parfaitement chez moi
Stef
-
J'ai expliqué le problème à GCE qui m'ont demandé une capture d'écran car de leur côté ça fonctionne correctement... (avec firmware 1.06.00 et 1.06.01)
pourrais tu me fournir une capture de la réponse de la commande ?
après il m'ont donné une alternative : ip/status.xml mais là c'est une autre histoire...
Stef
-
si si mais je voulais être sûr
Stef
- 1
-
oui Manu il s'agit bien de l'adresse json qui pour moi aurait été modifiée
D'ailleurs, j'ai vu que le mode Tempo était maintenant présent dans la maj web (peut-être depuis la version 1.6 ?)
Manu, tu as bien les 2 mêmes maj : web version et prog version ? (sous système)
Effectivement Lazer, ce QA ne traite uniquement que du HC/HP.
Stef
-
j'ai envoyé un mail à CGE... on verra bien.
Stef
-
effectivement, je soupçonne que l'adresse a changé...
Stef
-
Je vais faire la MAJ et voir ce que ça donne...
Stef
- 1
-
Salut !
je viens d'installer le QA compteur d'énergie (celui présent au haut du topic) et je n'ai pas d'erreur...
Sinon, à tout hasard, pour la variable "tarifAbonnement", tu as bien mis un "." et non une "," dans le chiffre ?
Stef
-
salut ROBBEJP et merci pour tes remerciements mais la version Free de Weatherbit ne permet pas l'utilisation de prévisions à l'heure et c'est vrai que c'est bien dommage.
Nous sommes malheureusement cantonnés aux prévisions "classiques" :(
Stef
-
idem !!!
-
Le QA fait un appel tous les 20 min donc légèrement plus que qu'autorisé mais ça ne plante pas chez moi.
effectivement, l'idéal serait de mettre 30 min entre 2 appels.
j'ai modifié le code en première page, sinon c'est c'est partie qu'il faut modifier :
self:debug("Boucle METEO") fibaro.setTimeout(1000 * 60 * 30, function() -- MAJ toutes les 30 minutes self:loop() end) end
Stef
- 1
-
version 1.3 ---> ajout d'un nouveau pack d'icons et correctif (à confirmer...)
Stef
- 1
-
-
idem ! (???)
-
ben écoute, je n'ai pas de problème d'affichage... mais il me semble que fibaro a rajouté une condition supplémentaire lors de la dernière maj ce qui expliquerait ce bug.
je regarderais ça de plus et apporterais un correctif
Stef
- 1
-
même si cette appli évolue dans le bon sens (un peu, hein!), elle reste quand même très peu conviviale, buggée, moche et peu réactive (QA)... et pour corser le tout son développement est très, très, très lent.
Stef
-
je ne pense pas que le soucis soit lié aux nombre de couleurs car j'ai appliqué la même règle que les icons "made by fibaro" : du RGB color en 8 bits/channel
ça sent plutôt un bug de la version Android car sous ios je n'ai pas ce problème d'affichage... (et quelle version d'Android ?)
Stef
-
Bienvenue, Welcome !
Stef
-
je confirme ce qu'à écrit précédemment Lazer, le v3 fonctionne très bien avec la HC3
Stef
Quick App : Arrosage Automatique
dans Quick App Developpeur
Posté(e) · Report reply
Pour palier aux nombres limités d'appels, j'ai modifié légèrement le QA
Vu que j'utilise le QA "prévisions Météo", j'ai donc créé 2 VG (précipitations J+1 et J+2) que je récupère dans "Arrosage auto"
Stef