Aller au contenu

sebcbien

Membres confirmés
  • Compteur de contenus

    4 189
  • Inscription

  • Dernière visite

  • Jours gagnés

    85

Tout ce qui a été posté par sebcbien

  1. Je viens de vérifier, la dernière version de github est exactement identique à celle que j'utilise. Vous êtes sur d'avoir la dernière version ? Pourriez-vous activer le Show_extra_debug et poster le log ? Votre config de variables complète Et aussi la fonction complète autour de la ligne de l'erreur, pcq les No de ligne varieent d'une config à l'autre et me dire si y'a quelquechose qui fonctionne (si c'est l'exit uniquement ou si ça ne démarre même pas ou ...
  2. note: dans le dernier, j'ai aussi rajouté des notifications pour une valeur X de la ram. lazer way, as usual -> sms email push
  3. sebcbien

    Ici On Parle Lifedomus

    Belle baraque pitp2 ! Ceci dit, j'ai du mal àsaisir l'utilité d'unetelle interface, c'est joli mais pas pratique/inutile àmon sens... a moins qu'il n'y aie une tablette dans chaque pièce avec la page de la pièce ?
  4. partie de gauche ? les deux échelles ? Il faut associer les inputs à left et le uptime à right
  5. Pouir le setup emon cms 1) récupérer votre clef de l'api 2) le VD crée tout seul des inputs. 3) pour mémoriser ces inputs dans emoncms, il faut créer un feed SETUP/INPUTS->clef à molette à droite de l'input->en haut de la page log to feed/create new/feedengine=fixed interval with average/30s -> add 4) si vous allez dans SETUP/FEED, après quelques minutes vous devriez voir des graphiques en cliquant sur l'oeil de chaque feed 5)pour crée un multigraphe (superposition de plusieurs graphes) allez dans EXTRA/VISUALISATIONS - select visualisation: multigraph - new multigraph - ajouter les feeds sur l'échelle de gauche et le uptime sur l'échelle de droite 6) ensuite SETUP/DASHBOARD - new - editez le - ensuite visualisation/multigraph - selectionnez l'emplacement - selectionnez le - configure - selectionnez le bon - save - save - puis le petit oeil en haut à droite pour passer en visualisation Et voilà
  6. Bon, voici ma dernière version, rien de très léché mais ça marche depuis deux jours... Le double click pour reboot déconne (1 click et la box reboote !!) mais je pense que vous préférez l'avoir comme ça ;-) J'ai aussi ajouté des notifications pour les dépassements Pour la V2, voir ici: http://www.domotique-fibaro.fr/index.php/topic/3719-module-virtuel-hc2-diagnostics/page-4#entry122558 HC2_Diagnostics.vfib
  7. Je posterai le vd ce soir et deux trois mots sur emoncms. Làje suis encore àla bourre :+/ Sent from my Note4
  8. Si on te le demande, tu diras que tu ne sais pas ;-) Sent from my Note4
  9. Ah oui je comprends, beau projet, mais yaps n'a vraiment pas l'architecture pour cela. Sent from my Note4
  10. De mémoire. Tu dois créer un feed simple avec un intervalle de +-30s. Ensuite tu dois créer un graphe type multigraph. Sent from my Note4
  11. ca avance. Ici on voit un reboot. Avant le reboot, on voit que la HC2 peut aussi libérer de la ram... je peux avec ce vd rebooter à une valeur X de la ram.
  12. Merci Nikko, c'est implémenté, un peu différemment car api.get ne fonctionne pas en vd apparemment. Ceci dit, première conclusion: emoncms était down pendant 2h... ça a fait monter la ram utilisée de quelques %, quand emoncms a de nouveau répondu, la ram est retombée à son niveau de départ... Pour tant il y a une gestion d'erreur dans mes scripts... Voici le code de mon vd diagnostic avec push vers emoncms: Y'a plus beau comme code mais je n'ai pas de temps pour fignoler. bouton refresh: local thismodule = fibaro:getSelfId(); local EmonCMS_Prefix = "HC2_DIAG_"; local PushToEmonCMS = true; -- true = push to emoncms - false = do not push local emoncms = Net.FHttp("emoncms.org",80); local emoncms_api_key = "xxxxxxxxxxxxxxxxxxxxxxxxxx"; -- your EMONCMS WRITE api Key local emoncms_ok = true EmonCMS = {}; function EmonCMS:Push(payloademon) fibaro:debug("Payload: " .. payloademon) ; if emoncms_ok then payloademon = "/input/post.json?json={" .. EmonCMS_Prefix .. payloademon .. "}&apikey=" .. emoncms_api_key; response, status, errorCode = emoncms:GET(payloademon); if status ~= "200" then emoncms_ok = false fibaro:debug("error response, oborting all push. - ".."response: " .. response .. " Status: " .. status .. " errorcode: " .. errorCode) ; end fibaro:sleep(500); end end function timestampToDate(nTimestamp) -- Convertit un Timestamp en date lisible return os.date("%d/%m/%y à %X", nTimestamp) end function SecondsToClock(sSeconds) -- Convertit un Timestamp en durée (code krikoff) local nSeconds = tonumber(sSeconds) if nSeconds == 0 then return "00:00:00"; else nHours = string.format("%02.f", math.floor(nSeconds/3600)); nMins = string.format("%02.f", math.floor(nSeconds/60 - (nHours*60))); nSecs = string.format("%02.f", math.floor(nSeconds - nHours*3600 - nMins *60)); return nHours.." H "..nMins.." Min et "..nSecs.. " s" end end function Minutes(sSeconds) -- Convertit un Timestamp en durée (code krikoff) local nSeconds = tonumber(sSeconds) if nSeconds == 0 then return "00"; else nMinutes = string.format("%02.f", math.floor(nSeconds/60)); return nMinutes end end local HC2 = Net.FHttp("127.0.0.1",11111); local response, status, errorCode = HC2:GET("/api/settings/info"); if tonumber(status) == 200 then local result = json.decode(response); fibaro:debug("HC2 allumée depuis " .. Minutes(os.time()-result.serverStatus).." minutes. Soit "..SecondsToClock(os.time()-result.serverStatus)) end function round(num) local a = math.floor(num*100 + 0.5)/ 100; return a,string.format("%.2f",a); end local vId = fibaro:getSelfId(); local HC2 = Net.FHttp("127.0.0.1",11111); local response, status, errorCode = HC2:GET("/api/diagnostics"); if tonumber(status) == 200 then local result = json.decode(response); --Utilisation de la RAM local ramused = tonumber(result.memory.used); local ramfree = 100 - ramused; ramused_pct = ramused .. "%"; ramfree_pct = ramfree .. "%"; fibaro:call(vId,"setProperty","ui.vlRAM0.value", "Utilisé : " .. ramused_pct); fibaro:call(vId,"setProperty","ui.vlRAM1.value", "Disponible : " .. ramfree_pct); --Partition système local sused = tonumber(result.storage.internal[1].used); local sfree = 100 - sused; sused = sused .. "%"; sfree = sfree .. "%"; fibaro:call(vId,"setProperty","ui.vlSystem0.value", "Utilisé : " .. sused); fibaro:call(vId,"setProperty","ui.vlSystem1.value", "Disponible : " .. sfree); --Partition recovery local rused = tonumber(result.storage.internal[2].used); local rfree = 100 - rused; rused = rused .. "%"; rfree = rfree .. "%"; fibaro:call(vId,"setProperty","ui.vlRecovery0.value", "Utilisé : " .. rused); fibaro:call(vId,"setProperty","ui.vlRecovery1.value", "Disponible : " .. rfree); --Charge CPU local cpu0_puser = tonumber(result.cpuLoad[1].cpu0.user); local cpu1_puser = tonumber(result.cpuLoad[2].cpu1.user); local cpu0_pnice = tonumber(result.cpuLoad[1].cpu0.nice); local cpu1_pnice = tonumber(result.cpuLoad[2].cpu1.nice); local cpu0_psystem = tonumber(result.cpuLoad[1].cpu0.system); local cpu1_psystem = tonumber(result.cpuLoad[2].cpu1.system); local cpu0_pidle = tonumber(result.cpuLoad[1].cpu0.idle); local cpu1_pidle = tonumber(result.cpuLoad[2].cpu1.idle); local cpu0_PREVTOTAL = (cpu0_puser + cpu0_pnice + cpu0_psystem + cpu0_pidle); local cpu1_PREVTOTAL = (cpu1_puser + cpu1_pnice + cpu1_psystem + cpu1_pidle); fibaro:sleep(1000); local HC21 = Net.FHttp("127.0.0.1",11111); local response1, status1, errorCode1 = HC2:GET("/api/diagnostics"); if tonumber(status1) == 200 then local result1 = json.decode(response1); local cpu0_user = tonumber(result1.cpuLoad[1].cpu0.user); local cpu1_user = tonumber(result1.cpuLoad[2].cpu1.user); local cpu0_nice = tonumber(result1.cpuLoad[1].cpu0.nice); local cpu1_nice = tonumber(result1.cpuLoad[2].cpu1.nice); local cpu0_system = tonumber(result1.cpuLoad[1].cpu0.system); local cpu1_system = tonumber(result1.cpuLoad[2].cpu1.system); local cpu0_idle = tonumber(result1.cpuLoad[1].cpu0.idle); local cpu1_idle = tonumber(result1.cpuLoad[2].cpu1.idle); local cpu0_TOTAL = (cpu0_user + cpu0_nice + cpu0_system + cpu0_idle); local cpu1_TOTAL = (cpu1_user + cpu1_nice + cpu1_system + cpu1_idle); local cpu0_Percentage = ( ( (cpu0_TOTAL - cpu0_PREVTOTAL) - (cpu0_idle - cpu0_pidle) ) / (cpu0_TOTAL - cpu0_PREVTOTAL) ) * 100; local cpu1_Percentage = ( ( (cpu1_TOTAL - cpu1_PREVTOTAL) - (cpu1_idle - cpu1_pidle) ) / (cpu1_TOTAL - cpu1_PREVTOTAL) ) * 100; cpu0_Percentage = round(cpu0_Percentage); cpu1_Percentage = round(cpu1_Percentage); cpu0_Percentage_pct = cpu0_Percentage .. "%"; cpu1_Percentage_pct = cpu1_Percentage .. "%"; fibaro:call(vId,"setProperty","ui.vlCPU0.value", "Coeur 1 : " .. cpu0_Percentage_pct); fibaro:call(vId,"setProperty","ui.vlCPU1.value", "Coeur 2 : " .. cpu1_Percentage_pct); if PushToEmonCMS then payloademon = "CPU_0:" .. cpu0_Percentage; -- /1000 = convert to m3 EmonCMS:Push(payloademon); payloademon = "CPU_1:" .. cpu1_Percentage; -- /1000 = convert to m3 EmonCMS:Push(payloademon); payloademon = "RAM_USED:" .. ramused; EmonCMS:Push(payloademon); payloademon = "RAM_FREE:" .. ramfree; EmonCMS:Push(payloademon); payloademon = "MINUTES_UP:" .. nMinutes; EmonCMS:Push(payloademon); end end else fibaro:debug("Try again "..deviceID.. " "..status) end mainloop: -- 1ère fois que le main loop s'exécute, on crée une variable nommée "instance" car elle n'existe pas. Elle existera au 2ème passage donc ne sera pas recrée. if (not instance) then -- on indique la fréquence d'execution souhaitée (en minutes) instance = { lastrun = 0, every = 1 } fibaro:debug("first run") end -- on vérifie la différence entre cette exéction et la dernière (stocké dans instance.lastrun) diff = os.date("*t", os.difftime(os.time(), instance.lastrun)) -- si la différence en minutes et supérieure ou égale à la fréquence souhaitée (instance.every) if (diff.min >= instance.every) then fibaro:sleep(1*240) -- delay to smooth the charge (same for netatmo & vmc) -- TON CODE --- local selfId = fibaro:getSelfId(); fibaro:call(selfId, "pressButton", "13") -- FIN DE TON CODE --- -- on stock l'heure de la nouvelle exécution instance.lastrun = os.time() fibaro:debug("executed") end
  13. c parti mon kiki :-) btw, une idée de la syntaxe pour récupérer le nombre d'heures "up" de la hc2 ?
  14. Salut Yohan, Je vois deux problèmes: 1) je n'en ai pas donc oui pour tester ça risque de prendre du temps 2) la logique d'allumage et d'extinction des lampes aléatoirement n'est pas du tout adapté à mon sens à des volets... voir un volet qui s'ouvre puis se ferme 3 minutes après, se ré-ouvre 20 minutes plus tard en pleine nuit... etc. Pour moi c'est le boulôt d'un autre VD, avec une autre logique...
  15. Comme promis, voici la version 3.9 avec les notification Email, sms, push, @lazer style. YAMS_WU V3.9.vfib Et voici le code du main loop: ------------------------------------------------------------------------------------------- -- WU WeatherData - Fetch weather data from wunderground.com. Multilanguage support! -- Original Code by Jonny Larsson 2015 http://forum.fibaro.com/index.php?/topic/19810-wu-weatherdata-version-202-2015-10-25/ -- Forked by Sébastien Jauquet 11/2015 http://www.domotique-fibaro.fr/index.php/topic/6446-yams-wu-yet-another-meteo-station-wunderground-version/ -- Inspired by GEA(steven), stevenvd, Lazer, Krikroff and many other users. -- Source - forum.fibaro.com, domotique-fibaro.fr and worldwideweb -- 2014-03-22 - Permissions granted from Krikroff -- 2014-03-23 - Added rain and forecast, Added FR language. -- 2014-03-23 - Language variable changed to get the translation from wunderground.com in forcast -- 2014-03-24 - Added PL language -- 2014-03-24 - Select between PWS or LOCID to download weather data -- 2015-10-23 - New source code. -- 2015-11-16 - Permissions granted from Jonny Larsson -- 2015-11-13 - V3.0 - Fork Code by Sebastien Jauquet (3 days forecast, rain in mm) -- 2015-11-14 - V3.1 - Compatibilty with GEA, French translation -- 2015-11-14 - V3.2 - Catch rain errors (-999mm null empty etc.) -- 2015-11-14 - V3.3 - Catch json decode error (was stopping main loop) with pcall (can be extended to other jdon datas if needed) -- 2015-11-16 - V3.4 - Generate HTML and non HTML version (for compatibility with mobiles) -- 2015-11-18 - V3.5 - Fixed bug not updating Meteo_Day becaus WU.now was only updated at first launch -- 2015-11-18 - V3.6 - Merged some changes from jompa new version -- 2015-11-18 - Added autmatic creation of Global Variables if not existing -- 2015-11-19 - V3.7 - Modify schedule management and CleanUp code -- 2015-11-22 - V3.8 - Finalise mobile version and bug fixing -- 2015-11-23 - V3.9 - Added multiple notification options (Lazer way) -- Look for nearest station here: http://www.wunderground.com ------------------------------------------------------------------------------------------- -- MAIN CODE -- ------------------------------------------------------------------------------------------- WU = {}; -- WU settings WU.APIkey = "XXXXXXXXXxxxxxXX"; -- Put your WU api key here WU.PWS = "IGVLEBOR5"; -- The PWS location to get data from (Personal Weather Station) WU.LOCID = "SWXX0076"; -- The location ID to get data from (City location) WU.station = "PWS"; -- Choose your prefered method to retrieve from: PWS or LOCID -- notifications WU.notifications = true; -- send notifications WU.push_fcst1 = "11:30"; -- time when forecast for today will be pushed to smartphone WU.push_fcst2 = "18:15"; -- time when forecast for tonight will be pushed to smartphone WU.notificationTypes = {"push", "email"}; -- notification types {"push", "email", "sms"} WU.smartphoneID = {1347}; -- Smartphone Id to send push to. {id1, id2, id3} WU.userID = {2}; -- User Id to send email to. {id1, id2, id3} WU.sms = { ["VD_ID"] = 0, -- Virtual Device ID ["VD_Button"] = "1", -- Virtual Device Button ["VG_Name"] = "SMS"}; -- Global Variable Name WU.debug_messages = false; -- Diplay debug for notifications -- Other settings WU.translation = {true}; WU.language = "FR"; -- EN, FR, SW, PL (default is en) WU.GEA = true; -- subst % with %% when storing in the VG's (because gea bug with % in push messages) WU.CreateVG = true; -- will atomaticaly create global variables at first run if = true WU.updateEvery = 30; -- get data every xx minutes -- Do not change WU.startTime = os.time(); WU.scheduler = os.time()+60*WU.updateEvery; WU.currentDate = os.date("*t"); WU.now = os.date("%H:%M"); WU.DoNotRecheckBefore = os.time(); WU.selfId = fibaro:getSelfId(); WU.version = "3.9"; WU.translation["EN"] = { Push_forecast = "Push forecast", Exiting_loop_slider = "Exiting loop earlier (Slider Changed)", Exiting_loop_push = "Exiting loop earlier (For push)", Last_updated = "Last updated", Temperature = "Temperature", Humidity = "Humidity", Pressure = "Pressure", Wind = "Wind", Rain = "Rain", Forecast = "Forecast", EmailSubject = "Meteo of this", Station = "Station", Fetched = "Fetched", Data_processed = "Data processed", Update_interval = "Next update will be in (min)", No_data_fetched = "No data fetched", NO_STATIONID_FOUND = "No stationID found", NO_DATA_FOUND = "No data found" }; WU.translation["FR"] = { Push_forecast = "Push des prévisions", Exiting_loop_slider = "Sortie de boucle (Slider Changé)", Exiting_loop_push = "Sortie de boucle (Pour Push)", Last_updated = "Mise à jour", Temperature = "Actuellement", Humidity = "Hum", Pressure = "Pression", Wind = "Vent", Rain = "Pluie", Forecast = "", EmailSubject = "Météo de ce", Station = "Station", Fetched = "Données reçues", Data_processed = "Données mises à jour", Update_interval = "Prochaine Mise à jour prévue dans (min)", No_data_fetched = "Pas de données reçues !!", NO_STATIONID_FOUND = "StationID non trouvée !!", NO_DATA_FOUND = "Pas de données disponibles !!" }; WU.translation["SW"] = { Push_forecast = "Push forecast", Exiting_loop_slider = "Exiting loop earlier (Slider Changed)", Exiting_loop_push = "Exiting loop earlier (For push)", Last_updated = "Last updated", Temperature = "Temperatur", Humidity = "Fuktighet", Pressure = "Barometer", Wind = "Vind", Rain = "Regn", Forecast = "Prognos", EmailSubject = "Meteo of this", Station = "Station", Fetched = "Hà¤mtat", Data_processed = "All data processat", Update_interval = "Nà¤sta uppdatering à¤r om (min)", No_data_fetched = "Inget data hà¤mtat", NO_STATIONID_FOUND = "StationID ej funnet", NO_DATA_FOUND = "Ingen data hos WU" }; WU.translation["PL"] = { Push_forecast = "Push prognoza", Exiting_loop_slider = "Exiting loop earlier (Slider Changed)", Exiting_loop_push = "Exiting loop earlier (For push)", Last_updated = "Last updated", Temperature = "Temperatura", Humidity = "Wilgotnosc", Pressure = "Pressure", Wind = "Wiatr", Rain = "Rain", Forecast = "Forecast", EmailSubject = "Meteo of this", Station = "Station", Fetched = "Fetched", Data_processed = "Data processed", No_data_fetched = "No data fetched", Update_interval = "Next update will be in (min)", NO_STATIONID_FOUND = "No stationID found", NO_DATA_FOUND = "No data found" }; WU.translation["NL"] = { Push_forecast = "Push verwachting", Exiting_loop_slider = "Exiting loop earlier (Slider Changed)", Exiting_loop_push = "Exiting loop earlier (For push)", Last_updated = "Last updated", Temperature = "Temperatuur", Humidity = "Vochtigheid", Pressure = "Druk", Wind = "Wind", Rain = "Regen", Forecast = "Verwachting", EmailSubject = "Meteo of this", Station = "Weerstation", Fetched = "Ontvangen", Data_processed = "Gegevens verwerkt", Update_interval = "Volgende update in (min)", No_data_fetched = "Geen gegevens ontvangen", NO_STATIONID_FOUND = "Geen stationID gevonden", NO_DATA_FOUND = "Geen gegevens gevonden" }; WU.translation["DE"] = { Push_forecast = "Push vorhersage", Exiting_loop_slider = "Exiting loop earlier (Slider Changed)", Exiting_loop_push = "Exiting loop earlier (For push)", Last_updated = "Last updated", Temperature = "Temperatur", Humidity = "Luftfeuchtigkeit", Pressure = "Luftdruck", Wind = "Wind", Rain = "Regen", Forecast = "Vorhersage", EmailSubject = "Meteo of this", Station = "Station", Fetched = "Abgerufen", Data_processed = "Daten verarbeitet", No_data_fetched = "Keine Daten abgerufen", Update_interval = "Das nà¤chste Update in (min)", NO_STATIONID_FOUND = "Keine stationID gefunden", NO_DATA_FOUND = "Keine Daten gefunden" }; Debug = function (color, message) if color and color ~= "" then fibaro:debug('<span style="color:'..color..';">'..message..'</span>'); else fibaro:debug(message); end end WU.notification = function(message, subject, param) local message = message or "<vide>"; if WU.debug_messages then Debug("yellow", "Notification : "..message); end if param then for _, notif in ipairs(param) do if WU.debug_messages then Debug("grey", notif); end -- Envoi Push if notif == "push" and WU.smartphoneID then for _, id in ipairs(WU.smartphoneID) do if WU.debug_messages then Debug("grey", "Send Push smartphone ID : "..id); end fibaro:call(id, "sendPush", message); end -- Envoi Email elseif notif == "email" and WU.userID then for _, id in ipairs(WU.userID) do if WU.debug_messages then Debug("grey", "Send Email user ID : "..id); end fibaro:call(id, "sendEmail", subject, message); end -- Envoi SMS elseif notif == "sms" and WU.sms then if WU.debug_messages then Debug("grey", "Send SMS : VD_ID="..(WU.sms["VD_ID"] or 0).." VD_Button="..(WU.sms["VD_Button"] or "0").." VG_Name="..(WU.sms["VG_Name"] or "")); end fibaro:setGlobal(WU.sms["VG_Name"], message); if WU.sms["VD_ID"] and tonumber(WU.sms["VD_ID"])>0 and WU.sms["VD_Button"] and tonumber(WU.sms["VD_Button"])>0 then fibaro:call(WU.sms["VD_ID"], "pressButton", WU.sms["VD_Button"]); end end end else Debug("orange", "Warning : no notification options given"); end end WU.createGlobalIfNotExists = function(varName, defaultValue) if (fibaro:getGlobal(varName) == "") then Debug("red", "Global Var: "..varName.." HAS BEEN CREATED"); newVar = {}; newVar.name = varName; HC2 = Net.FHttp("127.0.0.1", 11111); HC2:POST("/api/globalVariables", json.encode(newVar)); end end WU.substPercent = function(doublePercentSymbol) if WU.GEA then doublePercentSymbol = string.gsub(doublePercentSymbol, "%%.", "%%%%"); end return doublePercentSymbol; end WU.cleanJson = function(jsontocheck,returnIfTrue) if jsontocheck == "-999.00" or jsontocheck == "--" or jsontocheck == json.null then jsontocheck = returnIfTrue; end local ok = pcall(function() testConcatenate = "Test Concatenate: " .. jsontocheck; -- test for non concatenate value end ) if (not ok) then decode_error = true; Debug( "red", "decode raised an error"); if WU.notifications then WU.notification("decode error in WU Meteo","Got a Decode Error in WU Meteo.", WU.notificationTypes); end end return jsontocheck; end WU.HtmlColor = function(StringToColor,color) if MobileDisplay == false then StringToColor= "<font color=\""..color.."\"> "..StringToColor.."</font>"; end return StringToColor; end WU.IconOrText = function(icon,txt) if MobileDisplay == false then IconOrText = "<img src="..icon.."\>"; else IconOrText = txt; end return IconOrText; end WU.HtmlOrText = function(_html,txt) if MobileDisplay == false then HtmlOrText = _html; else HtmlOrText = txt; end return HtmlOrText; end WU.getSlider = function() ValeurSliderfunct = fibaro:getValue(WU.selfId , "ui.WebOrMobile.value"); return tonumber(ValeurSliderfunct); end WU.setSlider = function(position) fibaro:call(WU.selfId , "setProperty", "ui.WebOrMobile.value", position); return WU.getSlider(); end WU.checkMobileOrWeb = function() ValeurSliderSleep = WU.getSlider(); -- check slider value at first run if ValeurSliderSleep <= 50 then if ValeurSliderSleep == 1 then MobileDisplay = false; else MobileDisplay = false; WU.runDirect = 1; sleepAndcheckslider = 20*WU.updateEvery; -- exit wait loop Debug("orange", WU.translation[WU.language]["Exiting_loop_slider"]); end WU.setSlider(1); -- désactive le run immediat lors du prochain test end if ValeurSliderSleep >= 50 then if ValeurSliderSleep == 98 then else MobileDisplay = true; WU.runDirect = 1; sleepAndcheckslider = 20*WU.updateEvery; -- exit wait loop Debug("orange", WU.translation[WU.language]["Exiting_loop_slider"]); end WU.setSlider(98); -- désactive le run immediat lors du prochain test end return WU.getSlider(); end WU.fetchWU = function() decode_error = false; WU.checkMobileOrWeb(); local WGROUND = Net.FHttp("api.wunderground.com",80); local response ,status, err = WGROUND:GET("/api/"..WU.APIkey.."/conditions/forecast/lang:"..WU.language.."/q/"..WU.station..":"..locationID..".json"); if (tonumber(status) == 200 and tonumber(err)==0) then Debug( "cyan", WU.translation[WU.language]["Fetched"]); if (response ~= nil) then WU.now = os.date("%H:%M"); jsonTable = json.decode(response); if jsonTable.response.error ~= nil then Debug( "red", WU.translation[WU.language]["NO_DATA_FOUND"]); fibaro:sleep(15*1000); Debug( "yellow", WU.translation[WU.language]["NO_DATA_FOUND"]); fibaro:sleep(15*1000); return end stationID = jsonTable.current_observation.station_id; humidity = jsonTable.current_observation.relative_humidity; temperature = jsonTable.current_observation.temp_c; pression = jsonTable.current_observation.pressure_mb; wind = jsonTable.current_observation.wind_kph; rain = WU.cleanJson(jsonTable.current_observation.precip_today_metric,"0"); weathericon = jsonTable.current_observation.icon_url; -- Day meteo fcstday1 = jsonTable.forecast.txt_forecast.forecastday[1].title; fcst1 = jsonTable.forecast.txt_forecast.forecastday[1].fcttext_metric; fcst1icon = jsonTable.forecast.txt_forecast.forecastday[1].icon_url; -- Evening Meteo fcstday2 = jsonTable.forecast.txt_forecast.forecastday[2].title; fcst2 = jsonTable.forecast.txt_forecast.forecastday[2].fcttext_metric; fcst2icon = jsonTable.forecast.txt_forecast.forecastday[2].icon_url; -- Tomorrow Meteo fcstday3 = jsonTable.forecast.txt_forecast.forecastday[3].title; fcst3 = jsonTable.forecast.txt_forecast.forecastday[3].fcttext_metric; fcst3icon = jsonTable.forecast.txt_forecast.forecastday[3].icon_url; -- In 2 days fcstday5 = jsonTable.forecast.txt_forecast.forecastday[5].title; fcst5 = jsonTable.forecast.txt_forecast.forecastday[5].fcttext_metric; fcst5icon = jsonTable.forecast.txt_forecast.forecastday[5].icon_url; -- SimpleForecast Today fcst1SmallTxt = jsonTable.forecast.simpleforecast.forecastday[1].conditions; fcst1Tmax = jsonTable.forecast.simpleforecast.forecastday[1].high.celsius; fcst1Tmin = jsonTable.forecast.simpleforecast.forecastday[1].low.celsius; fcst1avewind =jsonTable.forecast.simpleforecast.forecastday[1].avewind.kph; fcst1avewinddir =jsonTable.forecast.simpleforecast.forecastday[1].avewind.dir; fcst1mm = WU.cleanJson(jsonTable.forecast.simpleforecast.forecastday[1].qpf_day.mm,"0"); -- SimpleForecast Tomorrow fcst2SmallTxt = jsonTable.forecast.simpleforecast.forecastday[2].conditions; fcst2Tmax = jsonTable.forecast.simpleforecast.forecastday[2].high.celsius; fcst2Tmin = jsonTable.forecast.simpleforecast.forecastday[2].low.celsius; fcst2avewind =jsonTable.forecast.simpleforecast.forecastday[2].avewind.kph; fcst2avewinddir =jsonTable.forecast.simpleforecast.forecastday[2].avewind.dir; fcst2mm = WU.cleanJson(jsonTable.forecast.simpleforecast.forecastday[2].qpf_night.mm,"0"); -- In 2 days fcst3SmallTxt = jsonTable.forecast.simpleforecast.forecastday[3].conditions; fcst3Tmax = jsonTable.forecast.simpleforecast.forecastday[3].high.celsius; fcst3Tmin = jsonTable.forecast.simpleforecast.forecastday[3].low.celsius; fcst3avewind =jsonTable.forecast.simpleforecast.forecastday[3].avewind.kph; fcst3avewinddir =jsonTable.forecast.simpleforecast.forecastday[3].avewind.dir; fcst3mm = WU.cleanJson(jsonTable.forecast.simpleforecast.forecastday[3].qpf_allday.mm,"0"); if (stationID ~= nil) and decode_error == false then fibaro:call(WU.selfId , "setProperty", "ui.lblStation.value", locationID); if temperature < 5 then cTemperature = WU.HtmlColor(temperature,"00bfff"); elseif temperature > 18 then cTemperature = WU.HtmlColor(temperature,"ff4500"); else cTemperature = WU.HtmlColor(temperature,"ffd700"); end fibaro:call(WU.selfId , "setProperty", "ui.lblTempHum.value", WU.translation[WU.language]["Temperature"]..": "..cTemperature.." °C - "..WU.translation[WU.language]["Humidity"]..": "..humidity); fibaro:call(WU.selfId , "setProperty", "ui.lblWindRain.value", WU.translation[WU.language]["Wind"]..": "..wind.." km/h - "..WU.translation[WU.language]["Rain"]..": "..rain.." mm"); if (WU.now >= "03:00" and WU.now <= "15:59") then -- donne meteo du jour entre 00:00 (ou 3h) et 15:59. permet de garder la météo du soir jusqu'a 3h du matin, sinon change à minuit fibaro:call(WU.selfId , "setProperty", "ui.lblFcst.value", WU.HtmlOrText( WU.HtmlColor(WU.translation[WU.language]["Forecast"],"c0c0c0").." "..WU.HtmlColor(fcstday1,"ff4500")..": "..WU.HtmlColor(fcst1.." ("..fcst1mm.." mm)","b0c4de"), "["..fcst1Tmax.."° "..fcst1Tmin.."°] | "..fcst1mm.."mm | "..fcst1avewind.."Km/h ("..fcst1avewinddir..")")); fibaro:call(WU.selfId , "setProperty", "ui.lblIcon.value",WU.IconOrText(fcst1icon,fcstday1..": "..fcst1SmallTxt)); fibaro:setGlobal("Meteo_Day", WU.substPercent(WU.translation[WU.language]["Forecast"].." "..fcstday1..": ".." "..fcst1.." ("..fcst1mm.." mm)") ); elseif (WU.now >= "16:00" and WU.now <= "23:59") then -- donne meteo soirée entre 16:00 et 23:59 fibaro:call(WU.selfId , "setProperty", "ui.lblFcst.value", WU.HtmlOrText( WU.HtmlColor(WU.translation[WU.language]["Forecast"],"c0c0c0").." "..WU.HtmlColor(fcstday2,"ff4500")..": "..WU.HtmlColor(fcst2.." ("..fcst1mm.." mm)","b0c4de"), "["..fcst1Tmax.."° "..fcst1Tmin.."°] | "..fcst1mm.."mm | "..fcst1avewind.."Km/h ("..fcst1avewinddir..")")); fibaro:call(WU.selfId , "setProperty", "ui.lblIcon.value",WU.IconOrText(fcst2icon,fcstday2..": "..fcst1SmallTxt)); fibaro:setGlobal("Meteo_Day", WU.substPercent(WU.translation[WU.language]["Forecast"].." "..fcstday2..": ".." "..fcst2.." ("..fcst1mm.." mm)") ); end -- Meteo of Tomorrow fibaro:call(WU.selfId , "setProperty", "ui.lblFcstTomorrow.value", WU.HtmlOrText( WU.HtmlColor(WU.translation[WU.language]["Forecast"],"c0c0c0").." "..WU.HtmlColor(fcstday3,"ff4500")..": "..WU.HtmlColor(fcst3.." ("..fcst2mm.." mm)","b0c4de"), "["..fcst2Tmax.."° "..fcst2Tmin.."°] | "..fcst2mm.."mm | "..fcst2avewind.."Km/h ("..fcst2avewinddir..")")); fibaro:call(WU.selfId , "setProperty", "ui.lblIconTomorrow.value",WU.IconOrText(fcst3icon,fcstday3..": "..fcst2SmallTxt)); fibaro:setGlobal("Meteo_Tomorrow", WU.substPercent(WU.translation[WU.language]["Forecast"].." "..fcstday3..": ".." "..fcst3.." ("..fcst2mm.." mm)") ); -- Meteo in 2 Days fibaro:call(WU.selfId , "setProperty", "ui.lblFcst2Days.value", WU.HtmlOrText( WU.HtmlColor(WU.translation[WU.language]["Forecast"],"c0c0c0").." "..WU.HtmlColor(fcstday5,"ff4500")..": "..WU.HtmlColor(fcst5.." ("..fcst3mm.." mm)","b0c4de"), "["..fcst3Tmax.."° "..fcst3Tmin.."°] | "..fcst3mm.."mm | "..fcst3avewind.."Km/h ("..fcst3avewinddir..")")); fibaro:call(WU.selfId , "setProperty", "ui.lblIcon2Days.value",WU.IconOrText(fcst5icon,fcstday5..": "..fcst3SmallTxt)); fibaro:setGlobal("Meteo_In_2_Days", WU.substPercent(WU.translation[WU.language]["Forecast"].." "..fcstday5..": ".." "..fcst5.." ("..fcst3mm.." mm)") ); if WU.notifications then if (os.date("%H:%M") == WU.push_fcst1) then WU.notification(fcstday1.." - "..fcst1.." ("..fcst1mm.." mm)" , WU.translation[WU.language]["EmailSubject"].." "..fcstday1 , WU.notificationTypes); -- Send Morning meteo elseif (os.date("%H:%M") == WU.push_fcst2) then WU.notification( fcstday2.." - "..fcst2.." ("..fcst2mm.." mm)" , WU.translation[WU.language]["EmailSubject"].." "..fcstday2 , WU.notificationTypes); -- Send evening meteo end end if WU.notifications then fibaro:call(WU.selfId , "setProperty", "ui.lblNotify.value", WU.translation[WU.language]["Push_forecast"].." = true"); else fibaro:call(WU.selfId , "setProperty", "ui.lblNotify.value",WU.translation[WU.language]["Push_forecast"].." = false"); end WU.scheduler = os.time()+WU.updateEvery*60; fibaro:call(WU.selfId, "setProperty", "ui.lblUpdate.value", WU.translation[WU.language]["Last_updated"]..": "..os.date("%c")); Debug( "cyan", WU.translation[WU.language]["Data_processed"]); Debug( "white", WU.translation[WU.language]["Update_interval"].." "..WU.updateEvery); else Debug( "red", WU.translation[WU.language]["NO_STATIONID_FOUND"]); end else fibaro:debug("status:" .. status .. ", errorCode:" .. errorCode); end end sleepAndcheckslider = 0; while sleepAndcheckslider <= 20*WU.updateEvery do fibaro:sleep(3000); WU.checkMobileOrWeb(); sleepAndcheckslider = sleepAndcheckslider+1; if (WU.DoNotRecheckBefore <= os.time()) and ((WU.scheduler == os.time) or (os.date("%H:%M") == WU.push_fcst1) or (os.date("%H:%M") == WU.push_fcst2)) then Debug("orange", WU.translation[WU.language]["Exiting_loop_push"]); WU.DoNotRecheckBefore = os.time()+60; sleepAndcheckslider = 20*WU.updateEvery; end end end Debug( "orange", "10/2015 - WU Weather - Original LUA Scripting by Jonny Larsson 2015"); Debug( "orange", "11/2015 - YAMS WU - Fork by Sébastien Jauquet"); Debug( "orange", "Version: "..WU.version); if WU.station == "LOCID" then locationID = WU.LOCID; elseif WU.station == "PWS" then locationID = WU.PWS; end if WU.CreateVG then WU.createGlobalIfNotExists("Meteo_Day", ""); WU.createGlobalIfNotExists("Meteo_Tomorrow", ""); WU.createGlobalIfNotExists("Meteo_In_2_Days", ""); end while true do WU.fetchWU(); end
  16. sebcbien

    Support Gea

    clap clap clap clap clap !!!
  17. perso avec ma méthode (php séparé) ça ne marche pas trop mal. Il y a juste l'état du relais qui ne remonte pas à tout les coups, sinon pour le reste ça fonctionne correctement. http://www.domotique-fibaro.fr/index.php/topic/3929-yagda-yet-another-graphic-data-analyser-netatmo-vmc-emoncms-json-viewer/page-2#entry83875
  18. le graphique, je peux m'en charger, fastoche ! Le push idem, il suffit d'inclure la fonction push de Lazer... fastoche bis Il faudra d'abord ne rien faire et attendre que ça plante pour essayer de dégager un "patern", qui ne sera probablement pas le même d'une box à l'autre. Ensuite mettre un paramètre treshold et time qui rebootera, fastoche aussi ! Quelqu'un a un vfib "patché" à partager ?
  19. C pcq ils vont sortir la v5 vendredi... Et 0 bugs. C Noël les gars ! ;-) Sent from my Note4
  20. Donc on pourrait programmer un reboot à4h du matin si la RAM > 75% ? Sent from my Note4
  21. Bonjour, Je compte utiliser la base de ce vd et de faire un push vers un service de graphes externe. Si j'ai des plantages, j'irai regarder les graphes et j'essayerai de voir si c'est lié à la ram. J'ai deux petites questions - Avec votre recul, ça ne sert à quelque-chose de monitorer la ram pour prévenir des plantages ? - est-ce que le vd du post 1 inclus les quelques modifications de code ci-dessus ? Merci :-)
  22. Alors ça je veut bien savoir comment faire pour monitorer la RAM... Je pousserait bien ça sur un graphique externe pour voir si c'est bien ça qui est àl'origine du plantage....Ceci dit, je n'en ai eu que un jusqu'ici... Sent from my Note4
  23. Attends 24h. J'ai eu aussi cette impression.À mon avis il y a des scripts de nettoyage, mises àjour etc qui tournent... Sent from my Note4
  24. Pour moi àpart les scèneactivation tout va bien mais je n'utilise pas la hc2 pour mon chauffage... Pas fou le belge... :-) Sent from my Note4
  25. Idem... Sent from my Note4
×
×
  • Créer...