Aller au contenu
couillerot

Quick App - Météo WeatherBit v1.3

Recommended Posts

Salut,

 

Merci de ton retour, du coup les scénarios météo cela ne fonctionne pas top ;) 

 

J'ai fait 4 scénarios pour être prévenu à chaque changement de météo et.... 2 mails en 48h

 

Je vais envoyer un mail au support fibaro pour voir ce qu'ils en pensent

 

Le but final étant de de positionner les volets roulants en fonction de la météo (Avec un refresh toutes les heures si besoin)

Modifié par p1npon

Partager ce message


Lien à poster
Partager sur d’autres sites
[04.09.2022] [14:00:29] [DEBUG] [QUICKAPP68]: Error : status=400

hello

 

j'ai une erreur 400, la clé que j'ai mis est celle qui fonctionne dans la HC2 donc je suppose que le pb de vient pas de la. une idée ?

 

édit : trouvé c'est une erreur sur le format lat et lon ; il faut qq chose comme 2.12554

 

Modifié par Sakkhho

Partager ce message


Lien à poster
Partager sur d’autres sites

@couillerot
Tu as des problèmes d affichage des icônes dans l app aussi ?

 

Modifié par Sakkhho

Partager ce message


Lien à poster
Partager sur d’autres sites

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

  • Like 1

Partager ce message


Lien à poster
Partager sur d’autres sites

version 1.3 ---> ajout d'un nouveau pack d'icons et correctif (à confirmer...) ;)

 

Stef

Modifié par couillerot
  • Like 1

Partager ce message


Lien à poster
Partager sur d’autres sites

l'api limite à 50 appels / jour, j'ai l'impression que le QA en fait plus non ?

je me suis créer 3 clef avec tes QAs, mais ca bug tes pas mal - pas de pb chez toi ?

Modifié par Sakkhho

Partager ce message


Lien à poster
Partager sur d’autres sites

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

 

 

 

  • Thanks 1

Partager ce message


Lien à poster
Partager sur d’autres sites

Hello !

 

Déjà @couillerot bravo pour tout ce travail.

J'admire personellement :)

 

Je me permet d'apporter ma petite remarque aussi humble soit-elle.

Ce qui m'interessaerait c'est d'avoir ce meme type de QA mais plutot que d'avoir la prévision à plusieurs jours, je souhaiterais l'avoir à l'heure sur la journée.

 

Pourquoi je demande ça:

J'ai fait une petite QA qui permet de lancer mon ballon d'eau chaude en fonction de ma production solaire.

Les jours où il ne fait pas beau, je pondère mes seuils de déclenchement en me basant sur l'indice météo ... et c'est là que nos chemins se croisent :)

 

Typiquement aujourd'hui, là où j'habite (La Rochelle) il a fait nuageurx le matin et plein soleil l'après midi.

Si j'avais eu la prévision à l'heure, je pourrais conditionner mon seuil de déclenchement plus en adéquation avec le moment où le soleil sera au top.

Pour l'exemple d'aujourd'hui, mon ballon s'est lancé le matin trop tot car ma QA a considéré qu'il aurait fait nuageux toute la journée ce qui n'a pas été le cas et confirmé par une simple application météo comme LA chaine météo ou encore météo ciel par exemple.

 

Voilà ma petite question :)

 

 

 

Partager ce message


Lien à poster
Partager sur d’autres sites

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

Partager ce message


Lien à poster
Partager sur d’autres sites

L'API marche-t-elle toujours de votre côté?

chez moi pas de réponse aux requêtes.

Leur site ne mentionne aucun plantage de l'API

Partager ce message


Lien à poster
Partager sur d’autres sites

j'ai Error : Connection timed out

Partager ce message


Lien à poster
Partager sur d’autres sites

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

 

Modifié par couillerot
  • Like 1

Partager ce message


Lien à poster
Partager sur d’autres sites

Non c'est un mystère quand je tape url dans un navigateur je n'ai pas de réponse sauf: le serveur sur lequel cette page est située ne répond pas ....

idem pour https://api.weatherbit.io/

Partager ce message


Lien à poster
Partager sur d’autres sites

bon j'ai essayé en dehors de chez moi et ca marche nickel.... 

Mystère j'ai pas de souci de dns chez moi pourant. Peut etre m'ont ils blacklisté???

Partager ce message


Lien à poster
Partager sur d’autres sites

Bon en fait c'était un pb de firewall de mon côté.... merci pour votre aide. !!!

Partager ce message


Lien à poster
Partager sur d’autres sites

[12.11.2023] [21:10:08] [DEBUG] [QUICKAPP68]: Error : status=429

Hello

 

j'ai une erreur sur cette QA, peut être depuis la derniere mise à jour ?

 

 

 

Édit : fausse alerte c’est ok ce matin , plantage des serveurs météo peut être hier

Partager ce message


Lien à poster
Partager sur d’autres sites

Hello, j'ai une erreur 403 sur cette QA ... je pense pas que cela vienne de la clé API car j'avais crée 1 clé par QA.

 

ca fonctionne chez vous ?

Partager ce message


Lien à poster
Partager sur d’autres sites

×