Aller au contenu

Rem's

Membres confirmés
  • Compteur de contenus

    949
  • Inscription

  • Dernière visite

  • Jours gagnés

    2

Messages posté(e)s par Rem's

  1. Une question les amis,

    Le RAID dans lequel je suis utilise les 2 disques pour stocker mon fichier (c'est bien ça ... ?) et optimiser les performances.

    Dans le cas ou les 2 disques se complètent et donne donc un stockage double, il y a t-il une différence de performance pour balancer un film sur un TV ou accéder au server de music via les Sonos ??

    Ayant 3 Disques Durs externe WD de 2 To chacun, je cherchais à leur trouver une utilités, dans ce 2ème cas (sauvegarde de mes données sur les 2 ports USB du Synology).

    D'avance merci pour vos éclaircissements.

  2. Les mecs, vous m'avez perdu !!!

    Alors j'en suis où dans mon affaires :

    Je démonte mes DD  x 3 To et je change de RAID

    - Je change un seul Disque, pour commencer

    - Je change les 2, mais comment basculer mes données

    - Je suis riche et je prends un 2ème NAS, style le 740...

     

    On peux le fare au vote, c'est Tendance .... (merci du coup de main)

  3. Bonjour à tous,

    Je m'en sors pas avec cette scène !! C'est la porte d'entrée, avec la journée découpée en variable.

    J'ai beau bidouiller, je n'ai que des erreurs :

     

    [DEBUG] 23:28:48: 2020-02-11 23:28:48.363989 [ fatal] Unknown exception: /opt/fibaro/scenes/100.lua:51: expected near 'elseif'

     

    Voici ma scène, si quelqu'un aurait la gentillesse de la corriger ... D'avance merci du coup de main.

    --[[
    %% properties
    772 value
    Jour-Nuit
    %% globals
    --]]
     
    -- Ce scénario sera executé uniquement à l'ouverture / fermeture
    -- du décteur de porte ID 750 (porte d'entrée)

    local door = 772
    local light = 459 -- Spots hall
    -- local startSource = fibaro:getSourceTrigger();

    local heure = os.date("%R");
    date = os.date("%d/%m/%Y");
    local Message = string.format("Lancement du %s a %s", date, heure)
        fibaro:debug(Message)

    -- local heure = string.format(os.date("%H"), "%2d")..string.format(os.date("%M"), "%2d")
    -- local heureValable = heure >= "1830" or heure < "2115"
    local enAlerte = (tonumber(fibaro:getValue(door, "value")) > 0)
    local heureValable = fibaro:getGlobalValue("Jour-Nuit")== ("Jour")
    local heureValable1 = fibaro:getGlobalValue("Jour-Nuit")== ("Matin")
    local heureValable2 = fibaro:getGlobalValue("Jour-Nuit")== ("Midi")
    local heureValable3 = fibaro:getGlobalValue("Jour-Nuit")== ("Après-midi")
    local heureValable4 = fibaro:getGlobalValue("Jour-Nuit")== ("Soir")
    local heureValable5 = fibaro:getGlobalValue("Jour-Nuit")== ("Soirée")
    local heureValable6 = fibaro:getGlobalValue("Jour-Nuit")== ("Nuit")

    if enAlerte and heureValable -- Jour --
    then
      fibaro:startScene(370);
         fibaro:call(659, "turnOn") -- Lampe boule
           fibaro:sleep(15*1000);
         fibaro:call(659, "turnOff")
      fibaro:call(592, "turnOff") -- Plante 1
      fibaro:call(593, "turnOff") -- Plante 2
      
    if fibaro:getGlobalValue("TV")== ("On")
        then
        fibaro:call(56, "pressButton", "1")
          fibaro:debug("TV extinction")
        else
        fibaro:debug("TV déjà éteinte")
        
      fibaro:debug("Porte ouverte Jour")
        end
      end

      elseif enAlerte and heureValable1 -- Matin --
      then
      fibaro:call(401, "pressButton", "8") -- Annonce Petula
      fibaro:call(light, "turnOn"); -- Spots Hall
         fibaro:debug("Porte ouverte matin")
      else
      fibaro:call(light, "turnOff"); -- Spot Hall
      
      elseif enAlerte and heureValable2 -- Midi --
    then
         fibaro:debug("Porte ouverte à midi")

      elseif enAlerte and heureValable3 -- Après-midi --
    then
         -- fibaro:call(401, "pressButton", "8") -- Annonce Petula
           fibaro:debug("Porte ouverte à Après-midi")

      elseif enAlerte and heureValable4 -- Soir --
    then
         fibaro:debug("Porte ouverte le soir")

      elseif enAlerte and heureValable5 -- Soirée
    then
         fibaro:debug("Porte ouverte en soirée")

      elseif enAlerte and heureValable6 -- Nuit --
    then
    fibaro:call(659, "turnOn") -- Lampe boule
    else
    fibaro:sleep(15*1000);
    fibaro:call(659, "turnOff") -- Lampe boule
    fibaro:debug("Porte fermée")

         fibaro:debug("Porte ouverte la nuit") -- Nuit --
      
    else
        -- porte fermée
        -- fibaro:call(light, "turnOff");
         fibaro:debug("Porte fermée")
       end
    end

  4. En fait j'y mets un peu tout, je m'en sert vraiment en serveur, mes ordi ont rien. Photos 300 Go, Musiques 600 Go, Video 600 Go, et la bureautique.

    Je pensai à 8 TO, mais ca douille !!

    Actuellement un disque copie l'autres, RAID 1 je crois .... Je n'ai donc que 3 To de stockage.

    De plus, j'ai 2 Disques dur externes WD branché sur le N'as Syno sur lesquels des sauvegardes se font automatiquement.

     

    Violon .... !! Merci pour vos conseils

  5. Bonjour à tous,

     

    Je suis à la recherche de Télécommande Minimote de che AEON Labs. Je n'arrive pas à trouver un site .... Elle ne se fait plus ? Ca serait bien dommage car déjà évoqué sur le FOFO son coté réactif et ergonomique, sans parler de l'autonomie.

    Pouvez-vous m'aider ? Merci d'avance pour les "Huggy", les bons tuyaux, quoi ... !!

  6. En fait j'ai même essayé avec Lille et Rouen !! (les pauvres, c'est une honte ...)

    J'ai toujours l'erreur

    [ERROR] 21:04:34: line 41: attempt to index field '?' (a nil value)

     

    J'ai essayé avec Marseille, Aix - Marseille, Aix-Marseille, aix - marseille, 13

     

    Faut il bien renseigner l'année entre les "" : soit 2019 ?

     

    Merci pour ton aide, au top

  7. Bonjour à tous, 

    J'essaye en vain de faire tourner ce VD, je voudrais me servir des variables vacances pour mes scènes.

     

    local Ville = "Marseille"
    local dayofchange = 31 -- Jour du changement d'Année scolaire
    local monthofchange = 8 -- Mois du changement d'Année scolaire
    local Annee = "2019"
    local data = fibaro:getGlobal("VacancesScolaire")
    local i = 1
    local now = os.time()
    local holiday = false
    local holidayd1 = false
    local vacance = {}

    -- --------------------------------------------------------------------------------------------------------------
    -- Determine l'Année Scolaire par rapport aux paramètres monthofchange & dayofchange
    -- --------------------------------------------------------------------------------------------------------------
    local dateofchange = os.time({day=dayofchange,month=monthofchange,year=os.date("%Y"),hour=0,min=0,sec=0})
    if now > dateofchange then
        Annee = os.date("%Y").."-"..(os.date("%Y") + 1)
    else
        Annee = (os.date("%Y") -1).."-"..os.date("%Y")
    end

    -- --------------------------------------------------------------------------------------------------------------
    -- Calcule le nombre de jours entre 2 dates
    -- --------------------------------------------------------------------------------------------------------------
    function delai(dated, dateparam)
      diff = os.difftime(dated, dateparam)
      return math.floor(diff / (60*60*24))
    end

    -- --------------------------------------------------------------------------------------------------------------
    -- Transforme une date en string en date exploitable
    -- --------------------------------------------------------------------------------------------------------------
    function getDateFormat(sdate)
      year,month,day = sdate:match("(%d+)-(%d+)-(%d+)")
      return os.time({day=day,month=month,year=year,hour=0,min=0,sec=0})
    end


    local status, jsonTable = pcall(function() return json.decode(data) end)
    for j = 1, #jsonTable do
      if jsonTable[j].fields.location == Ville and jsonTable[j].fields.annee_scolaire == Annee then
        local Description = jsonTable[j].fields.description
        local Annee_Scolaire = jsonTable[j].fields.annee_scolaire
        local Start_date = tostring(jsonTable[j].fields.start_date)
        local End_date = tostring(jsonTable[j].fields.end_date)
        Zone = jsonTable[j].fields.zones
        --local Ville = jsonTable[j].fields.location

        if (now > getDateFormat(Start_date) and now < getDateFormat(End_date)) then
             holiday = true
        elseif ( getDateFormat(Start_date) > now and not holiday) then
            if nextholiday  ~= nil then
                if getDateFormat(Start_date) < nextholiday then nextholiday = getDateFormat(Start_date) end 
            else
                nextholiday = getDateFormat(Start_date)
            end
        end
        
        if (now+24*60*60  > getDateFormat(Start_date) and now+24*60*60 < getDateFormat(End_date)) then
           holidayd1 = true 
        end
        table.insert(vacance, getDateFormat(Start_date).." - "..getDateFormat(End_date).." | "..Description)
      end
    end

    fibaro:call(fibaro:getSelfId(), "setProperty", "ui.ville.value", Ville)
    fibaro:call(fibaro:getSelfId(), "setProperty", "ui.zone.value", Zone)

    table.sort(vacance)
    for k, v in pairs(vacance) do
      local date1   = string.match(v, "(%d+)%s");
      local date2   = string.match(v, "-%s(%d+)%s");
      local libelle = string.match(v, "|%s(.+)");
      fibaro:call(fibaro:getSelfId(), "setProperty", "ui.Label"..k..".value", os.date("%d.%m.%Y", date1) .. " - " .. os.date("%d.%m.%Y", date2) .. " | " .. libelle)
    end 

    if holiday then
         fibaro:call(fibaro:getSelfId(), "setProperty", "ui.today.value", "Oui")
      else
         fibaro:call(fibaro:getSelfId(), "setProperty", "ui.today.value", "Non")
         fibaro:call(fibaro:getSelfId(), "setProperty", "ui.status.value", "Dans ".. delai(nextholiday, now) .. " Jours")
    end

    if holidayd1 then
       fibaro:call(fibaro:getSelfId(), "setProperty", "ui.tomorrow.value", "Oui")
      else
       fibaro:call(fibaro:getSelfId(), "setProperty", "ui.tomorrow.value", "Non")
    end

     

    Un coup de main serait chouette !! d'avance merci !!

  8. Jojo J'adore !!

     

    Sinon j'ai compris le message : En fait faire joujou avec la domotique, à l'intérieur de nos maisons, ne dissuade en rien ces abrutis. D'autant qu'ils ne comprennent rien à la technologie puisqu'ils ont débranché ma caméra et sont partis avec !!

    Une alarme digne de ce nom et bien identifiable pour cette vermine, et ils préfèreront une autre porte, ou passer leur chemin.

     

    Qu'est ce vous me conseiller, avec un digicode à emprunte biométrique, tant qu'à faire. Quelle type d'arlame ? Compatible HC2 ?

    J'habite au 4ème étage, et à part la porte d'entrée et éventuellement capteur de mouvement, je vois pas trop ...

     

    D'avance merci pour vos conseils avisés. 

  9. Merci à tous pour vos retours ...

     

    Je sais bien que la domotique n'est pas aussi fiable qu'une alarme. N'ayant jamais eu d'alarme, Je voudrais dans un premier temps m'habituer à enclencher et déclencher un lecteur de badge RFID à l'entrée de la maison, par exemple, couplé à une sirène.

     

    Je passe par la HC2 pour visionner mes caméra, car il m'arrive de les regarder la journée, l'appli figaro est je trouve plus réactive que Surveillance Station.

     

     

  10. Bonjour à tous, 

     

    Tout est dans le titre .... J'habite en immeuble, au 3ème étage.

     

    J'ai IFTT bien paramètre sur mon tel et un détecteur sur la porte d'entrée.

     

    Je voudrais dans un premier temps, ajouter une sirène compatible avec notre HC2 : Faire une scène entre la porte et le retour d'IFTT qui se fait dès que je suis à 50m de chez moi.

    Pourquoi pas en faisant clignoter la maison, et évidemment je reçois une natif sur mon tel (et celui de ma femme). Mon enfant à 7 ans et ne rentre et ne sort pas seule.

     

    Je voudrais également (car cette belle équipe m'a également embarqué mes caméra) mettre 2 caméras, avec une bonne image, style 4K ou plus (selon le prix). Compatible évidemment avec notre HC2.

     

    J'ai acheté il y a quelque temps des caméras sur un site chinois bien connu, elle ne sont pas intégrable car pas de http, ni https (un espèces de cloud perso, version riz cantonnais !!).

     

     D'avance merci pour vos idées et/ou modèle à me conseiller.

     

  11. Mais en fait, c'est un VD pour les vacances scolaires que je cherche à faire fonctionner !!! Je ne sais pas pourquoi j'ai poster ici (je vais me faire engueuler par les admin)

    A toute fins utiles voici le code que j'ai :

     

     

    -- --------------------------------------------------------------------------------------------------------------
    -- Check that one and only one instance is in memory
    -- --------------------------------------------------------------------------------------------------------------
    local selfId = fibaro:getSelfId();
    local icon = fibaro:get (selfId, "deviceIcon");

    if ((not Vacances) or (Vacances.errors >= 5)) then

        Vacances =
        {
            departement = "13",
            varglobal   = "VacScolaire",
            varglobalJ  = "VacScolaireJ",
            varglobalJ1 = "VacScolaireJ1",
            errors = 0
        }

        -- --------------------------------------------------------------------------------------------------------------
        -- URL
        -- --------------------------------------------------------------------------------------------------------------
          Vacances.url = "telechargement.index-education.com"

        -- --------------------------------------------------------------------------------------------------------------
        -- Optenir le fichier XML
        -- --------------------------------------------------------------------------------------------------------------
        Vacances.getXml = function()
            local URL = Net.FHttp(Vacances.url)
            response, status, errorCode = URL:GET("/vacances.xml")
            return Vacances.iif(response ~= nil, Vacances.newParser().ParseXmlText(response), "")
        end

        -- --------------------------------------------------------------------------------------------------------------
        -- Rechercher la zone par rapport au numéro de département
        -- --------------------------------------------------------------------------------------------------------------
        Vacances.getZone = function(xmlTable)
            if (xmlTable) then
                if (not xmlTable.root) then
                    Vacances.errors = Vacances.errors+1
                    return ""
                end
                local academies = xmlTable.root.academies
                for i in pairs(academies:children()) do
                    local academie = academies.academie
                    local zone = academie["@zone"]
                    local nom = academie["@libelle"]
                    for j in pairs(academie:children()) do
                        local dep = academie.departement[j]
                        if (type(dep) ~= "nil") then
                            if (academie.departement[j]["@numero"] == Vacances.departement) then
                                fibaro:call(fibaro:getSelfId(), "setProperty", "ui.LabelZone.value", "["..zone.."] " .. nom)
                                return zone, nom
                            end
                        else
                            if (academie.departement["@numero"] == Vacances.departement) then
                                fibaro:call(fibaro:getSelfId(), "setProperty", "ui.LabelZone.value", "["..zone.."] " .. nom)
                                return zone, nom
                            end
                        end
                    end
                end
            end
            return ""
        end

        -- --------------------------------------------------------------------------------------------------------------
        -- Rechercher le libellé d'une période de vacances
        -- --------------------------------------------------------------------------------------------------------------
        Vacances.getLibelle = function(xmlTable, num)
            if (xmlTable) then
                if (not xmlTable.root) then
                    Vacances.errors = Vacances.errors+1
                    return ""
                end
                local libelles = xmlTable.root.libelles
                for i in pairs(libelles:children()) do
                    if (libelles.libelle["@id"] == num) then
                          local l = libelles.libelle:value()
                          for k = 1, string.len(l)-1 do
                            local c = string.sub(l, k, k)
                            local d = string.byte(c)
                        end
                        return libelles.libelle:value():gsub(string.char(235), "ë"):gsub(string.char(233), "é")
                    end
                end
            end
            return ""
        end

        -- --------------------------------------------------------------------------------------------------------------
        -- Obtenir les dates futures des vacances par rapport à la zone
        -- --------------------------------------------------------------------------------------------------------------
        Vacances.getDatesFuture = function(xmlTable, zone, dateparam)
            fibaro:debug("date="..dateparam)
            fibaro:debug("date claire="..os.date("%d.%m.%Y", dateparam))
            fibaro:debug("date="..os.time())
            if (xmlTable) then
                if (not xmlTable.root) then
                    Vacances.errors = Vacances.errors+1
                    return ""
                end
                local calendrier = xmlTable.root.calendrier
                local index = 1
                local envacance = false
                local envacanceJ1 = false
                for i in pairs(calendrier:children()) do
                    local zonecal = calendrier.zone
                    if (zonecal["@libelle"] == zone) then
                        for j in pairs(zonecal:children()) do
                            local datedeb = Vacances.getDateFormat(zonecal.vacances[j]["@debut"])
                            local datefin = Vacances.getDateFormat(zonecal.vacances[j]["@fin"])
                            if index < 9 then
                                fibaro:debug("Index"..index.." Deb:"..os.date("%d.%m.%Y", datedeb).." Fin:"..os.date("%d.%m.%Y", datefin).." Date:"..os.date("%d.%m.%Y", dateparam))
                                if (dateparam > datedeb and dateparam < datefin) then
                                    local msg = os.date("%d.%m.%Y", datedeb) .. " - " .. os.date("%d.%m.%Y", datefin)  .. " | " ..Vacances.getLibelle(xmlTable, zonecal.vacances[j]["@libelle"])
                                    fibaro:call(fibaro:getSelfId(), "setProperty", "ui.Label"..index..".value", msg)
                                    fibaro:debug("en période de vacance = oui")
                                    envacance = true
                                    if index == 1 then
                                        fibaro:log("Prochaines vacances : "..msg)
                                    end
                                    index = index + 1
                                elseif (datedeb > dateparam) then
                                  local msg = os.date("%d.%m.%Y", datedeb) .. " - " .. os.date("%d.%m.%Y", datefin)  .. " | " ..Vacances.getLibelle(xmlTable, zonecal.vacances[j]["@libelle"])
                                  fibaro:call(fibaro:getSelfId(), "setProperty", "ui.Label"..index..".value", msg)
                                  if (not envacance and index == 1) then
                                        fibaro:log("Prochaines vacances : "..msg)
                                    savedatedeb=datedeb
                                  end
                                  index = index + 1
                                end
                                if (dateparam+24*60*60 > datedeb and dateparam+24*60*60 < datefin) then
                                    envacanceJ1 = true
                                end
                            end
                        end
                        if envacance == true then
                            fibaro:debug("En vacance aujour'hui")
                            fibaro:call(fibaro:getSelfId(), "setProperty", "ui.Label0.value", "En vacances")
                            fibaro:call(fibaro:getSelfId(), "setProperty", "ui.Label10.value", "OUI")
                            VG:traiter(Vacances.varglobal, "0")
                            VG:traiter(Vacances.varglobalJ, "OUI")
                        else
                            fibaro:debug("Pas en vacance aujourd'hui")
                            fibaro:call(fibaro:getSelfId(), "setProperty", "ui.Label0.value", "Dans " .. Vacances.delai(savedatedeb, dateparam) .. " jours"  )
                            fibaro:call(fibaro:getSelfId(), "setProperty", "ui.Label10.value", "NON")
                            VG:traiter(Vacances.varglobal, Vacances.delai(savedatedeb, dateparam).."")
                            VG:traiter(Vacances.varglobalJ, "NON")
                        end
                        if envacanceJ1 == true then
                            fibaro:debug("En vacance demain")
                            fibaro:call(fibaro:getSelfId(), "setProperty", "ui.Label11.value", "OUI")
                            VG:traiter(Vacances.varglobalJ1, "OUI")
                        else
                            fibaro:debug("Pas en vacance demain")
                            fibaro:call(fibaro:getSelfId(), "setProperty", "ui.Label11.value", "NON")
                            VG:traiter(Vacances.varglobalJ1, "NON")
                        end
                        for i = index, 9 do
                            fibaro:call(fibaro:getSelfId(), "setProperty", "ui.Label"..i..".value", "")
                        end
                        return
                    end
                end
            end
        end

        -- --------------------------------------------------------------------------------------------------------------
        -- Transforme une date en string en date exploitable
        -- --------------------------------------------------------------------------------------------------------------
        Vacances.getDateFormat = function(sdate)
            year,month,day = sdate:match("(%d+).(%d+).(%d+)")
            return os.time({day=day,month=month,year=year,hour=0,min=0,sec=0})
        end

        -- --------------------------------------------------------------------------------------------------------------
        -- Calcule le nombre de jours entre 2 dates
        -- --------------------------------------------------------------------------------------------------------------
        Vacances.delai = function(dated, dateparam)
            diff = os.difftime(dated, dateparam)
            return math.floor(diff / (60*60*24))
        end

        -- -------------------------------------------------------------------------------------------------------------
        -- Test the condition and return true or false param depending of the result
        -- param : condition (condition to test)
        --            iftrue (result to return of condition if true)
        --            iftfalse (result to return of condition if false)
        -- -------------------------------------------------------------------------------------------------------------
        Vacances.iif = function(condition, iftrue, iffalse)
            if (condition) then
                return iftrue
            end
            return iffalse
        end

      -- -------------------------------------------------------------------------------------------------------------
      -- Variables Globales
      -- -------------------------------------------------------------------------------------------------------------
      -- Description :
      --    Fonctions permettant la manipulation des
      --    variables globales
      -- -------------------------------------------------------------------------------------------------------------
      -- Version du firmeware : 4.x
      -- Destination : Scénarios
      -- source : steven
      -- lien : https://gea.piccand.me/doku.php/vg
      -- -------------------------------------------------------------------------------------------------------------
      VG={getValue=function(self,b)return fibaro:getGlobalValue(b)end,setValue=function(self,b,c)fibaro:setGlobal(b,c)end,getDateModification=function(self,b)return os.date("*t",fibaro:getGlobalModificationTime(b))end,supprimer=function(self,b)api.delete("/globalVariables/"..b)end,modifier=function(self,b,c,d)local e={}e.value=tostring(c)e.isEnum=false;if type(d)~="nil"then e.isEnum=true;e.enumValues=d end;api.put("/globalVariables/"..b,e)end,ajouter=function(self,b,c,d)local f=0;if type(d)~="nil"then f=1 end;api.post("/globalVariables",{name=b,isEnum=f})self:modifier(b,c,d)end,traiter=function(self,b,c,d)if fibaro:getGlobalValue(b)==nil then self:ajouter(b,c,d)elseif type(d)=="nil"then self:setValue(b,c)else self:modifier(b,c,d)end end,getInfo=function(self,b)return api.get("/globalVariables/"..b)end}

        -- -------------------------------------------------------------------------------------------------------------
        -- This is a modified version of Corona-XML-Module by Jonathan Beebe which in turn
        -- is based on Alexander Makeev's Lua-only XML parser .
        -- see https://github.com/Cluain/Lua-Simple-XML-Parser
        -- -------------------------------------------------------------------------------------------------------------
        Vacances.newParser = function()

            parseXml = {}

            parseXml.FromXmlString = function(value)
                value = string.gsub(value, "&#x([%x]+)%;",
                function(h)
                    return string.char(tonumber(h, 16))
                end);
                value = string.gsub(value, "&#([0-9]+)%;",
                function(h)
                    return string.char(tonumber(h, 10))
                end);
                value = string.gsub(value, "\"", "\"");
                value = string.gsub(value, "'", "'");
                value = string.gsub(value, ">", ">");
                value = string.gsub(value, "<", "<");
                value = string.gsub(value, "&", "&");
                return value;
            end

            parseXml.ParseArgs = function(node, s)
                string.gsub(s, "(%w+)=([\"'])(.-)%2", function(w, _, a)
                    node:addProperty(w,  parseXml.FromXmlString(a))
                end)
            end

            parseXml.ParseXmlText = function(xmlText)
                local stack = {}
                local top = parseXml.newNode()
                table.insert(stack, top)
                local ni, c, label, xarg, empty
                local i, j = 1, 1
                while true do
                    ni, j, c, label, xarg, empty = string.find(xmlText, "<(%/?)([%w_:]+)(.-)(%/?)>", i)
                    if not ni then break end
                    local text = string.sub(xmlText, i, ni - 1);
                    if not string.find(text, "^%s*$") then
                        local lVal = (top:value() or "") .. parseXml.FromXmlString(text)
                        stack[#stack]:setValue(lVal)
                    end
                    if empty == "/" then -- empty element tag
                        local lNode = parseXml.newNode(label)
                        parseXml.ParseArgs(lNode, xarg)
                        top:addChild(lNode)
                    elseif c == "" then -- start tag
                        local lNode = parseXml.newNode(label)
                        parseXml.ParseArgs(lNode, xarg)
                        table.insert(stack, lNode)
                        top = lNode
                    else -- end tag
                        local toclose = table.remove(stack) -- remove top
                        top = stack[#stack]
                        if #stack < 1 then
                            error("XmlParser: nothing to close with " .. label)
                        end
                        if toclose:name() ~= label then
                            error("XmlParser: trying to close " .. toclose.name .. " with " .. label)
                        end
                        top:addChild(toclose)
                    end
                    i = j + 1
                end
                local text = string.sub(xmlText, i);
                if #stack > 1 then
                    error("XmlParser: unclosed " .. stack[#stack]:name())
                end
                return top
            end

            parseXml.newNode = function(name)
                local node = {}
                node.___value = nil
                node.___name = name
                node.___children = {}
                node.___props = {}
                function node:value() return self.___value end
                function node:setValue(val) self.___value = val end
                function node:name() return self.___name end
                function node:setName(name) self.___name = name end
                function node:children() return self.___children end
                function node:numChildren() return #self.___children end
                function node:addChild(child)
                    if self[child:name()] ~= nil then
                        if type(self[child:name()].name) == "function" then
                            local tempTable = {}
                            table.insert(tempTable, self[child:name()])
                            self[child:name()] = tempTable
                        end
                        table.insert(self[child:name()], child)
                    else
                        self[child:name()] = child
                    end
                    table.insert(self.___children, child)
                end
                function node:properties() return self.___props end
                function node:numProperties() return #self.___props end
                function node:addProperty(name, value)
                    local lName = "@" .. name
                    if self[lName] ~= nil then
                        if type(self[lName]) == "string" then
                            local tempTable = {}
                            table.insert(tempTable, self[lName])
                            self[lName] = tempTable
                        end
                        table.insert(self[lName], value)
                    else
                        self[lName] = value
                    end
                    table.insert(self.___props, { name = name, value = self[name] })
                end
                return node
            end
            return parseXml;
        end
    end

    -- -------------------------------------------------------------------------------------------------------------
    -- RUN
    -- -------------------------------------------------------------------------------------------------------------
    fibaro:debug("Lecture du fichier distant ...")
    local xmlTable = Vacances.getXml()
    if (Vacances.errors > 0) then
        time = "Erreur : " .. Vacances.errors
        fibaro:debug(time)
    else
        fibaro:debug("Recherche de la zone pour le département : " .. Vacances.departement .. " ...")
        local zone, nom = Vacances.getZone(xmlTable)
        fibaro:debug(Vacances.departement .. " ==> [" .. zone .. "] " .. nom)
        Vacances.getDatesFuture(xmlTable, zone, os.time())
    end
    fibaro:call(selfId, "setProperty", "currentIcon", icon);
    fibaro:call(784, "setProperty", "ui.status.value", "");

  12. Merci Franco268 pour ta réponse

    En fait je n'avais pas cette variable !!!!

    Je viens de la rajouter (variable simple, sans majuscule).

     

     

    [ERROR] 18:33:55: line 179: bad argument #1 to 'difftime' (number expected, got nil)
    Mais toujours pas

    Une idée ??

  13. bonjour à tous,

     

    j'essaye de refaire cet ingénieur VD .... seulement j'ai une erreur line 179 :

     

    [DEBUG] 23:20:23: Index1 Deb:09.02.2019 Fin:25.02.2019 Date:23.09.2019
    [DEBUG] 23:20:23: Index1 Deb:06.04.2019 Fin:23.04.2019 Date:23.09.2019
    [DEBUG] 23:20:23: Index1 Deb:06.07.2019 Fin:02.09.2019 Date:23.09.2019
    [DEBUG] 23:20:23: Pas en vacance aujourd'hui
    [ERROR] 23:20:23: line 179: bad argument #1 to 'difftime' (number expected, got nil)

    auriez-vous une idée ?? d'avance merci du coup de main !!

×
×
  • Créer...