Aller au contenu

Messages recommandés

Posté(e)

 Alors j'ai testé mais à  part l'annonce de passage du facteur, je n'ai rien et ça dans le debug.

[DEBUG] 10:22:11: line 91: attempt to compare number with string
[DEBUG] 14:22:12: line 91: attempt to compare number with string

Et ça répète 4 heures après l'annonce mais pas de led.

Posté(e)

salut @Did,

 

ah ben le bug de comparaison de 2 valeurs non comparables ;-)

 

Comme ceci plutot

j'ai rajoute un tonumber ligne 91

 

Dans alerte_bal c'est bien on ou OFF ?


--[[
%% properties
66 value
%% globals
--]]
 
------ User settings -----
local id_RGBs = {239, 545, 554} -- liste des IDs des RGBs concernés
local ProgRGB = 547 -- Programme "alerte" souhaité à  mettre sur les RGBs
local Tempo = 20 -- En secondes, durée de la mise sur le programme "ALERTE" des RGBs, avant remise des valeurs précédentes
local Debug = false -- true : affichage dans le debug/false : pas d'affichage
--------------------
 
--------- Limitation à  1 seule instance ---------
if (fibaro:countScenes() > 1) then
fibaro:abort()
end
----------------------------------------------
 
if Debug then
local currentdate = os.date("%d/%m/%Y %H:%M:%S")
fibaro:debug("Démarrage du script : " ..currentdate)
end
 
-- fonction split ----
 
function split(s, pattern, maxsplit)
  local pattern = pattern or ' '
  local maxsplit = maxsplit or -1
  local s = s
  local t = {}
  local patsz = #pattern
  while maxsplit ~= 0 do
    local curpos = 1
    local found = string.find(s, pattern)
    if found ~= nil then
      table.insert(t, string.sub(s, curpos, found - 1))
      curpos = found + patsz
      s = string.sub(s, curpos)
    else
      table.insert(t, string.sub(s, curpos))
      break
    end
    maxsplit = maxsplit - 1
    if maxsplit == 0 then
      table.insert(t, string.sub(s, curpos - patsz - 1))
    end
  end
  return t
end
----------
 
--------------function GetPutValueRGB----
function GetPutValueRGBs(id)
     for i = 1, #id_RGBs do
        -- Recup Couleur et programme des RGBs
        local result = split(fibaro:getValue(id_RGBs[i], "color"), ',')
        local Prog = tonumber(fibaro:getValue(id_RGBs[i], "currentProgramID"))
    
        -- Debug valeur result et prog
        if Debug then
        fibaro:debug("RGB num " ..id_RGBs[i].. " avait comme Couleur : " ..result[1]..","..result[2]..","..result[3]..","..result[4])
        fibaro:debug("RGB num " ..id_RGBs[i].. " était sur le Programme " ..Prog)
        end
        
        -- SI activation cellule 208, demarrage des RGB sur le programme ProgRGB
        if Debug then fibaro:debug("Mise des RGBs sur Programme : " ..ProgRGB) end
        fibaro:call(id_RGBs[i], "startProgram", ProgRGB)
            
        setTimeout(
            function()
             if Debug then fibaro:debug("Remise des valeurs précédentes sur les RGBs") end
                if ((result[1] == "0" and result[2] == "0" and result[3] == "0" and result[4] == "0") and (tonumber(Prog) > 0)) then
                    fibaro:call(id_RGBs[i], "startProgram", Prog)
                    if Debug then fibaro:debug("Prog " ..Prog.. " sur " ..id_RGBs[i]) end
                else
                    fibaro:call(id_RGBs[i], "setColor", result[1], result[2], result[3], result[4])
                    if Debug then fibaro:debug("Couleur sur : " ..id_RGBs[i]) end
                end
        end, Tempo*1000) --tempo
     end
end
----------
 
--- Message TTS ----
fibaro:call(535, "pressButton", 5)
fibaro:call(90, "pressButton", 1)
 
 
local Bal = (tonumber(fibaro:getValue(66, "value")) > 0)
local Alerte_Bal = fibaro:getGlobalValue("Alerte_Bal")
 -- Lancement fonction ---
if Bal and Alerte_Bal == "OFF"  then -- 66 value à  1 et Alerte_Bal à  ON (VG mise à  jour par GEA en focntion etat de 66)
    GetPutValueRGBs()
else
    fibaro:abort()
end

 

Posté(e)

 Merci, je vais essayer ça demain après midi.

Oui On (quand la boite vient d'être ouverte) et OFF.

Posté(e)

 Bon, c'est pareil, j'ai l'annonce TTS et pas de led et 4 heures après, une nouvelle annonce et pas de led (mais là , je n'en veux pas, ni d'annonce d'ailleurs).

Posté(e)

Salut &Did,

 

Je dois te faire mon MeaCulpa, je suis un gros débile..en fait il y a plus simple sans modifier ton parametrage du FGBS

 

Avec GEA et sans variable globale et sans rien dans l'entete de la scene

 : au changement d'etat du FGBS, on lance la scene

 --> tu auras donc ton icine active pdt les 4h pour reperer sur la tablette

 

A faire :

 - declarer dans tes ids de GEA ton FGBS : BAL dans l'exemple

- mettre dans l'entete de GEA : 66 value

 - reperer le numero de ta scene pour la boite aux lettres

 

Voici la ligne GEA :

-- Si FGBS à  1, lancement scene pour la boite aux lettres
GEA.add(id["BAL"], -1, "", {{"Scenario", numeroscene}}) 

Voici la scene

    --[[
    %% properties
    %% globals
    --]]
     
    ------ User settings -----
    local id_RGBs = {239, 545, 554} -- liste des IDs des RGBs concernés
    local ProgRGB = 547 -- Programme "alerte" souhaité à  mettre sur les RGBs
    local Tempo = 20 -- En secondes, durée de la mise sur le programme "ALERTE" des RGBs, avant remise des valeurs précédentes
    local Debug = false -- true : affichage dans le debug/false : pas d'affichage
    --------------------
     
    --------- Limitation à  1 seule instance ---------
    if (fibaro:countScenes() > 1) then
    fibaro:abort()
    end
    ----------------------------------------------
     
    if Debug then
    local currentdate = os.date("%d/%m/%Y %H:%M:%S")
    fibaro:debug("Démarrage du script : " ..currentdate)
    end
     
    -- fonction split ----
     
    function split(s, pattern, maxsplit)
      local pattern = pattern or ' '
      local maxsplit = maxsplit or -1
      local s = s
      local t = {}
      local patsz = #pattern
      while maxsplit ~= 0 do
        local curpos = 1
        local found = string.find(s, pattern)
        if found ~= nil then
          table.insert(t, string.sub(s, curpos, found - 1))
          curpos = found + patsz
          s = string.sub(s, curpos)
        else
          table.insert(t, string.sub(s, curpos))
          break
        end
        maxsplit = maxsplit - 1
        if maxsplit == 0 then
          table.insert(t, string.sub(s, curpos - patsz - 1))
        end
      end
      return t
    end
    ----------
     
    --------------function GetPutValueRGB----
    function GetPutValueRGBs(id)
         for i = 1, #id_RGBs do
            -- Recup Couleur et programme des RGBs
            local result = split(fibaro:getValue(id_RGBs[i], "color"), ',')
            local Prog = tonumber(fibaro:getValue(id_RGBs[i], "currentProgramID"))
        
            -- Debug valeur result et prog
            if Debug then
            fibaro:debug("RGB num " ..id_RGBs[i].. " avait comme Couleur : " ..result[1]..","..result[2]..","..result[3]..","..result[4])
            fibaro:debug("RGB num " ..id_RGBs[i].. " était sur le Programme " ..Prog)
            end
            
            -- SI activation cellule 208, demarrage des RGB sur le programme ProgRGB
            if Debug then fibaro:debug("Mise des RGBs sur Programme : " ..ProgRGB) end
            fibaro:call(id_RGBs[i], "startProgram", ProgRGB)
                
            setTimeout(
                function()
                 if Debug then fibaro:debug("Remise des valeurs précédentes sur les RGBs") end
                    if ((result[1] == "0" and result[2] == "0" and result[3] == "0" and result[4] == "0") and (tonumber(Prog) > 0)) then
                        fibaro:call(id_RGBs[i], "startProgram", Prog)
                        if Debug then fibaro:debug("Prog " ..Prog.. " sur " ..id_RGBs[i]) end
                    else
                        fibaro:call(id_RGBs[i], "setColor", result[1], result[2], result[3], result[4])
                        if Debug then fibaro:debug("Couleur sur : " ..id_RGBs[i]) end
                    end
            end, Tempo*1000) --tempo
         end
    end
    ----------
     
    --- Message TTS ----
    fibaro:call(535, "pressButton", 5)
    fibaro:call(90, "pressButton", 1)

     -- Lancement fonction ---
     GetPutValueRGBs()
Posté(e)

 Bonjour @pepite et merci pour ta réponse rapide, je mets plus de temps à  tester.

La scène de ma boite aux lettres doit être active?

Posté(e)

salut tout le monde j'essaye de faire une scène météo avec le RGBW mais j'y arrive pas es que quelqu'un peu m'aider à  finir mon code ou me dir le problème car moi et le LUA on est 2  :( merci d'avance 

--[[
%% autostart
%% properties
%% events
%% globals
Present_Tophe
3 Temperature
3 Humidity
3 WeatherConditionConverted
--]]

local sourceTrigger = fibaro:getSourceTrigger();
function tempFunc()
local currentDate = os.date("*t");
local startSource = fibaro:getSourceTrigger();
local Humidity = tonumber(fibaro:getValue(3, "Humidity"));
local OutsideTemperature = tonumber(fibaro:getValue(3, "Temperature"));
local WeatherCondition = fibaro:getValue(3, "WeatherConditionConverted");

fibaro:debug("OutsideTemperature " .. OutsideTemperature);
fibaro:debug("Humidity " .. Humidity);
fibaro:debug("WeatherCondition " .. WeatherCondition);

  if (
 ( (tonumber(os.date("%H%M")) >= tonumber(string.format("%02d%02d", "07", "00")) and tonumber(os.date("%H%M")) <= tonumber(string.format("%02d%02d", "07", "55"))) and (math.floor(os.time()/60)-math.floor(1458626400/60))%0 == 0 )
and
 ( tonumber(fibaro:getGlobalValue("Present_Tophe")) == tonumber("1") )
)
then
end

setTimeout(tempFunc, 60*1000)
end
if (sourceTrigger["type"] == "autostart") then
tempFunc()
else

local currentDate = os.date("*t");
local startSource = fibaro:getSourceTrigger();
if (
 ( (tonumber(os.date("%H%M")) >= tonumber(string.format("%02d%02d", "07", "00")) and tonumber(os.date("%H%M")) <= tonumber(string.format("%02d%02d", "07", "55"))) )
and
 ( tonumber(fibaro:getGlobalValue("Present_Tophe")) == tonumber("1") )
or
startSource["type"] == "other"
)
then
if(OutsideTemperature <= tonumber("20"))
then
fibaro:debug("vert");
fibaro:call(236, "setColor", "0", "255", "0", "0") -- vert
end
if(OutsideTemperature > tonumber("20"))
then
fibaro:debug("jaune");
fibaro:call(236, "setColor", "255", "255", "0", "0") -- jaune
end
if(Humidity >= tonumber("50"))
then
fibaro:debug("rouge");
fibaro:call(236, "setColor", "255", "0", "0", "0") -- rouge
end
if(Humidity >= tonumber("50") and OutsideTemperature < tonumber("20"))
then
fibaro:debug("blanc");
fibaro:call(236, "setColor", "255", "255", "255", "0") -- blanc
end
if(WeatherCondition == "rain")
then
fibaro:debug("bleu");
fibaro:call(236, "setColor", "0", "0", "255", "0") -- bleu
  end
end
  end 
Posté(e)

Une autre question vous faite comment pour copier vos script et les poser sur le forum avec les couleurs et tout ?

Posté(e)

Salut @domo,

 

Pour les jolies couleurs, mets ton code entre "<>" juste au dessus du cadre de réponse ;-)

 

Ton code ne fonctionnepas du tout ?

Qu'as tu dans ton debug ?

Posté(e)

 Salut @pepite et merci,

Ta solution avec la ligne GEA à  l'air de bien fonctionner, plus de rappel 4 heures après, il me reste à  tester avec un bandeau allumé avant la détection mais il n'y a pas de raison car le code est repris de celui des cellules qui tourne bien. Donc je laisse la scène de ma boite aux lettres active?

Posté(e)

voici le debug


 [DEBUG] 11:46:12: Humidity 67
[DEBUG] 11:46:12: WeatherCondition clear
[DEBUG] 11:47:12: OutsideTemperature 12
[DEBUG] 11:47:12: Humidity 67
[DEBUG] 11:47:12: WeatherCondition clear
[DEBUG] 11:48:12: OutsideTemperature 12
[DEBUG] 11:48:12: Humidity 67
[DEBUG] 11:48:12: WeatherCondition clear
[DEBUG] 11:49:12: OutsideTemperature 12
[DEBUG] 11:49:12: Humidity 67
[DEBUG] 11:49:12: WeatherCondition clear
[DEBUG] 11:50:12: OutsideTemperature 12
[DEBUG] 11:50:12: Humidity 67
[DEBUG] 11:50:12: WeatherCondition clear
[DEBUG] 11:51:12: OutsideTemperature 12
[DEBUG] 11:51:12: Humidity 67
[DEBUG] 11:51:12: WeatherCondition clear
[DEBUG] 11:52:12: OutsideTemperature 12
[DEBUG] 11:52:12: Humidity 67
[DEBUG] 11:52:12: WeatherCondition clear
[DEBUG] 11:53:12: OutsideTemperature 12
[DEBUG] 11:53:12: Humidity 67
[DEBUG] 11:53:12: WeatherCondition clear
[DEBUG] 11:54:12: OutsideTemperature 12
[DEBUG] 11:54:12: Humidity 67
[DEBUG] 11:54:12: WeatherCondition clear
[DEBUG] 11:55:12: OutsideTemperature 12
[DEBUG] 11:55:12: Humidity 67
[DEBUG] 11:55:12: WeatherCondition clear
[DEBUG] 11:56:12: OutsideTemperature 12
[DEBUG] 11:56:12: Humidity 67
[DEBUG] 11:56:12: WeatherCondition clear
[DEBUG] 11:57:12: OutsideTemperature 12
[DEBUG] 11:57:12: Humidity 67
[DEBUG] 11:57:12: WeatherCondition clear
[DEBUG] 11:58:12: OutsideTemperature 12
[DEBUG] 11:58:12: Humidity 67
[DEBUG] 11:58:12: WeatherCondition clear
[DEBUG] 11:59:12: OutsideTemperature 12
[DEBUG] 11:59:12: Humidity 67
[DEBUG] 11:59:12: WeatherCondition clear
[DEBUG] 12:00:12: OutsideTemperature 12
[DEBUG] 12:00:12: Humidity 67
[DEBUG] 12:00:12: WeatherCondition clear
[DEBUG] 12:01:12: OutsideTemperature 12
[DEBUG] 12:01:12: Humidity 67
[DEBUG] 12:01:12: WeatherCondition clear
[DEBUG] 12:02:12: OutsideTemperature 12
[DEBUG] 12:02:12: Humidity 67
[DEBUG] 12:02:12: WeatherCondition clear
[DEBUG] 12:03:12: OutsideTemperature 12
[DEBUG] 12:03:12: Humidity 67
[DEBUG] 12:03:12: WeatherCondition clear
[DEBUG] 12:04:12: OutsideTemperature 12
[DEBUG] 12:04:12: Humidity 67
[DEBUG] 12:04:12: WeatherCondition clear
[DEBUG] 12:05:12: OutsideTemperature 12
[DEBUG] 12:05:12: Humidity 67
[DEBUG] 12:05:12: WeatherCondition clear
[DEBUG] 12:06:12: OutsideTemperature 12
[DEBUG] 12:06:12: Humidity 67
[DEBUG] 12:06:12: WeatherCondition clear
[DEBUG] 12:07:12: OutsideTemperature 12
[DEBUG] 12:07:12: Humidity 67
[DEBUG] 12:07:12: WeatherCondition clear
[DEBUG] 12:08:12: OutsideTemperature 12
[DEBUG] 12:08:12: Humidity 67
[DEBUG] 12:08:12: WeatherCondition clear
[DEBUG] 12:09:12: OutsideTemperature 12
[DEBUG] 12:09:12: Humidity 67
[DEBUG] 12:09:12: WeatherCondition clear
[DEBUG] 12:10:12: OutsideTemperature 12
[DEBUG] 12:10:12: Humidity 67
[DEBUG] 12:10:12: WeatherCondition clear
[DEBUG] 12:11:12: OutsideTemperature 12
[DEBUG] 12:11:12: Humidity 67
[DEBUG] 12:11:12: WeatherCondition clear
[DEBUG] 12:12:12: OutsideTemperature 12
[DEBUG] 12:12:12: Humidity 67
[DEBUG] 12:12:12: WeatherCondition clear
[DEBUG] 12:13:12: OutsideTemperature 12
[DEBUG] 12:13:12: Humidity 67
[DEBUG] 12:13:12: WeatherCondition clear
[DEBUG] 12:14:12: OutsideTemperature 12
[DEBUG] 12:14:12: Humidity 67
[DEBUG] 12:14:12: WeatherCondition clear
[DEBUG] 12:15:12: OutsideTemperature 12
[DEBUG] 12:15:12: Humidity 67
[DEBUG] 12:15:12: WeatherCondition clear
[DEBUG] 12:16:12: OutsideTemperature 12
[DEBUG] 12:16:12: Humidity 67
[DEBUG] 12:16:12: WeatherCondition clear
[DEBUG] 12:17:12: OutsideTemperature 12
[DEBUG] 12:17:12: Humidity 67
[DEBUG] 12:17:12: WeatherCondition clear
[DEBUG] 12:18:12: OutsideTemperature 12
[DEBUG] 12:18:12: Humidity 67
[DEBUG] 12:18:12: WeatherCondition clear
[DEBUG] 12:19:12: OutsideTemperature 12
[DEBUG] 12:19:12: Humidity 67
[DEBUG] 12:19:12: WeatherCondition clear
[DEBUG] 12:20:12: OutsideTemperature 12
[DEBUG] 12:20:12: Humidity 67
[DEBUG] 12:20:12: WeatherCondition clear
[DEBUG] 12:21:12: OutsideTemperature 12
[DEBUG] 12:21:12: Humidity 67
[DEBUG] 12:21:12: WeatherCondition clear
[DEBUG] 12:22:12: OutsideTemperature 12
[DEBUG] 12:22:12: Humidity 67
[DEBUG] 12:22:12: WeatherCondition clear
[DEBUG] 12:23:12: OutsideTemperature 12
[DEBUG] 12:23:12: Humidity 67
[DEBUG] 12:23:12: WeatherCondition clear
[DEBUG] 12:24:12: OutsideTemperature 12
[DEBUG] 12:24:12: Humidity 67
[DEBUG] 12:24:12: WeatherCondition clear
[DEBUG] 12:25:12: OutsideTemperature 12
[DEBUG] 12:25:12: Humidity 67
[DEBUG] 12:25:12: WeatherCondition clear
[DEBUG] 12:26:12: OutsideTemperature 12
[DEBUG] 12:26:12: Humidity 67
[DEBUG] 12:26:12: WeatherCondition clear
[DEBUG] 12:27:12: OutsideTemperature 12
[DEBUG] 12:27:12: Humidity 67
[DEBUG] 12:27:12: WeatherCondition clear
[DEBUG] 12:28:12: OutsideTemperature 12
[DEBUG] 12:28:12: Humidity 67
[DEBUG] 12:28:12: WeatherCondition clear
[DEBUG] 12:29:12: OutsideTemperature 12
[DEBUG] 12:29:12: Humidity 67
[DEBUG] 12:29:12: WeatherCondition clear
[DEBUG] 12:30:12: OutsideTemperature 12
[DEBUG] 12:30:12: Humidity 67
[DEBUG] 12:30:12: WeatherCondition clear
[DEBUG] 12:31:12: OutsideTemperature 12
[DEBUG] 12:31:12: Humidity 67
[DEBUG] 12:31:12: WeatherCondition clear
[DEBUG] 12:32:12: OutsideTemperature 12
[DEBUG] 12:32:12: Humidity 67
[DEBUG] 12:32:12: WeatherCondition clear
[DEBUG] 12:33:12: OutsideTemperature 12
[DEBUG] 12:33:12: Humidity 67
[DEBUG] 12:33:12: WeatherCondition clear
[DEBUG] 12:34:12: OutsideTemperature 12
[DEBUG] 12:34:12: Humidity 67
[DEBUG] 12:34:12: WeatherCondition clear
[DEBUG] 12:35:12: OutsideTemperature 12
[DEBUG] 12:35:12: Humidity 67
[DEBUG] 12:35:12: WeatherCondition clear
[DEBUG] 12:36:12: OutsideTemperature 12
[DEBUG] 12:36:12: Humidity 67
[DEBUG] 12:36:12: WeatherCondition clear
[DEBUG] 12:37:12: OutsideTemperature 12
[DEBUG] 12:37:12: Humidity 67
[DEBUG] 12:37:12: WeatherCondition clear
[DEBUG] 12:38:12: OutsideTemperature 12
[DEBUG] 12:38:12: Humidity 67
[DEBUG] 12:38:12: WeatherCondition clear
[DEBUG] 12:39:12: OutsideTemperature 12
[DEBUG] 12:39:12: Humidity 67
[DEBUG] 12:39:12: WeatherCondition clear
[DEBUG] 12:40:12: OutsideTemperature 12
[DEBUG] 12:40:12: Humidity 67
[DEBUG] 12:40:12: WeatherCondition clear
[DEBUG] 12:41:12: OutsideTemperature 12
[DEBUG] 12:41:12: Humidity 67
[DEBUG] 12:41:12: WeatherCondition clear
[DEBUG] 12:42:12: OutsideTemperature 12
[DEBUG] 12:42:12: Humidity 67
[DEBUG] 12:42:12: WeatherCondition clear
[DEBUG] 12:43:12: OutsideTemperature 12
[DEBUG] 12:43:12: Humidity 67
[DEBUG] 12:43:12: WeatherCondition clear
[DEBUG] 12:44:12: OutsideTemperature 12
[DEBUG] 12:44:12: Humidity 67
[DEBUG] 12:44:12: WeatherCondition clear
[DEBUG] 12:45:12: OutsideTemperature 12
[DEBUG] 12:45:12: Humidity 67
[DEBUG] 12:45:12: WeatherCondition clear
[DEBUG] 12:46:12: OutsideTemperature 12
[DEBUG] 12:46:12: Humidity 67
[DEBUG] 12:46:12: WeatherCondition clear
[DEBUG] 12:47:12: OutsideTemperature 12
[DEBUG] 12:47:12: Humidity 67
[DEBUG] 12:47:12: WeatherCondition clear
[DEBUG] 12:48:12: OutsideTemperature 12
[DEBUG] 12:48:12: Humidity 67
[DEBUG] 12:48:12: WeatherCondition clear
[DEBUG] 12:49:12: OutsideTemperature 12
[DEBUG] 12:49:12: Humidity 67
[DEBUG] 12:49:12: WeatherCondition clear
[DEBUG] 12:50:12: OutsideTemperature 12
[DEBUG] 12:50:12: Humidity 67
[DEBUG] 12:50:12: WeatherCondition clear
[DEBUG] 12:51:12: OutsideTemperature 12
[DEBUG] 12:51:12: Humidity 67
[DEBUG] 12:51:12: WeatherCondition clear
[DEBUG] 12:52:12: OutsideTemperature 12
[DEBUG] 12:52:12: Humidity 67
[DEBUG] 12:52:12: WeatherCondition clear
[DEBUG] 12:53:12: OutsideTemperature 12
[DEBUG] 12:53:12: Humidity 67
[DEBUG] 12:53:12: WeatherCondition clear
[DEBUG] 12:54:12: OutsideTemperature 12
[DEBUG] 12:54:12: Humidity 67
[DEBUG] 12:54:12: WeatherCondition clear
[DEBUG] 12:55:12: OutsideTemperature 12
[DEBUG] 12:55:12: Humidity 67
[DEBUG] 12:55:12: WeatherCondition clear
[DEBUG] 12:56:12: OutsideTemperature 12
[DEBUG] 12:56:12: Humidity 67
[DEBUG] 12:56:12: WeatherCondition clear
[DEBUG] 12:57:12: OutsideTemperature 12
[DEBUG] 12:57:12: Humidity 67
[DEBUG] 12:57:12: WeatherCondition clear
[DEBUG] 12:58:12: OutsideTemperature 12
[DEBUG] 12:58:12: Humidity 67
[DEBUG] 12:58:12: WeatherCondition clear
[DEBUG] 12:59:12: OutsideTemperature 12
[DEBUG] 12:59:12: Humidity 67
[DEBUG] 12:59:12: WeatherCondition clear
[DEBUG] 13:00:12: OutsideTemperature 12
[DEBUG] 13:00:12: Humidity 67
[DEBUG] 13:00:12: WeatherCondition clear
[DEBUG] 13:01:12: OutsideTemperature 12
[DEBUG] 13:01:12: Humidity 67
[DEBUG] 13:01:12: WeatherCondition clear
[DEBUG] 13:02:12: OutsideTemperature 12
[DEBUG] 13:02:12: Humidity 67
[DEBUG] 13:02:12: WeatherCondition clear
[DEBUG] 13:03:12: OutsideTemperature 12
[DEBUG] 13:03:12: Humidity 67
[DEBUG] 13:03:12: WeatherCondition clear
[DEBUG] 13:04:12: OutsideTemperature 12
[DEBUG] 13:04:12: Humidity 67
[DEBUG] 13:04:12: WeatherCondition clear
[DEBUG] 13:05:12: OutsideTemperature 12
[DEBUG] 13:05:12: Humidity 67
[DEBUG] 13:05:12: WeatherCondition clear
[DEBUG] 13:06:12: OutsideTemperature 12
[DEBUG] 13:06:12: Humidity 67
[DEBUG] 13:06:12: WeatherCondition clear
[DEBUG] 13:07:12: OutsideTemperature 12
[DEBUG] 13:07:12: Humidity 67
[DEBUG] 13:07:12: WeatherCondition clear
[DEBUG] 13:08:12: OutsideTemperature 12
[DEBUG] 13:08:12: Humidity 67
[DEBUG] 13:08:12: WeatherCondition clear
[DEBUG] 13:09:12: OutsideTemperature 12
[DEBUG] 13:09:12: Humidity 67
[DEBUG] 13:09:12: WeatherCondition clear
[DEBUG] 13:10:12: OutsideTemperature 12
[DEBUG] 13:10:12: Humidity 67
[DEBUG] 13:10:12: WeatherCondition clear
[DEBUG] 13:11:12: OutsideTemperature 12
[DEBUG] 13:11:12: Humidity 67
[DEBUG] 13:11:12: WeatherCondition clear
[DEBUG] 13:12:12: OutsideTemperature 12
[DEBUG] 13:12:12: Humidity 67
[DEBUG] 13:12:12: WeatherCondition clear
[DEBUG] 13:13:12: OutsideTemperature 12
[DEBUG] 13:13:12: Humidity 67
[DEBUG] 13:13:12: WeatherCondition clear
[DEBUG] 13:14:12: OutsideTemperature 12
[DEBUG] 13:14:12: Humidity 67
[DEBUG] 13:14:12: WeatherCondition clear
[DEBUG] 13:15:12: OutsideTemperature 12
[DEBUG] 13:15:12: Humidity 67
[DEBUG] 13:15:12: WeatherCondition clear
[DEBUG] 13:16:12: OutsideTemperature 12
[DEBUG] 13:16:12: Humidity 67
[DEBUG] 13:16:12: WeatherCondition clear
[DEBUG] 13:17:12: OutsideTemperature 12
[DEBUG] 13:17:12: Humidity 67
[DEBUG] 13:17:12: WeatherCondition clear
[DEBUG] 13:18:12: OutsideTemperature 12
[DEBUG] 13:18:12: Humidity 67
[DEBUG] 13:18:12: WeatherCondition clear
[DEBUG] 13:19:12: OutsideTemperature 12
[DEBUG] 13:19:12: Humidity 67
[DEBUG] 13:19:12: WeatherCondition clear
[DEBUG] 13:20:12: OutsideTemperature 12
[DEBUG] 13:20:12: Humidity 67
[DEBUG] 13:20:12: WeatherCondition clear
[DEBUG] 13:21:12: OutsideTemperature 12
[DEBUG] 13:21:12: Humidity 67
[DEBUG] 13:21:12: WeatherCondition clear
[DEBUG] 13:22:12: OutsideTemperature 12
[DEBUG] 13:22:12: Humidity 67
[DEBUG] 13:22:12: WeatherCondition clear
[DEBUG] 13:23:12: OutsideTemperature 12
[DEBUG] 13:23:12: Humidity 67
[DEBUG] 13:23:12: WeatherCondition clear
[DEBUG] 13:24:12: OutsideTemperature 12
[DEBUG] 13:24:12: Humidity 67
[DEBUG] 13:24:12: WeatherCondition clear
[DEBUG] 13:25:12: OutsideTemperature 12
[DEBUG] 13:25:12: Humidity 67
[DEBUG] 13:25:12: WeatherCondition clear
[DEBUG] 13:26:12: OutsideTemperature 12
[DEBUG] 13:26:12: Humidity 67
[DEBUG] 13:26:12: WeatherCondition clear
[DEBUG] 13:27:12: OutsideTemperature 12
[DEBUG] 13:27:12: Humidity 67
[DEBUG] 13:27:12: WeatherCondition clear
[DEBUG] 13:28:12: OutsideTemperature 12
[DEBUG] 13:28:12: Humidity 67
[DEBUG] 13:28:12: WeatherCondition clear
[DEBUG] 13:29:12: OutsideTemperature 12
[DEBUG] 13:29:12: Humidity 67
[DEBUG] 13:29:12: WeatherCondition clear
[DEBUG] 13:30:12: OutsideTemperature 12
[DEBUG] 13:30:12: Humidity 67
[DEBUG] 13:30:12: WeatherCondition clear
[DEBUG] 13:31:12: OutsideTemperature 12
[DEBUG] 13:31:12: Humidity 67
[DEBUG] 13:31:12: WeatherCondition clear
[DEBUG] 13:32:12: OutsideTemperature 12
[DEBUG] 13:32:12: Humidity 67
[DEBUG] 13:32:12: WeatherCondition clear
[DEBUG] 13:33:12: OutsideTemperature 12
[DEBUG] 13:33:12: Humidity 67
[DEBUG] 13:33:12: WeatherCondition clear
[DEBUG] 13:34:12: OutsideTemperature 12
[DEBUG] 13:34:12: Humidity 67
[DEBUG] 13:34:12: WeatherCondition clear
[DEBUG] 13:35:12: OutsideTemperature 12
[DEBUG] 13:35:12: Humidity 67
[DEBUG] 13:35:12: WeatherCondition clear
[DEBUG] 13:36:13: OutsideTemperature 12
[DEBUG] 13:36:13: Humidity 67
[DEBUG] 13:36:13: WeatherCondition clear
[DEBUG] 13:37:13: OutsideTemperature 12
[DEBUG] 13:37:13: Humidity 67
[DEBUG] 13:37:13: WeatherCondition clear
[DEBUG] 13:38:13: OutsideTemperature 12
[DEBUG] 13:38:13: Humidity 67
[DEBUG] 13:38:13: WeatherCondition clear
[DEBUG] 13:39:13: OutsideTemperature 12
[DEBUG] 13:39:13: Humidity 67
[DEBUG] 13:39:13: WeatherCondition clear
[DEBUG] 13:40:13: OutsideTemperature 12
[DEBUG] 13:40:13: Humidity 67
[DEBUG] 13:40:13: WeatherCondition clear
[DEBUG] 13:41:13: OutsideTemperature 12
[DEBUG] 13:41:13: Humidity 67
[DEBUG] 13:41:13: WeatherCondition clear
[DEBUG] 13:42:13: OutsideTemperature 12
[DEBUG] 13:42:13: Humidity 67
[DEBUG] 13:42:13: WeatherCondition clear
[DEBUG] 13:43:13: OutsideTemperature 12
[DEBUG] 13:43:13: Humidity 67
[DEBUG] 13:43:13: WeatherCondition clear
[DEBUG] 13:44:13: OutsideTemperature 12
[DEBUG] 13:44:13: Humidity 67
[DEBUG] 13:44:13: WeatherCondition clear
[DEBUG] 13:45:13: OutsideTemperature 12
[DEBUG] 13:45:13: Humidity 67
[DEBUG] 13:45:13: WeatherCondition clear
[DEBUG] 13:46:13: OutsideTemperature 12
[DEBUG] 13:46:13: Humidity 67
[DEBUG] 13:46:13: WeatherCondition clear

 

Posté(e)

au fait Did,

 

Oui as de raison que cela ne fonctionne pas, j'ai rien modifié du tout dans le code ;-)

Pour la scne active ou non, tres bonne question, je dirais oui !!

 

@domo, encore perdu pour le code lol

 

d'apres ton debug, tes variables remontent bien quelque chose deja ;-)

explique ce dont tu as besoin ;-)

Posté(e)

en faite j'ai copié le tuto armoire météo et je voudrais qu'il s'allume avec les conditions  present et de 7h à  7h55 du matin

Posté(e)

A tester, rien de sur ;-)

local maintenant = os.date("%H:%M", os.time())
local heuremini, heuremaxi = "07:00", "07:55"
-------
local Humidity = tonumber(fibaro:getValue(3, "Humidity"))
local OutsideTemperature = tonumber(fibaro:getValue(3, "Temperature"))
local WeatherCondition = fibaro:getValue(3, "WeatherConditionConverted")
-----------
local presencetophe = tonumber(fibaro:getGlobalValue("Present_Tophe")) > 0
 
fibaro:debug("OutsideTemperature : " .. OutsideTemperature);
fibaro:debug("Humidity : " .. Humidity);
fibaro:debug("WeatherCondition : " .. WeatherCondition);
fibaro:debug("Maintenant : " ..maintenant.. " - Heure mini : " .. heuremini .. " - Heure maxi : " ..heuremaxi)
fibaro:debug( "Présence Tophe : " ..(fibaro:getGlobalValue("Meteo_Day")))

if maintenant > heuremini and maintenant < heuremaxi and presencetophe then

    if (OutsideTemperature <= 20) then
        fibaro:debug("vert");
        fibaro:call(236, "setColor", "0", "255", "0", "0") -- vert
    else
        fibaro:debug("jaune");
        fibaro:call(236, "setColor", "255", "255", "0", "0") -- jaune
        fibaro:sleep(5*1000)
    end    

    if(Humidity >= 50) then
        fibaro:debug("rouge");
        fibaro:call(236, "setColor", "255", "0", "0", "0") -- rouge
        fibaro:sleep(5*1000)
    end

    if(Humidity >= 50 and OutsideTemperature < 20) then
        fibaro:debug("blanc");
        fibaro:call(236, "setColor", "255", "255", "255", "0") -- blanc
        fibaro:sleep(5*1000)
    end

    if (WeatherCondition == "rain") then
        fibaro:debug("bleu");
        fibaro:call(236, "setColor", "0", "0", "255", "0") -- bleu
        fibaro:sleep(5*1000)
      end
end
Posté(e)

merci pepite pour le code malheureusement sa ne fonctionne pas , le début est bon 

[DEBUG] 23:06:54: OutsideTemperature : 12
[DEBUG] 23:06:54: Humidity : 67
[DEBUG] 23:06:54: WeatherCondition : clear
[DEBUG] 23:06:54: Maintenant : 23:06 - Heure mini : 07:00 - Heure maxi : 07:55
[DEBUG] 23:06:54: Présence Tophe : Prévisions pour ce samedi: Ciel plutôt dégagé. Maximales : 15 ºC. Vents SSO soufflant de 10 à  15 km/h. (0 mm)
Posté(e)

heuuu oublie de modifie une variable

    local maintenant = os.date("%H:%M", os.time())
    local heuremini, heuremaxi = "07:00", "07:55"
    -------
    local Humidity = tonumber(fibaro:getValue(3, "Humidity"))
    local OutsideTemperature = tonumber(fibaro:getValue(3, "Temperature"))
    local WeatherCondition = fibaro:getValue(3, "WeatherConditionConverted")
    -----------
    local presencetophe = tonumber(fibaro:getGlobalValue("Present_Tophe")) > 0
     
    fibaro:debug("OutsideTemperature : " .. OutsideTemperature);
    fibaro:debug("Humidity : " .. Humidity);
    fibaro:debug("WeatherCondition : " .. WeatherCondition);
    fibaro:debug("Maintenant : " ..maintenant.. " - Heure mini : " .. heuremini .. " - Heure maxi : " ..heuremaxi)
    fibaro:debug( "Présence Tophe : " ..(fibaro:getGlobalValue("Present_Tophe")))
     
    if maintenant > heuremini and maintenant < heuremaxi and presencetophe then
     
        if (OutsideTemperature <= 20) then
            fibaro:call(236, "setColor", "0", "255", "0", "0") -- vert
        else
            fibaro:debug("jaune");
            fibaro:call(236, "setColor", "255", "255", "0", "0") -- jaune
            fibaro:sleep(5*1000)
        end    
     
        if(Humidity >= 50) then
            fibaro:debug("rouge");
            fibaro:call(236, "setColor", "255", "0", "0", "0") -- rouge
            fibaro:sleep(5*1000)
        end
     
        if(Humidity >= 50 and OutsideTemperature < 20) then
            fibaro:debug("blanc");
            fibaro:call(236, "setColor", "255", "255", "255", "0") -- blanc
            fibaro:sleep(5*1000)
        end
     
        if (WeatherCondition == "rain") then
            fibaro:debug("bleu");
            fibaro:call(236, "setColor", "0", "0", "255", "0") -- bleu
            fibaro:sleep(5*1000)
          end
    end

 

Posté(e)

Bonjour domo,

 

Il va falloir etre un peu plus expressif sur ce qui ne fonctionne ou non, juste toujours pas est un peu succinct pour t'aider.

 

C'est normal que ca ne fonctionne pas, tu as teste hier soir sans changer les heures mini et maxi, sauf si je me trompe tu voulais que cela s'allume uniquement entre 7:00 et 7:55

 

Je t'ai rajoute un debug si tu es en dehors des horaires


    local maintenant = os.date("%H:%M", os.time())
    local heuremini, heuremaxi = "07:00", "07:55"
    -------
    local Humidity = tonumber(fibaro:getValue(3, "Humidity"))
    local OutsideTemperature = tonumber(fibaro:getValue(3, "Temperature"))
    local WeatherCondition = fibaro:getValue(3, "WeatherConditionConverted")
    -----------
    local presencetophe = tonumber(fibaro:getGlobalValue("Present_Tophe")) > 0
     
    fibaro:debug("OutsideTemperature : " .. OutsideTemperature);
    fibaro:debug("Humidity : " .. Humidity);
    fibaro:debug("WeatherCondition : " .. WeatherCondition);
    fibaro:debug("Maintenant : " ..maintenant.. " - Heure mini : " .. heuremini .. " - Heure maxi : " ..heuremaxi)
    fibaro:debug( "Présence Tophe : " ..(fibaro:getGlobalValue("Present_Tophe")))
     
    if maintenant > heuremini and maintenant < heuremaxi and presencetophe then
     
        if (OutsideTemperature <= 20) then
            fibaro:call(236, "setColor", "0", "255", "0", "0") -- vert
        else
            fibaro:debug("jaune");
            fibaro:call(236, "setColor", "255", "255", "0", "0") -- jaune
            fibaro:sleep(5*1000)
        end    
     
        if(Humidity >= 50) then
            fibaro:debug("rouge");
            fibaro:call(236, "setColor", "255", "0", "0", "0") -- rouge
            fibaro:sleep(5*1000)
        end
     
        if(Humidity >= 50 and OutsideTemperature < 20) then
            fibaro:debug("blanc");
            fibaro:call(236, "setColor", "255", "255", "255", "0") -- blanc
            fibaro:sleep(5*1000)
        end
     
        if (WeatherCondition == "rain") then
            fibaro:debug("bleu");
            fibaro:call(236, "setColor", "0", "0", "255", "0") -- bleu
            fibaro:sleep(5*1000)
        end
    else
        fibaro:debug("Scène non lancée, en dehors des heures 7:00 - 7:55")
    end
Posté(e)

merci de ta patience je viens de changer l'heure mais c'est pas ça 

[DEBUG] 10:45:11: OutsideTemperature : 12
[DEBUG] 10:45:11: Humidity : 67
[DEBUG] 10:45:11: WeatherCondition : clear
[DEBUG] 10:45:11: Maintenant : 10:45 - Heure mini : 10:46 - Heure maxi : 11:55
[DEBUG] 10:45:11: Présence Tophe : 1
[DEBUG] 10:45:11: Scène non lancée, en dehors des heures 10:46 - 11:55
[DEBUG] 10:46:20: OutsideTemperature : 12
[DEBUG] 10:46:20: Humidity : 67
[DEBUG] 10:46:20: WeatherCondition : clear
[DEBUG] 10:46:20: Maintenant : 10:46 - Heure mini : 10:46 - Heure maxi : 11:55
[DEBUG] 10:46:20: Présence Tophe : 1
[DEBUG] 10:46:20: Scène non lancée, en dehors des heures 10:46 - 11:55
Posté(e)


--[[

%% autostart

%% properties

%% events

%% globals

Present_Tophe

3 Temperature

3 Humidity

3 WeatherConditionConverted

--]]

local maintenant = os.date("%H:%M", os.time())

local heuremini, heuremaxi = "10:46", "11:55"

-------

local Humidity = tonumber(fibaro:getValue(3, "Humidity"))

local OutsideTemperature = tonumber(fibaro:getValue(3, "Temperature"))

local WeatherCondition = fibaro:getValue(3, "WeatherConditionConverted")

-----------

local presencetophe = tonumber(fibaro:getGlobalValue("Present_Tophe")) > 0

fibaro:debug("OutsideTemperature : " .. OutsideTemperature);

fibaro:debug("Humidity : " .. Humidity);

fibaro:debug("WeatherCondition : " .. WeatherCondition);

fibaro:debug("Maintenant : " ..maintenant.. " - Heure mini : " .. heuremini .. " - Heure maxi : " ..heuremaxi)

fibaro:debug( "Présence Tophe : " ..(fibaro:getGlobalValue("Present_Tophe")))

if maintenant > heuremini and maintenant < heuremaxi and presencetophe then

if (OutsideTemperature <= 20) then

fibaro:call(236, "setColor", "0", "255", "0", "0") -- vert

else

fibaro:debug("jaune");

fibaro:call(236, "setColor", "255", "255", "0", "0") -- jaune

fibaro:sleep(5*1000)

end

if(Humidity >= 50) then

fibaro:debug("rouge");

fibaro:call(236, "setColor", "255", "0", "0", "0") -- rouge

fibaro:sleep(5*1000)

end

if(Humidity >= 50 and OutsideTemperature < 20) then

fibaro:debug("blanc");

fibaro:call(236, "setColor", "255", "255", "255", "0") -- blanc

fibaro:sleep(5*1000)

end

if (WeatherCondition == "rain") then

fibaro:debug("bleu");

fibaro:call(236, "setColor", "0", "0", "255", "0") -- bleu

fibaro:sleep(5*1000)

end

else

fibaro:debug("Scène non lancée, en dehors des heures 10:46 - 11:55")

end

×
×
  • Créer...