Aller au contenu

Delacoste

Membres confirmés
  • Compteur de contenus

    54
  • Inscription

  • Dernière visite

Messages posté(e)s par Delacoste

  1. Merci pour toutes vos propositions et désolé pour ma réponse tardive!

    j'ai finalement fait un reset "usine" de la vanne et reconnecté une nouvelle sonde et tout est ok maintenant.

    Autre question: l'expérience de la première vanne étant concluante, j'ai acheté deux autres vannes sans sonde de température. je veux les installer dans le même local. j'ai crû lire à quelque part q'une sonde peut piloter jusqu'à maximum 3 vannes. Ma question est dois-je faire reconnaître la sonde par les deux autre nouvelles vannes? Quelle est la procédure?

    Merci pour vos réponses.

     

  2. Bonjour à tous,

     

    J'ai installé la vanne thermostatique de Fibaro et le capteur de température (Radiator Thermostat Starter Pack) sans problème.

    Ensuite mon crétin de chat a pris le capteur comme jouet et l'a détruit!!!

    J'en ai commandé un autre mais j'arrive pas a le supprimer de ma HC2 puisque il ne répond plus.

    Savez-vous comment procéder?

     

    Ce qui me semble bizarre c'est que sur l'application Fibaro de mon Iphone il semble fonctionner:2118020409_HC2Iphone.thumb.jpg.6699847ea1dcfcdce021951baa96319d.jpg

    Mais sur mon HC2 depuis mon PC: non

    480960858_HC2PC.thumb.jpg.adb925e04041f34fe6ab3e2ae14f744c.jpg

    Merci d'éclairer mes lanternes!

     

     

  3. Bonjour à tous!

    je suis encore et toujours novice en la matière.:23:

    J'aimerai domotiser ma "turbinette". j'ai l'intention de le faire de la manière suivante:avec un capteur d'humidité. Lequel me conseillerez-vous pour qu'il soit compatible avec ma HC2?

    Ensuite l'intégrer et que se soit le plus facile possible de lui donner comme consigne par exemple : si > 70% humidité relative alors enclenche-toi jusqu'à atteindre une valeur plus petite.

    Merci pour votre aide

  4. Salut pepite 

    barlow communique avec moi sur le site https://forum.fibaro.com/topic/25852-vd-scripts-gardena-smart-system/?tab=comments&_fromLogin=1

     

    c’est un peu la galère!

    la sonde fonctionne et deux des vannes fonctionnent aussi mais  les deux autres autres vannes  non 

    J’y comprend pas grand chose car tout ce matériel a été acheté en même temps et quand à l’installation dans FIBARO je peux difficilement me tromper 

    je suis donc pas au bout de mes peines car tout ce qu’on fait maintenant c’est juste pour piloter les vannes depuis FIBARO. A court terme j’aimerais faire des scénarios style : si il a plu ou si il a pleuvoir dans la journée alors pas d’arrosage... mais ça c’est une autre histoire 

    • Like 1
  5. Salut l'ami!

    Il y a 5 heures, pepite a dit :

    Tes différents Gardena ne sont pas en WIFI avec une adresse IP ?

    La gateway est en wifi et la sonde et les vannes j'en ai aucune idée, mais je vois à nulle part une adresse IP. je vois seulement un numéro identifier: 6e9487da-a290-43af-9576-6349670c2f55

     

    Il y a 5 heures, pepite a dit :

    Le concepteur du VD a l'air de répondre assez vite sur le market, pose lui la question sur l'erreur "failed" et sur le nombre de VDs necesaire en fonction du nombre de devices.

    ca va nous aiguiller un peu ;-)

    je vais essayer de lui poser ces questions mais mon anglais est plus que limité

     

    Il y a 5 heures, pepite a dit :

    Dans le debug de la scène status tous tes "gardena" apparaissent au fait ?

    oui tous les es 4 vannes et la sonde

     

    ce qui est bizarre c'est que pour la sonde et pour une vanne (voiture) un Fibaro virtual device (en rouge en bas) leur a été attribué et pas pour les autres??

     

    [DEBUG] 19:02:12: Found the following GARDENA gateway:
    [DEBUG] 19:02:12: Name: Gateway
    [DEBUG] 19:02:12: Identifier: aa660928-8e02-47c1-bb49-69f2ea446d34
    [DEBUG] 19:02:12: * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    [DEBUG] 19:02:12: Found the following GARDENA sensor:
    [DEBUG] 19:02:12: Name: Sonde
    [DEBUG] 19:02:12: Identifier: 62f42561-495b-4609-b3c4-9d1fad2231d6
    [DEBUG] 19:02:12: Corresponding Fibaro virtual device is 18
    [DEBUG] 19:02:12: Last on-line: 25-03-2018 at 16:51
    [DEBUG] 19:02:12: Battery level is 6 %
    [DEBUG] 19:02:12: Battery health is Low
    [DEBUG] 19:02:12: Signal quality is 40 %
    [DEBUG] 19:02:12: Connection status is unknown
    [DEBUG] 19:02:12: Radio link is poor
    [DEBUG] 19:02:12: Ambient temperature is 12 °C
    [DEBUG] 19:02:12: No frost warning
    [DEBUG] 19:02:12: Soil temperature is 11 °C
    [DEBUG] 19:02:12: Soil humidity is 91 %
    [DEBUG] 19:02:12: Light intensity is 4678 lx
    [DEBUG] 19:02:12: Firmware is up to date
    [DEBUG] 19:02:12: * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    [DEBUG] 19:02:12: Found the following GARDENA watering_computer:
    [DEBUG] 19:02:12: Name: Voiture 
    [DEBUG] 19:02:12: Identifier: 6e9487da-a290-43af-9576-6349670c2f55
    [DEBUG] 19:02:12: Corresponding Fibaro virtual device is 19
    [DEBUG] 19:02:12: Last on-line on 25-03-2018 at 16:48
    [DEBUG] 19:02:12: Battery level is 82 %
    [DEBUG] 19:02:12: Battery health is OK
    [DEBUG] 19:02:12: Signal quality is 70%
    [DEBUG] 19:02:12: Connection status is unknown
    [DEBUG] 19:02:12: Radio link is good
    [DEBUG] 19:02:12: Water valve is closed
    [DEBUG] 19:02:12: Manual override is inactive
    [DEBUG] 19:02:12: Manual override time is 1 minutes
    [DEBUG] 19:02:12: Last manual override lasted 1 minutes
    [DEBUG] 19:02:12: Ambient temperature is 21 °C
    [DEBUG] 19:02:12: no frost warning
    [DEBUG] 19:02:12: Watering is scheduled to start on 25-03-2018 at 17:01
    [DEBUG] 19:02:12: Watering is scheduled to end on 25-03-2018 at 17:01
    [DEBUG] 19:02:12: Adaptive scheduling last decision skipped by adaptive scheduling
    [DEBUG] 19:02:12: Firmware is up to date
    [DEBUG] 19:02:12: * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    [DEBUG] 19:02:12: Found the following GARDENA watering_computer:
    [DEBUG] 19:02:12: Name: Cabanon
    [DEBUG] 19:02:12: Identifier: f74fd322-172e-47e1-acf2-42a2db335dde
    [DEBUG] 19:02:12: Last on-line on 25-03-2018 at 16:34
    [DEBUG] 19:02:12: Battery level is 85 %
    [DEBUG] 19:02:12: Battery health is OK
    [DEBUG] 19:02:12: Signal quality is 70%
    [DEBUG] 19:02:12: Connection status is unknown
    [DEBUG] 19:02:12: Radio link is good
    [DEBUG] 19:02:12: Water valve is closed
    [DEBUG] 19:02:12: Manual override is inactive
    [DEBUG] 19:02:12: Manual override time is 1 minutes
    [DEBUG] 19:02:12: Last manual override lasted 1 minutes
    [DEBUG] 19:02:12: Ambient temperature is 13 °C
    [DEBUG] 19:02:12: no frost warning
    [DEBUG] 19:02:12: Watering is scheduled to start on 25-03-2018 at 17:01
    [DEBUG] 19:02:12: Watering is scheduled to end on 25-03-2018 at 17:01
    [DEBUG] 19:02:12: Adaptive scheduling last decision is undefined
    [DEBUG] 19:02:12: Firmware is up to date
    [DEBUG] 19:02:12: * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    [DEBUG] 19:02:12: Found the following GARDENA watering_computer:
    [DEBUG] 19:02:12: Name: Cuisine 
    [DEBUG] 19:02:12: Identifier: 86163a12-f375-48e8-bba0-f0f52e13cdaf
    [DEBUG] 19:02:12: Last on-line on 25-03-2018 at 16:32
    [DEBUG] 19:02:12: Battery level is 89 %
    [DEBUG] 19:02:12: Battery health is OK
    [DEBUG] 19:02:12: Signal quality is 60%
    [DEBUG] 19:02:12: Connection status is unknown
    [DEBUG] 19:02:12: Radio link is good
    [DEBUG] 19:02:12: Water valve is closed
    [DEBUG] 19:02:12: Manual override is inactive
    [DEBUG] 19:02:12: Manual override time is 1 minutes
    [DEBUG] 19:02:12: Last manual override lasted 1 minutes
    [DEBUG] 19:02:12: Ambient temperature is 13 °C
    [DEBUG] 19:02:12: no frost warning
    [DEBUG] 19:02:12: Watering is scheduled to start on 25-03-2018 at 17:01
    [DEBUG] 19:02:12: Watering is scheduled to end on 25-03-2018 at 17:01
    [DEBUG] 19:02:12: Adaptive scheduling last decision is undefined
    [DEBUG] 19:02:12: Firmware is up to date
    [DEBUG] 19:02:12: * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    [DEBUG] 19:02:12: Found the following GARDENA watering_computer:
    [DEBUG] 19:02:12: Name: Balcon 
    [DEBUG] 19:02:12: Identifier: 67f6658e-31ae-414a-a976-c89067d923e8
    [DEBUG] 19:02:12: Last on-line on 25-03-2018 at 16:33
    [DEBUG] 19:02:12: Battery level is 86 %
    [DEBUG] 19:02:12: Battery health is OK
    [DEBUG] 19:02:12: Signal quality is 60%
    [DEBUG] 19:02:12: Connection status is unknown
    [DEBUG] 19:02:12: Radio link is good
    [DEBUG] 19:02:12: Water valve is closed
    [DEBUG] 19:02:12: Manual override is inactive
    [DEBUG] 19:02:12: Manual override time is 1 minutes
    [DEBUG] 19:02:12: Last manual override lasted 1 minutes
    [DEBUG] 19:02:12: Ambient temperature is 12 °C
    [DEBUG] 19:02:12: no frost warning
    [DEBUG] 19:02:12: Watering is scheduled to start on 25-03-2018 at 17:01
    [DEBUG] 19:02:12: Watering is scheduled to end on 25-03-2018 at 17:01
    [DEBUG] 19:02:12: Adaptive scheduling last decision is undefined

     

     

     

    en plus a nulle part je leur ai donné une adresse ou autre chose

    5ab7f3ae33095_Capturedcran2018-03-2521_07_34.thumb.png.29d67fc2ea5da91fc49e8f0e7868bcc0.png

     

    mais si j'appuie sur un des boutons rien ne se passe!!

     

     

    et si je récré un autre VD pour une autre vanne dans les mêmes conditions que l'autre (donc sans rien mettre à nulle part) alors j'ai un VD qui est incomplet et qui ne marche pas (comme l'autre, lui est complet mais ne marche pas)

     

    5ab7f58b8bcbe_Capturedcran2018-03-2520_41_00.thumb.png.646654cc4a3e13f6bf8b3c36e1b784b4.png

     

     

    Bref j'en si marre :15:

     

    merci pour tes lumières

     

     

  6. Salut 

     

    Il y a 21 heures, pepite a dit :

    Je te rappelle que je n'en ai pas, donc aucune idée du fonctionnement.

     

    Je sais mais tu as l'air de connaître en code...et tu es mon seul espoir!!!

    Il y a 21 heures, pepite a dit :

    N'oublie pas, tu dois avoir  aussi la scene "command".

    Oui je l'ai faite

    mais elle me m'inscrit cette erreur:

     

    5ab5f97dc0ad2_Capturedcran2018-03-2408_07_40.thumb.png.9a64df1e25c62331da957bff2ee606b7.png

     

    Il y a 21 heures, pepite a dit :

    regarde dans ton panneau de variables.

     

    Dans le panneau des variables j'ai ceci:

    5ab5fa01d75a9_Capturedcran2018-03-2121_39_40.thumb.png.85c9fe32322899ec3f5a3ffc823aeeb7.png

    Ce qui est bizarre c'est que j'ai quelque fois des valeurs pour gardena command et gardena parameters et des fois non

     

    Il y a 21 heures, pepite a dit :

    l faut relancer la scene status.

    si je te comprends dans la scène status sous l'onglet avancé : arrêter démarrer alors oui plein de fois

     

    Il y a 21 heures, pepite a dit :

    pour moi tu dois quand même mettre l'ip dans le VD.

    tu dis qu'il faut la mettre ici: 

    mais je la trouve ou?

     

    5ab5fbdf514aa_Capturedcran2018-03-2408_04_32.thumb.png.30141f7d0e87803fa2ce7df37a587005.png

     

    encore un grand merci pour ta dispo

  7. Salut petite,

     

    J'ai envoyé un message hier soir à Figaro Market et il a corrigé le script:

     

    @Lionel. The issue is in the inconsistent formatting of the date stamps received from the various Gardena devices and the way that my code is able (in this case unable) to handle it. Ultimately I have got to add some code to normalise the date stamp. For now a quick fix is to apply the following small change to the smartstatus scene. Navigate to line 570, where you will find the following code: --Find GARDENA Watering Computers if v.category == "watering_computer" then for a, b in pairs(v.abilities) do for c, d in pairs(b.properties) do if (d.name == 'last_time_online') then local watering_computer_online = (MakeTimeStamp3(d.value)) In this last line, change MakeTimeStamp into MakeTimeStamp3 This cause the script to change to another function to decode the timestamp and should resolve the issue. Cheers, Barlow

     

     

    Maintenant le script tourne.

    Première question: Faut-il toujours laisser tourner le script?

     

    Ja'i crée un VD pour la sonde et ça fonctionne. Ce qui est bizarre c'est que j'ai rien dû ajouter (IP...)

     

    Maintenant j'ai crée un VD pour smart water Control Gardena

    mais là rien ne bouge

     

    5ab4b9341b06a_Capturedcran2018-03-2309_21_37.thumb.png.0fd9c81edb7446391d448a048c3f9a01.png

     

    Il faut renseigner quelque chose à quelque part?

    Il faudra créer 4 VD (1 pour chaque)? 

    J'ai aussi 

     

    Merci encore pour ta patience!!

     

  8. --[[
    %% properties
    %% autostart
    %% globals
    --]]

    ------------------------------------------------------
    -- Customize the following data (GARDENA smartsystem)
    ------------------------------------------------------
    local username = 'delacoste@hotmail.com'
    local password = 'mot de passe'
    ------------------------------------------------------
    local max_counter = 6
    local refresh = 60
    local debug = 1
    ------------------------------------------------------
    -- Do not change anything from this point onwards
    ------------------------------------------------------

    local sourceTrigger = fibaro:getSourceTrigger()

    Debug = function ( color, message )
      fibaro:debug(string.format('<%s style="color:%s;">%s', "span", color, message, "span"))
    end

    DebugError = function ( color, message )
      fibaro:debug(string.format('<%s style="color:%s;">%s', "span", color, message, "span"))
    end

    Debug('orange', 'GARDENA smartsystem - Autostart')
    Debug('white', 'This scene runs every: ' ..(refresh/60).. ' minutes')

    function addGlobal(vName, vValue)
      local http = net.HTTPClient({timeout=5000})
      requestData = json.encode({ name = vName, value = vValue })
      http:request("http://127.0.0.1:11111/api/globalVariables", { 
          options = {
            method = 'POST', 
            headers = { 
              ['Content-Type'] = 'application/json'
            },
            data = requestData,
            timeout =  5000
          }, 
          success = function(resp)
            if tonumber(resp.status) == 201 then
              if (debug == 1) then
                Debug("green", "status: "..tostring(resp.status)..", variable: "..vName.." added, value: "..vValue)
              else
                Debug("purple", "status: "..tostring(resp.status)..", variable: "..vName)
              end
            end
          end,
          error = function(err) 
            DebugError("red", "error: "..tostring(err)..", variable: "..vName.." adding FAILED")
          end
        })
    end

    function matchDevices(Identifier)
      devices = {}
      local httpClient = net.HTTPClient();
      httpClient:request('http://127.0.0.1:11111/api/virtualDevices', {
          success = function(resp)
            local devices = json.decode(resp.data)
            for i, v in pairs(devices) do
              if (v.properties.ip == Identifier) then       
                local vName = string.gsub(Identifier,'[%d%-%d]',"")
                local vValue = tostring(v.id)

                if (fibaro:getGlobalValue(vName) == nil) then
                  addGlobal(vName, vValue) -- nu
                  fibaro:setGlobal(vName, vValue)
                end
              end
            end
          end,
          error = function(err)
            print('error = ' .. err)
          end,
          options = {
            method = 'GET'
          }
        })
    end
    --end

    function makeLink(id)
      return string.format(
        '<a href="../devices/configuration.html?id=%u" target="_blank"'..
        'style="display:inline;color:Cyan">%u</a>',
        id, id)
    end


    function MakeTimeStamp1(dateString)
      local pattern =   "(%d+)/(%d+)/(%d+),%s(%d+):(%d+)"
      local xday, xmonth, xyear, xhour, xminute, xseconds = dateString:match(pattern)
      local converted_timestamp = os.time({year = xyear, month = xmonth, day = xday, hour = xhour, min = xminute, sec = xseconds})
      local converted_time = os.date("%d-%m-%Y at %H:%M",converted_timestamp);
      return converted_time
    end

    function MakeTimeStamp2(dateString)
      local pattern =   "(%d+)%-(%d+)%-(%d+)T(%d+):(%d+)(%u)"
      local xyear, xmonth, xday, xhour, xminute, xseconds, xoffset = dateString:match(pattern)
      local converted_timestamp = os.time({year = xyear, month = xmonth, day = xday, hour = xhour, min = xminute, sec = xseconds})
      local converted_time = os.date("%d-%m-%Y at %R",converted_timestamp);
      return converted_time
    end

    function MakeTimeStamp3(dateString)
      local pattern =   "^(%d%d%d%d)-(%d%d)-(%d%d)T(%d%d):(%d%d):(%d%d)(.-)$"
      local xyear, xmonth, xday, xhour, xminute, xseconds, xoffset = dateString:match(pattern)
      local converted_timestamp = os.time({year = xyear, month = xmonth, day = xday, hour = xhour, min = xminute, sec = xseconds})
      local converted_time = os.date("%d-%m-%Y at %R",converted_timestamp);
      return converted_time
    end

    function gAuth(nextFunction)
      local request_body = '{"sessions":{"email":"' .. username .. '","password":"' .. password ..'"}}'
      getSessionData('https://sg-api.dss.husqvarnagroup.net/sg-1/sessions', request_body,
        function(data)
        if (data.sessions ~= nil) then
          local token = data.sessions.token
          local user_id = data.sessions.user_id

          addGlobal('gardena_parameters', "")
          addGlobal('gardena_command', "")
          addGlobal('gardena_userid', "")
          addGlobal('gardena_token', "")
          addGlobal('gardena_location', "")
          fibaro:setGlobal('gardena_token', token)
          fibaro:setGlobal('gardena_userid', user_id)

          if (debug == 1) then
            Debug('white', 'Authentication was succesful')
          end
          gLocation()
        else
          DebugError( 'red', 'Authentication failed. Please check username and password')
        end
      end
    )
    setTimeout(gAuth, refresh*1000);
    end

    function getSessionData(url, body, func)
      local http = net.HTTPClient()
      http:request(url, {
          options = {
            method = 'POST',
            headers = {
              ['Content-Type'] = 'application/json'
            },
            data = body
          },
          success = function(response)
            if response.status == 200 or response.status == 201 then
              func(json.decode(response.data))
            else
            end
          end
        })
    end

    function gLocation()
      local token = fibaro:getGlobal('gardena_token')
      local user_id = fibaro:getGlobal('gardena_userid')
      local url = 'https://sg-api.dss.husqvarnagroup.net/sg-1/locations/?user_id=' .. user_id
      local http = net.HTTPClient()
      http:request(url, {
          options={
            headers = {['Content-Type'] = 'application/json',['X-Session'] = token},
            method = 'GET',
            timeout = 5000
          },
          success = function(status)
            local response = json.decode(status.data)
            local name = response.locations[1].name
            local location = response.locations[1].id

            fibaro:setGlobal('gardena_location', location)
            gDevices()
            if (debug == 1) then
              Debug('white', "Locating GARDENA smartsystem devices in " ..name)
              Debug('yellow', "* * * * * * * * * * * * * * * * * * * * * * * * * * * * *")
            end
          end,
        })
    end

    function gDevices()
      local token = fibaro:getGlobal('gardena_token')
      local user_id = fibaro:getGlobal('gardena_userid')
      local location = fibaro:getGlobal('gardena_location')
      local url = 'https://sg-api.dss.husqvarnagroup.net/sg-1/devices?locationId=' .. location
      local http = net.HTTPClient()
      http:request(url, {
          options={
            headers = {['Content-Type'] = 'application/json',['X-Session'] = token},
            method = 'GET',
            timeout = 5000
          },
          success = function(status)
            if status.status ~= 200 and status.status ~= 201 then print("failed"); end
            if status.status == 200 then
              local response = json.decode(status.data)
              local name = response.devices[1].name
              local device = response.devices[1].id    

              for k,v in pairs(response.devices) do
                local vName = string.gsub(v.id,'[%d%-%d]',"")
                local vValue = tostring(v.id) 
                local VirtualDevice = fibaro:getGlobalValue(vName)

                local deviceid = matchDevices(v.id)
                if (debug == 1) then

                  Debug('yellow', "* * * * * * * * * * * * * * * * * * * * * * * * * * * * *")
                  Debug('white', "Found the following GARDENA "..v.category.. ":")
                  Debug('yellow', "Name: "..v.name)  
                  Debug('yellow', "Identifier: "..v.id)  
                  if (VirtualDevice ~= nil) then
                    Debug("white", "Corresponding Fibaro virtual device is " ..makeLink(VirtualDevice))
                  end                  

                  if v.category == "gateway" then  
                  end              

                  --Find GARDENA Mowers
                  if v.category == "mower" then

                    for a, b in pairs(v.abilities) do
                      for c, d in pairs(b.properties) do
                        if (d.name == 'last_time_online') then
                          stamp_last_time_online = string.len(tostring(d.value))                       
                          if (stamp_last_time_online == 17) then  
                            local mower_online = (MakeTimeStamp2(d.value))
                          elseif (stamp_last_time_online == 20) then         
                            local mower_online = (MakeTimeStamp3(d.value))
                            if (debug == 1) then Debug("white", "Last on-line on " ..mower_online) end
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.moweronline.value", mower_online) end end           
                          elseif (d.name == 'level') then
                            local mower_battery_level = (d.value .. " %")
                            if (debug == 1) then Debug("white", "Battery level is " ..mower_battery_level) end
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerbatterylevel.value", mower_battery_level) end         
                          elseif (d.name == 'rechargeable_battery_status') and (d.value == 'ok') then
                            local mower_battery_status = "OK"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerbatterystatus.value", mower_battery_status) end 
                            if (debug == 1) then Debug("white", "Battery health is " ..mower_battery_status) end            
                          elseif (d.name == 'rechargeable_battery_status') and (d.value == 'weak') then
                            local mower_battery_status = "weak"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerbatterystatus.value", mower_battery_status) end
                            if (debug == 1) then Debug("white", "Battery health is " ..mower_battery_status) end
                          elseif (d.name == 'rechargeable_battery_status') and (d.value == 'undefined') then
                            local mower_battery_status = "undefined"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerbatterystatus.value", mower_battery_status) end
                            if (debug == 1) then Debug("white", "Battery health is " ..mower_battery_status) end
                          elseif (d.name == 'charging') and (d.value == false) then
                            local mower_charging = "no"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowercharging.value", mower_charging) end
                            if (debug == 1) then Debug("white", "Charging:  " ..mower_charging) end
                          elseif (d.name == 'charging') and (d.value == true) then
                            local mower_charging = "yes"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowercharging.value", mower_charging) end
                            if (debug == 1) then Debug("white", "Charging: " ..mower_charging) end
                          elseif (d.name == 'quality') then
                            local mower_quality = (d.value .. " %" )
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerquality.value", mower_quality) end
                            if (debug == 1) then Debug("white", "Signal quality is " ..mower_quality) end
                          elseif (d.name == 'connection_status') and (d.value == "unknown") then
                            local mower_connection_status = "unknown"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerconnectionstatus.value", mower_connection_status) end
                            if (debug == 1) then Debug("white", "Connection status is " ..mower_connection_status) end
                          elseif (d.name == 'connection_status') and (d.value == "status_device_unreachable") then
                            local mower_connection_status = "lost"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerconnectionstatus.value", mower_connection_status) end
                            if (debug == 1) then Debug("white", "Connection is " ..mower_connection_status) end
                          elseif (d.name == 'connection_status') and (d.value == "status_device_alive") then
                            local mower_connection_status = "alive"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerconnectionstatus.value", mower_connection_status) end 
                            if (debug == 1) then Debug("white", "Connection is " ..mower_connection_status) end
                          elseif (d.name == 'state') and d.value == "bad" then
                            local mower_state = "bad"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstate.value", mower_state) end
                            if (debug == 1) then Debug("white", "Radio link is " ..mower_state) end
                          elseif (d.name == 'state') and d.value == "poor" then
                            local mower_state = "poor"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstate.value", mower_state) end
                            if (debug == 1) then Debug("white", "Radio link is " ..mower_state) end
                          elseif (d.name == 'state') and d.value == "good" then
                            local mower_state = "good"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstate.value", mower_state) end
                            if (debug == 1) then Debug("white", "Radio link is " ..mower_state) end
                          elseif (d.name == 'state') and d.value == "excellent" then
                            local mower_state = "excellent"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstate.value", mower_state) end
                            if (debug == 1) then Debug("white", "Radio link is " ..mower_state) end
                          elseif (d.name == 'state') and d.value == "undefined" then
                            local mower_state = "Undefined"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstate.value", mower_state) end
                            if (debug == 1) then Debug("white", "Radio link is " ..mower_state) end
                          elseif (d.name == 'temperature') and (d.unit == 'C') then
                            local mower_temperature = (d.value.. " °C")
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowertemperature.value", mower_temperature) end
                            if (debug == 1) then Debug("white", "Ambient termperature is " ..mower_temperature) end
                          elseif (d.name == 'temperature') and (d.unit == 'F') then
                            local mower_temperature = (d.value.. " °F")
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowertemperature.value", mower_temperature) end
                            if (debug == 1) then Debug("white", "Ambient termperature is " ..mower_temperature) end
                          elseif (d.name == 'status') and (d.value == "paused") then
                            local mower_status = "operation paused"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "ok_cutting") then
                            local mower_status = "OK - cutting away the grass!"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "ok_searching") then
                            local mower_status = "OK - searching"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "ok_charging") then
                            local mower_status = "OK - charging"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "ok_leaving") then
                            local mower_status = "OK - leaving"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "wait_updating") then
                            local mower_status = "waiting for update to be completed"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "wait_power_up") then
                            local mower_status = "waiting for power up to complete"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "parked_timer") then
                            local mower_status = "parked - on timer"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "parked_park_selected") then
                            local mower_status = "parked - per selection"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "off_disabled") then
                            local mower_status = "off - disabled"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "off_hatch_open") then
                            local mower_status = "off - hatch open"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "unknown") then
                            local mower_status = "unknown"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "error") then
                            local mower_status = "an error occurred"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "error_at_power_up") then
                            local mower_status = "error at power up"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "off_hatch_closed") then
                            local mower_status = "off - hatch closed"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "ok_cutting_time_overridden") then
                            local mower_status = "OK - cutting time overridden"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "Parked_autotimer") then
                            local mower_status = "parked - per automatic timer"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "parked_daily_limit_reached") then
                            local mower_status = "parked - daily limit reached"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "undefined") then
                            local mower_status = "undefined"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end 
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'manual_operation') and (d.value == true) then
                            local mower_manual_operation = "yes"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowermanualoperation.value", mower_manual_operation) end
                            if (debug == 1) then Debug("white", "Manual operation: " ..mower_manual_operation) end
                          elseif (d.name == 'manual_operation') and (d.value == false) then
                            local mower_manual_operation = "no"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowermanualoperation.value", mower_manual_operation) end
                            if (debug == 1) then Debug("white", "Manual operation:  " ..mower_manual_operation) end
                          elseif (d.name == 'error') and (d.value == "no_message") then
                            local mower_error = "all clear"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowererror.value", mower_error) end
                            if (debug == 1) then Debug("white", "Error message: " ..mower_error) end
                          elseif (d.name == 'error') and (d.value ~= "no_message") then
                            local mower_error = d.value
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowererror.value", mower_error) end
                            if (debug == 1) then Debug("white", "Error message: " ..mower_error) end
                          elseif (d.name == 'source_for_next_start') and (d.value == "no_source") then
                            local mower_source_for_next_start = "no source"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowersourcefornextstart.value", mower_source_for_next_start) end 
                            if (debug == 1) then Debug("white", "Source for next start is " ..mower_source_for_next_start) end
                          elseif (d.name == 'source_for_next_start') and (d.value == "completed_cutting daily_limit") then
                            local mower_source_for_next_start = "completed cutting - reached daily limit"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowersourcefornextstart.value", mower_source_for_next_start) end
                            if (debug == 1) then Debug("white", "Source for next start is " ..mower_source_for_next_start) end
                          elseif (d.name == 'source_for_next_start') and (d.value == "countdown_timer") then
                            local mower_source_for_next_start = "will resume when timer countdown is complete"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowersourcefornextstart.value", mower_source_for_next_start) end
                            if (debug == 1) then Debug("white", "Source for next start is " ..mower_source_for_next_start) end
                          elseif (d.name == 'source_for_next_start') and (d.value == "mower-charging") then
                            local mower_source_for_next_start = "will resume when finished charging "
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowersourcefornextstart.value", mower_source_for_next_start) end
                            if (debug == 1) then Debug("white", "Source for next start is " ..mower_source_for_next_start) end
                          elseif (d.name == 'source_for_next_start') and (d.value == "completed_cutting_autotimer") then
                            local mower_source_for_next_start = "completed cutting - according to timer"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowersourcefornextstart.value", mower_source_for_next_start) end
                            if (debug == 1) then Debug("white", "Source for next start is " ..mower_source_for_next_start) end
                          elseif (d.name == 'source_for_next_start') and (d.value == "undefined") then
                            local mower_source_for_next_start = "undefined"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowersourcefornextstart.value", mower_source_for_next_start) end
                            if (debug == 1) then Debug("white", "Source for next start is " ..mower_source_for_next_start) end
                          elseif (d.name == 'timestamp_next_start') then
                            stamp_timestamp_next_start = string.len(tostring(d.value))                        
                            if (stamp_timestamp_next_start == 17) then  
                              local mower_timestamp_next_start = (MakeTimeStamp2(d.value))
                            elseif (stamp_timestamp_next_start == 20) then         
                              local mower_timestamp_next_start = (MakeTimeStamp3(d.value))   
                              if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowertimestampnextstart.value", mower_timestamp_next_start) end
                              if (debug == 1) then Debug("white", "Next start on " ..mower_timestamp_next_start) end end
                            elseif (d.name == 'override_end_time') then
                              stamp_override_end_time = string.len(tostring(d.value))                       
                              if (stamp_override_end_time == 17) then  
                                local mower_override_end_time = (MakeTimeStamp2(d.value))
                              elseif (stamp_override_end_time == 20) then         
                                local mower_override_end_time = (MakeTimeStamp3(d.value)) 
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.moweroverrideendtime.value", mower_override_end_time) end
                                if (debug == 1) then Debug("white", "Override end time is on " ..mower_override_end_time) end end
                              elseif (d.name == 'firmware_status') and (d.value == "up_to_date") then
                                local mower_firmware_status = "up to date"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerfirmwarestatus.value", mower_firmware_status) end
                                if (debug == 1) then Debug("white", "Firmware is " ..mower_firmware_status) end
                              end
                            end
                          end
                        end

                        --Find GARDENA Sensors            
                        if v.category == "sensor" then
                          if (VirtualDevice ~= nil) then

                          end
                          for a, b in pairs(v.abilities) do
                            for c, d in pairs(b.properties) do
                              if (d.name == 'last_time_online') then
                                check = tostring(d.value)
                                if (check == "") then
                                  print ("nil value")
                                else            
                                  local sensor_online = (MakeTimeStamp3(d.value))
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensoronline.value", sensor_online) end
                                  if (debug == 1) then Debug("white", "Last on-line: " ..sensor_online) end end
                                elseif (d.name == 'level') then
                                  local sensor_battery_level = (d.value .. " %")
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorbatterylevel.value", sensor_battery_level) end
                                  if (debug == 1) then Debug("white", "Battery level is " ..sensor_battery_level) end
                                elseif (d.name == 'disposable_battery_status') and (d.value == 'out_of_operation') then
                                  local sensor_battery_status = "Out of operation"
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorbatterystatus.value", sensor_battery_status) end
                                  if (debug == 1) then Debug("white", "Battery health is " ..sensor_battery_status) end
                                elseif (d.name == 'disposable_battery_status') and (d.value == 'replace_now') then
                                  local sensor_battery_status = "Replace now"
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorbatterystatus.value", sensor_battery_status) end
                                  if (debug == 1) then Debug("white", "Battery health is " ..sensor_battery_status) end
                                elseif (d.name == 'disposable_battery_status') and (d.value == 'low') then
                                  local sensor_battery_status = "Low"
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorbatterystatus.value", sensor_battery_status) end
                                  if (debug == 1) then Debug("white", "Battery health is " ..sensor_battery_status) end
                                elseif (d.name == 'disposable_battery_status') and (d.value == 'ok') then
                                  local sensor_battery_status = "OK"
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorbatterystatus.value", sensor_battery_status) end
                                  if (debug == 1) then Debug("white", "Battery health is " ..sensor_battery_status) end
                                elseif (d.name == 'disposable_battery_status') and (d.value == 'undefined') then
                                  local sensor_battery_status = "Undefined"
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorbatterystatus.value", sensor_battery_status) end
                                  if (debug == 1) then Debug("white", "Battery health is " ..sensor_battery_status) end
                                elseif (d.name == 'quality') then
                                  local sensor_quality = (d.value .. " %" )
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorquality.value", sensor_quality) end
                                  if (debug == 1) then Debug("white", "Signal quality is " ..sensor_quality) end
                                elseif (d.name == 'connection_status') and (d.value == "unknown") then
                                  local sensor_connection_status = "unknown"
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorconnectionstatus.value", sensor_connection_status) end
                                  if (debug == 1) then Debug("white", "Connection status is " ..sensor_connection_status) end
                                elseif (d.name == 'connection_status') and (d.value == "status_device_unreachable") then
                                  local sensor_connection_status = "lost"
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorconnectionstatus.value", sensor_connection_status) end
                                  if (debug == 1) then Debug("white", "Connection status is " ..sensor_connection_status) end
                                elseif (d.name == 'connection_status') and (d.value == "status_device_alive") then
                                  local sensor_connection_status = "alive"
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorconnectionstatus.value", sensor_connection_status) end
                                  if (debug == 1) then Debug("white", "Connection status is " ..sensor_connection_status) end
                                elseif (d.name == 'state') and d.value == "bad" then
                                  local sensor_state = "bad"
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorconnectionstatus.value", sensor_connection_status) end
                                  if (debug == 1) then Debug("white", "Connection status is " ..sensor_state) end
                                elseif (d.name == 'state') and d.value == "poor" then
                                  local sensor_state = "poor"
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorstate.value", sensor_state) end
                                  if (debug == 1) then Debug("white", "Radio link is " ..sensor_state) end
                                elseif (d.name == 'state') and d.value == "good" then
                                  local sensor_state = "good"
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorstate.value", sensor_state) end
                                  if (debug == 1) then Debug("white", "Radio link is " ..sensor_state) end
                                elseif (d.name == 'state') and d.value == "undefined" then
                                  local sensor_state = "undefined"
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorstate.value", sensor_state) end
                                  if (debug == 1) then Debug("white", "Radio link is " ..sensor_state) end
                                elseif (b.type == 'soil_temperature_sensor') and (d.name == 'temperature') and (d.unit == 'C') then
                                  local sensor_soil_temperature = (d.value .. " °C")
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorsoiltemperature.value", sensor_soil_temperature) end
                                  if (debug == 1) then Debug("white", "Soil temperature is " ..sensor_soil_temperature) end
                                elseif (b.type == 'soil_temperature_sensor') and (d.name == 'temperature') and (d.unit == 'F') then
                                  local sensor_soil_temperature = (d.value .. " °F")
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorsoiltemperature.value", sensor_soil_temperature) end
                                  if (debug == 1) then Debug("white", "Soil temperature is " ..sensor_soil_temperature) end
                                elseif (b.type == 'ambient_temperature_sensor') and (d.name == 'temperature') then
                                  local sensor_ambient_temperature = (d.value .. " °C" )
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorambienttemperature.value", sensor_ambient_temperature) end
                                  if (debug == 1) then Debug("white", "Ambient temperature is " .. sensor_ambient_temperature) end
                                elseif (b.type == 'ambient_temperature_sensor') and (d.name == 'temperature') and (d.uni == 'F') then
                                  local sensor_ambient_temperature = (d.value .. " °F" )
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorambienttemperature.value", sensor_ambient_temperature) end
                                  if (debug == 1) then Debug("white", "Ambient temperature is " .. sensor_ambient_temperature) end
                                elseif (d.name == 'frost_warning') and (d.value == "no_frost") then
                                  local sensor_frost_warning = "No frost warning"
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorfrostwarning.value", sensor_frost_warning) end
                                  if (debug == 1) then Debug("white", sensor_frost_warning) end
                                elseif (d.name == 'frost_warning') and (d.value == "frost") then
                                  local sensor_frost_warning = "Frost warning!"
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorfrostwarning.value", sensor_frost_warning) end
                                  if (debug == 1) then Debug("white", sensor_frost_warning) end
                                elseif (d.name == 'frost_warning') and (d.value == "undefined") then
                                  local sensor_frost_warning = "Frost warning status undefined"
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorfrostwarning.value", sensor_frost_warning) end
                                  if (debug == 1) then Debug("white", sensor_frost_warning) end
                                elseif (d.name == 'humidity') then
                                  local sensor_humidity = (d.value .. " %")
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorhumidity.value", sensor_humidity) end
                                  if (debug == 1) then Debug("white", "Soil humidity is " ..sensor_humidity) end
                                elseif (d.name == 'light') then
                                  local sensor_light = (d.value.. " lx")
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorlight.value", sensor_light) end
                                  if (debug == 1) then Debug("white", "Light intensity is " ..sensor_light) end
                                elseif (d.name == 'firmware_status') and (d.value == "up_to_date") then
                                  local sensor_firmware_status = "up to date"
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorfirmwarestatus.value", sensor_firmware_status) end
                                  if (debug == 1) then Debug("white", "Firmware is " ..sensor_firmware_status) end              
                                end
                              end
                            end
                          end
                        end

                        --Find GARDENA Watering Computers          
                        if v.category == "watering_computer" then

                          for a, b in pairs(v.abilities) do
                            for c, d in pairs(b.properties) do
                              if (d.name == 'last_time_online') then
                                local watering_computer_online = (MakeTimeStamp1(d.value))
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputeronline.value", watering_computer_online) end
                                if (debug == 1) then Debug("white", "Last on-line on " ..watering_computer_online) end
                              elseif (d.name == 'level') then
                                local watering_computer_battery_level = (d.value .. " %")
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerbatterylevel.value", watering_computer_battery_level) end
                                if (debug == 1) then Debug("white", "Battery level is " ..watering_computer_battery_level) end
                              elseif (d.name == 'disposable_battery_status') and (d.value == 'out_of_operation') then
                                local watering_computer_battery_status = "Out of operation"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerbatterystatus.value", watering_computer_battery_status) end
                                if (debug == 1) then Debug("white", "Battery health is " ..watering_computer_battery_status) end
                              elseif (d.name == 'disposable_battery_status') and (d.value == 'replace_now') then
                                local watering_computer_battery_status = "Replace batteries now"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerbatterystatus.value", watering_computer_battery_status) end
                                if (debug == 1) then Debug("white", "Battery health is " ..watering_computer_battery_status) end
                              elseif (d.name == 'disposable_battery_status') and (d.value == 'low') then
                                local watering_computer_battery_status = "Batteries are low"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerbatterystatus.value", watering_computer_battery_status) end
                                if (debug == 1) then Debug("white", watering_computer_battery_status) end
                              elseif (d.name == 'disposable_battery_status') and (d.value == 'ok') then
                                local watering_computer_battery_status = "OK"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerbatterystatus.value", watering_computer_battery_status) end
                                if (debug == 1) then Debug("white", "Battery health is " ..watering_computer_battery_status) end
                              elseif (d.name == 'disposable_battery_status') and (d.value == 'undefined') then
                                local watering_computer_battery_status = "Undefined"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerbatterystatus.value", watering_computer_battery_status) end
                                if (debug == 1) then Debug("white", "Battery health is " ..watering_computer_battery_status) end
                              elseif (d.name == 'quality') then
                                local watering_computer_quality = (d.value .. "%" )
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerquality.value", watering_computer_quality) end
                                if (debug == 1) then Debug("white", "Signal quality is " ..watering_computer_quality) end
                              elseif (d.name == 'connection_status') and (d.value == "unknown") then
                                local watering_computer_connection_status = "unknown"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerconnectionstatus.value", watering_computer_connection_status) end
                                if (debug == 1) then Debug("white", "Connection status is " ..watering_computer_connection_status) end
                              elseif (d.name == 'connection_status') and (d.value == "status_device_unreachable") then
                                local watering_computer_connection_status = "lost"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerconnectionstatus.value", watering_computer_connection_status) end
                                if (debug == 1) then Debug("white", "Connection status is " ..watering_computer_connection_status) end
                              elseif (d.name == 'connection_status') and (d.value == "status_device_alive") then
                                local watering_computer_connection_status = "alive"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerconnectionstatus.value", watering_computer_connection_status) end
                                if (debug == 1) then Debug("white", "Connection status is " ..watering_computer_connection_status) end
                              elseif (d.name == 'state') and d.value == "bad" then
                                local watering_computer_state = "bad"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerstate.value", watering_computer_state) end
                                if (debug == 1) then Debug("white", "Radio link is " ..watering_computer_state) end
                              elseif (d.name == 'state') and d.value == "poor" then
                                local watering_computer_state = "poor"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerstate.value", watering_computer_state) end
                                if (debug == 1) then Debug("white", "Radio link is " ..watering_computer_state) end
                              elseif (d.name == 'state') and d.value == "good" then
                                local watering_computer_state = "good"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerstate.value", watering_computer_state) end
                                if (debug == 1) then Debug("white", "Radio link is " ..watering_computer_state) end
                              elseif (d.name == 'state') and d.value == "undefined" then
                                local watering_computer_state = "undefined"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerstate.value", watering_computer_state) end
                                if (debug == 1) then Debug("white", "Radio link is " ..watering_computer_state) end
                              elseif (d.name == 'valve_open') and (d.value == false) then
                                local watering_computer_valve_open = "closed"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputervalveopen.value", watering_computer_valve_open) end
                                if (debug == 1) then Debug("white", "Water valve is " ..watering_computer_valve_open) end
                              elseif (d.name == 'valve_open') and (d.value == true) then
                                local watering_computer_valve_open = "open"
                                if (debug == 1) then Debug("white", "Watervalve is " ..watering_computer_valve_open) end
                              elseif (d.name == 'manual_override') and d.value == "inactive" then
                                local watering_computer_manual_override = "inactive"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputermanualoverride.value", watering_computer_manual_override) end
                                if (debug == 1) then Debug("white", "Manual override is " ..watering_computer_manual_override) end
                              elseif (d.name == 'manual_override') and d.value == "open" then
                                local watering_computer_manual_override = "open"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputermanualoverride.value", watering_computer_manual_override) end
                                if (debug == 1) then Debug("white", "Manual override is " ..watering_computer_manual_override) end
                              elseif (d.name == 'manual_override') and d.value == "undefined" then
                                local watering_computer_manual_override = "undefined"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputermanualoverride.value", watering_computer_manual_override) end
                                if (debug == 1) then Debug("white", "Manual override is " ..watering_computer_manual_override) end
                              elseif (d.name == 'button_manual_override_time') then
                                local watering_computer_button_manual_override_time = d.value.. " minutes"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerbuttonmanualoverridetime.value", watering_computer_button_manual_override_time) end
                                if (debug == 1) then Debug("white", "Manual override time is " ..watering_computer_button_manual_override_time) end
                              elseif (d.name == 'last_manual_override_time') then
                                local watering_computer_last_manual_override_time = d.value.. " minutes"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerlastmanualoverridetime.value", watering_computer_last_manual_override_time) end
                                if (debug == 1) then Debug("white", "Last manual override lasted " ..watering_computer_last_manual_override_time) end
                              elseif (d.name == 'temperature') and (d.unit == 'C') then
                                local watering_computer_temperature = d.value.. " °C"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputertemperature.value", watering_computer_temperature) end
                                if (debug == 1) then Debug("white", "Ambient temperature is " .. watering_computer_temperature) end
                              elseif (d.name == 'temperature') and (d.unit == 'F') then
                                local watering_computer_temperature = d.value.. " °F"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputertemperature.value", watering_computer_temperature) end
                                if (debug == 1) then Debug("white", "Ambient temperature is " .. watering_computer_temperature) end
                              elseif (d.name == 'frost_warning') and (d.value == "no_frost") then
                                local watering_computer_frost_warning = "no frost warning"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerfrostwarning.value", watering_computer_frost_warning) end
                                if (debug == 1) then Debug("white", watering_computer_frost_warning) end
                              elseif (d.name == 'frost_warning') and (d.value == "frost") then
                                local watering_computer_frost_warning = "frost warning!"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerfrostwarning.value", watering_computer_frost_warning) end
                                if (debug == 1) then Debug("white", watering_computer_frost_warning) end
                              elseif (d.name == 'frost_warning') and (d.value == "undefined") then
                                local watering_computer_frost_warning = "frost warning status undefined"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerfrostwarning.value", watering_computer_frost_warning) end
                                if (debug == 1) then Debug("white", watering_computer_frost_warning) end
                              elseif (d.name == 'adaptive_scheduling_last_decision') and (d.value == "undefined") then
                                local watering_computer_adaptive_scheduling_last_decision = "undefined"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputeradpativeschedulinglastdecision.value", watering_computer_adaptive_scheduling_last_decision) end
                                if (debug == 1) then Debug("white", "Adaptive scheduling last decision is " ..watering_computer_adaptive_scheduling_last_decision) end
                              elseif (d.name == 'adaptive_scheduling_last_decision') and (d.value == "watered_sensor_timeout") then
                                local watering_computer_adaptive_scheduling_last_decision = "timed out by soil moisture sensor"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputeradpativeschedulinglastdecision.value", watering_computer_adaptive_scheduling_last_decision) end
                                if (debug == 1) then Debug("white", "Adaptive scheduling last decision " ..watering_computer_adaptive_scheduling_last_decision) end
                              elseif (d.name == 'adaptive_scheduling_last_decision') and (d.value == "skipped") then
                                local watering_computer_adaptive_scheduling_last_decision = "skipped by adaptive scheduling"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputeradpativeschedulinglastdecision.value", watering_computer_adaptive_scheduling_last_decision) end
                                if (debug == 1) then Debug("white", "Adaptive scheduling last decision " ..watering_computer_adaptive_scheduling_last_decision) end
                              elseif (d.name == 'adaptive_scheduling_last_decision') and (d.value == "watered") then
                                local watering_computer_adaptive_scheduling_last_decision = "to water"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputeradpativeschedulinglastdecision.value", watering_computer_adaptive_scheduling_last_decision) end
                                if (debug == 1) then Debug("white", "Adaptive scheduling last decision is " ..watering_computer_adaptive_scheduling_last_decision) end
                              elseif (d.name == 'scheduled_watering_end') then
                                local watering_computer_scheduled_watering_end = MakeTimeStamp3(d.timestamp)
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerscheduledwateringend.value", watering_computer_scheduled_watering_end) end
                                if (debug == 1) then Debug("white", "Watering is scheduled to end on " ..watering_computer_scheduled_watering_end) end
                              elseif (d.name == 'scheduled_watering_next_start') then
                                local watering_computer_scheduled_watering_next_start = MakeTimeStamp3(d.timestamp)
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerscheduledwateringnextstart.value", watering_computer_scheduled_watering_next_start) end
                                if (debug == 1) then Debug("white", "Watering is scheduled to start on " ..watering_computer_scheduled_watering_next_start) end
                              elseif (d.name == 'firmware_status') and (d.value == "up_to_date") then
                                local watering_computer_firmware_status = "up to date"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerfirmwarestatus.value", watering_computer_firmware_status) end
                                if (debug == 1) then Debug("white", "Firmware is " ..watering_computer_firmware_status) end            
                              end
                            end
                          end
                        end
                      end
                    end
                  end,
                })
            end
            if ( sourceTrigger["type"] == "autostart" or "manual") then
              gAuth()
            end  

     

    IMG_0088.jpg

  9. M*rde!

    J'ai fait les motifs demandées, puis enregistré...

    Toujours la même erreur

     

    [DEBUG] 18:47:18: GARDENA smartsystem - Autostart
    [DEBUG] 18:47:18: This scene runs every: 1 minutes
    [DEBUG] 18:47:19: Authentication was succesful
    [DEBUG] 18:47:19: Locating GARDENA smartsystem devices in My Garden
    [DEBUG] 18:47:19: * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    [DEBUG] 18:47:20: * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    [DEBUG] 18:47:20: Found the following GARDENA gateway:
    [DEBUG] 18:47:20: Name: Gateway
    [DEBUG] 18:47:20: Identifier: aa660928-8e02-47c1-bb49-69f2ea446d34
    [DEBUG] 18:47:20: * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    [DEBUG] 18:47:20: Found the following GARDENA sensor:
    [DEBUG] 18:47:20: Name: Sonde
    [DEBUG] 18:47:20: Identifier: 62f42561-495b-4609-b3c4-9d1fad2231d6
    [DEBUG] 18:47:20: Last on-line: 22-03-2018 at 17:41
    [DEBUG] 18:47:20: Battery level is 6 %
    [DEBUG] 18:47:20: Battery health is Low
    [DEBUG] 18:47:20: Signal quality is 50 %
    [DEBUG] 18:47:20: Connection status is unknown
    [DEBUG] 18:47:20: Radio link is good
    [DEBUG] 18:47:20: Ambient temperature is 7 °C
    [DEBUG] 18:47:20: No frost warning
    [DEBUG] 18:47:20: Soil temperature is 7 °C
    [DEBUG] 18:47:20: Soil humidity is 100 %
    [DEBUG] 18:47:20: Light intensity is 148 lx
    [DEBUG] 18:47:20: Firmware is up to date
    [DEBUG] 18:47:20: * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    [DEBUG] 18:47:20: Found the following GARDENA watering_computer:
    [DEBUG] 18:47:20: Name: Voiture 
    [DEBUG] 18:47:20: Identifier: 6e9487da-a290-43af-9576-6349670c2f55
    [DEBUG] 18:47:20: [1;31m2018-03-22 18:47:20.542074 [ fatal] LUA error: /opt/fibaro/scenes/10.lua:99: field 'day' missing in date table
  10. il y a 5 minutes, pepite a dit :

     

    Tu as quelle date d'indiquée dans ton application qui pourrait correspondre au last-on line ? As tu moyen de provoquer une connexion du Water Computer "Voiture"

    Salut pepite et merci pour ta réponse

    J'ai envoyé hier soir une commande test d'arrosage. Elle a été activées par l’application mobile dont tu vois une copie d'écran ci-dessous.

    Gardena.png.21361973fc9a64e6372a3dbd998fb8c1.png

     

    Je vais, ce soir, essayer de restarter mon Gateway et relancer un cycle d'arrosage.Et si ça ne fonctionne toujours pas j'écrirai au Marketplace.

    Merci je te tiens au courant.

     

     

  11. On avance... mais... 

    On voit: Gartena Gateway, c'est bon

    On voit la sonde, c'est bon

    et on voit le début d'un water Control qui se nomme voiture mais  j'en ai 4 au total et il les voit pas 

    as-tu une idée

     

     

    [DEBUG] 19:33:59: GARDENA smartsystem - Autostart
    [DEBUG] 19:33:59: This scene runs every: 1 minutes
    [DEBUG] 19:33:59: Authentication was succesful
    [DEBUG] 19:34:00: Locating GARDENA smartsystem devices in My Garden
    [DEBUG] 19:34:00: * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    [DEBUG] 19:34:01: * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    [DEBUG] 19:34:01: Found the following GARDENA gateway:
    [DEBUG] 19:34:01: Name: Gateway
    [DEBUG] 19:34:01: Identifier: aa660928-8e02-47c1-bb49-69f2ea446d34
    [DEBUG] 19:34:01: * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    [DEBUG] 19:34:01: Found the following GARDENA sensor:
    [DEBUG] 19:34:01: Name: Sonde
    [DEBUG] 19:34:01: Identifier: 62f42561-495b-4609-b3c4-9d1fad2231d6
    [DEBUG] 19:34:01: Last on-line: 21-03-2018 at 17:41
    [DEBUG] 19:34:01: Battery level is 7 %
    [DEBUG] 19:34:01: Battery health is Low
    [DEBUG] 19:34:01: Signal quality is 50 %
    [DEBUG] 19:34:01: Connection status is unknown
    [DEBUG] 19:34:01: Radio link is good
    [DEBUG] 19:34:01: Ambient temperature is 5 °C
    [DEBUG] 19:34:01: No frost warning
    [DEBUG] 19:34:01: Soil temperature is 7 °C
    [DEBUG] 19:34:01: Soil humidity is 100 %
    [DEBUG] 19:34:01: Light intensity is 140 lx
    [DEBUG] 19:34:01: Firmware is up to date
    [DEBUG] 19:34:01: * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    [DEBUG] 19:34:01: Found the following GARDENA watering_computer:
    [DEBUG] 19:34:01: Name: Voiture 
    [DEBUG] 19:34:01: Identifier: 6e9487da-a290-43af-9576-6349670c2f55
    [DEBUG] 19:34:01: [1;31m2018-03-21 19:34:01.226013 [ fatal] LUA error: /opt/fibaro/scenes/10.lua:99: field 'day' missing in date table
  12. il y a 18 minutes, pepite a dit :

    Alors où en es tu ?? Ca avance???

    Salut pepite,

    Pas trop je suis un peu perdu. :angry:

    Tu entends quoi par recréer les variables? c'est remettre mon même username et mon password , enregistrer et relancer??? ou autre chose

     

    Mon Gateway Gardena est en wifi, tu penses que si il était en LAN ça résoudrait le problème?

  13. il y a 26 minutes, pepite a dit :

    A priori, faut recreer les variables et arreter plsuieurs fois et relancer plusieurs fois le script.

    tu entends quoi par ça?

    MERCI

     

    --[[
    %% properties
    %% autostart
    %% globals
    --]]

    ------------------------------------------------------
    -- Customize the following data (GARDENA smartsystem)
    ------------------------------------------------------
    local username = 'nom@hotmail.com'
    local password = 'mot de passe'
    ------------------------------------------------------
    local max_counter = 6
    local refresh = 60
    local debug = 1
    ------------------------------------------------------
    -- Do not change anything from this point onwards
    ------------------------------------------------------

    local sourceTrigger = fibaro:getSourceTrigger()

    Debug = function ( color, message )
      fibaro:debug(string.format('<%s style="color:%s;">%s', "span", color, message, "span"))
    end

    DebugError = function ( color, message )
      fibaro:debug(string.format('<%s style="color:%s;">%s', "span", color, message, "span"))
    end

    Debug('orange', 'GARDENA smartsystem - Autostart')
    Debug('white', 'This scene runs every: ' ..(refresh/60).. ' minutes')

    function addGlobal(vName, vValue)
      local http = net.HTTPClient({timeout=5000})
      requestData = json.encode({ name = vName, value = vValue })
      http:request("http://127.0.0.1:11111/api/globalVariables", { 
          options = {
            method = 'POST', 
            headers = { 
              ['Content-Type'] = 'application/json'
            },
            data = requestData,
            timeout =  5000
          }, 
          success = function(resp)
            if tonumber(resp.status) == 201 then
              if (debug == 1) then
                Debug("green", "status: "..tostring(resp.status)..", variable: "..vName.." added, value: "..vValue)
              else
                Debug("purple", "status: "..tostring(resp.status)..", variable: "..vName)
              end
            end
          end,
          error = function(err) 
            DebugError("red", "error: "..tostring(err)..", variable: "..vName.." adding FAILED")
          end
        })
    end

    function matchDevices(Identifier)
      devices = {}
      local httpClient = net.HTTPClient();
      httpClient:request('http://127.0.0.1:11111/api/virtualDevices', {
          success = function(resp)
            local devices = json.decode(resp.data)
            for i, v in pairs(devices) do
              if (v.properties.ip == Identifier) then       
                local vName = string.gsub(Identifier,'[%d%-%d]',"")
                local vValue = tostring(v.id)

                if (fibaro:getGlobalValue(vName) == nil) then
                  addGlobal(vName, vValue) -- nu
                  fibaro:setGlobal(vName, vValue)
                end
              end
            end
          end,
          error = function(err)
            print('error = ' .. err)
          end,
          options = {
            method = 'GET'
          }
        })
    end
    --end

    function makeLink(id)
      return string.format(
        '<a href="../devices/configuration.html?id=%u" target="_blank"'..
        'style="display:inline;color:Cyan">%u</a>',
        id, id)
    end


    function MakeTimeStamp(dateString)
      local pattern =   "(%d+)%-(%d+)%-(%d+)T(%d+):(%d+):(%d+)(%u)"
      local xyear, xmonth, xday, xhour, xminute, xseconds, xoffset = dateString:match(pattern)
      local converted_timestamp = os.time({year = xyear, month = xmonth, day = xday, hour = xhour, min = xminute, sec = xseconds})
      local converted_time = os.date("%d-%m-%Y at %H:%M",converted_timestamp);
      return converted_time
    end

    function MakeTimeStamp2(dateString)
      local pattern =   "(%d+)%-(%d+)%-(%d+)T(%d+):(%d+)(%u)"
      local xyear, xmonth, xday, xhour, xminute, xseconds, xoffset = dateString:match(pattern)
      local converted_timestamp = os.time({year = xyear, month = xmonth, day = xday, hour = xhour, min = xminute, sec = xseconds})
      local converted_time = os.date("%d-%m-%Y at %R",converted_timestamp);
      return converted_time
    end

    function MakeTimeStamp3(dateString)
      local pattern =   "^(%d%d%d%d)-(%d%d)-(%d%d)T(%d%d):(%d%d):(%d%d)(.-)$"
      local xyear, xmonth, xday, xhour, xminute, xseconds, xoffset = dateString:match(pattern)
      local converted_timestamp = os.time({year = xyear, month = xmonth, day = xday, hour = xhour, min = xminute, sec = xseconds})
      local converted_time = os.date("%d-%m-%Y at %R",converted_timestamp);
      return converted_time
    end

    function gAuth(nextFunction)
      local request_body = '{"sessions":{"email":"' .. username .. '","password":"' .. password ..'"}}'
      getSessionData('https://sg-api.dss.husqvarnagroup.net/sg-1/sessions', request_body,
        function(data)
        if (data.sessions ~= nil) then
          local token = data.sessions.token
          local user_id = data.sessions.user_id

          addGlobal('gardena_parameters', "")
          addGlobal('gardena_command', "")
          addGlobal('gardena_userid', "")
          addGlobal('gardena_token', "")
          addGlobal('gardena_location', "")
          fibaro:setGlobal('gardena_token', token)
          fibaro:setGlobal('gardena_userid', user_id)

          if (debug == 1) then
            Debug('white', 'Authentication was succesful')
          end
          gLocation()
        else
          DebugError( 'red', 'Authentication failed. Please check username and password')
        end
      end
    )
    setTimeout(gAuth, refresh*1000);
    end

    function getSessionData(url, body, func)
      local http = net.HTTPClient()
      http:request(url, {
          options = {
            method = 'POST',
            headers = {
              ['Content-Type'] = 'application/json'
            },
            data = body
          },
          success = function(response)
            if response.status == 200 or response.status == 201 then
              func(json.decode(response.data))
            else
            end
          end
        })
    end

    function gLocation()
      local token = fibaro:getGlobal('gardena_token')
      local user_id = fibaro:getGlobal('gardena_userid')
      local url = 'https://sg-api.dss.husqvarnagroup.net/sg-1/locations/?user_id=' .. user_id
      local http = net.HTTPClient()
      http:request(url, {
          options={
            headers = {['Content-Type'] = 'application/json',['X-Session'] = token},
            method = 'GET',
            timeout = 5000
          },
          success = function(status)
            local response = json.decode(status.data)
            local name = response.locations[1].name
            local location = response.locations[1].id

            fibaro:setGlobal('gardena_location', location)
            gDevices()
            if (debug == 1) then
              Debug('white', "Locating GARDENA smartsystem devices in " ..name)
              Debug('yellow', "* * * * * * * * * * * * * * * * * * * * * * * * * * * * *")
            end
          end,
        })
    end

    function gDevices()
      local token = fibaro:getGlobal('gardena_token')
      local user_id = fibaro:getGlobal('gardena_userid')
      local location = fibaro:getGlobal('gardena_location')
      local url = 'https://sg-api.dss.husqvarnagroup.net/sg-1/devices?locationId=' .. location
      local http = net.HTTPClient()
      http:request(url, {
          options={
            headers = {['Content-Type'] = 'application/json',['X-Session'] = token},
            method = 'GET',
            timeout = 5000
          },
          success = function(status)
            if status.status ~= 200 and status.status ~= 201 then print("failed"); end
            if status.status == 200 then
              local response = json.decode(status.data)
              local name = response.devices[1].name
              local device = response.devices[1].id    

              for k,v in pairs(response.devices) do
                local vName = string.gsub(v.id,'[%d%-%d]',"")
                local vValue = tostring(v.id) 
                local VirtualDevice = fibaro:getGlobalValue(vName)

                local deviceid = matchDevices(v.id)
                if (debug == 1) then

                  Debug('yellow', "* * * * * * * * * * * * * * * * * * * * * * * * * * * * *")
                  Debug('white', "Found the following GARDENA "..v.category.. ":")
                  Debug('yellow', "Name: "..v.name)  
                  Debug('yellow', "Identifier: "..v.id)  
                  if (VirtualDevice ~= nil) then
                    Debug("white", "Corresponding Fibaro virtual device is " ..makeLink(VirtualDevice))
                  end                  

                  if v.category == "gateway" then  
                  end              

                  --Find GARDENA Mowers
                  if v.category == "mower" then

                    for a, b in pairs(v.abilities) do
                      for c, d in pairs(b.properties) do
                        if (d.name == 'last_time_online') then
                          stamp_last_time_online = string.len(tostring(d.value))                       
                          if (stamp_last_time_online == 17) then  
                            local mower_online = (MakeTimeStamp2(d.value))
                          elseif (stamp_last_time_online == 20) then         
                            local mower_online = (MakeTimeStamp3(d.value))
                            if (debug == 1) then Debug("white", "Last on-line on " ..mower_online) end
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.moweronline.value", mower_online) end end           
                          elseif (d.name == 'level') then
                            local mower_battery_level = (d.value .. " %")
                            if (debug == 1) then Debug("white", "Battery level is " ..mower_battery_level) end
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerbatterylevel.value", mower_battery_level) end         
                          elseif (d.name == 'rechargeable_battery_status') and (d.value == 'ok') then
                            local mower_battery_status = "OK"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerbatterystatus.value", mower_battery_status) end 
                            if (debug == 1) then Debug("white", "Battery health is " ..mower_battery_status) end            
                          elseif (d.name == 'rechargeable_battery_status') and (d.value == 'weak') then
                            local mower_battery_status = "weak"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerbatterystatus.value", mower_battery_status) end
                            if (debug == 1) then Debug("white", "Battery health is " ..mower_battery_status) end
                          elseif (d.name == 'rechargeable_battery_status') and (d.value == 'undefined') then
                            local mower_battery_status = "undefined"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerbatterystatus.value", mower_battery_status) end
                            if (debug == 1) then Debug("white", "Battery health is " ..mower_battery_status) end
                          elseif (d.name == 'charging') and (d.value == false) then
                            local mower_charging = "no"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowercharging.value", mower_charging) end
                            if (debug == 1) then Debug("white", "Charging:  " ..mower_charging) end
                          elseif (d.name == 'charging') and (d.value == true) then
                            local mower_charging = "yes"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowercharging.value", mower_charging) end
                            if (debug == 1) then Debug("white", "Charging: " ..mower_charging) end
                          elseif (d.name == 'quality') then
                            local mower_quality = (d.value .. " %" )
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerquality.value", mower_quality) end
                            if (debug == 1) then Debug("white", "Signal quality is " ..mower_quality) end
                          elseif (d.name == 'connection_status') and (d.value == "unknown") then
                            local mower_connection_status = "unknown"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerconnectionstatus.value", mower_connection_status) end
                            if (debug == 1) then Debug("white", "Connection status is " ..mower_connection_status) end
                          elseif (d.name == 'connection_status') and (d.value == "status_device_unreachable") then
                            local mower_connection_status = "lost"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerconnectionstatus.value", mower_connection_status) end
                            if (debug == 1) then Debug("white", "Connection is " ..mower_connection_status) end
                          elseif (d.name == 'connection_status') and (d.value == "status_device_alive") then
                            local mower_connection_status = "alive"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerconnectionstatus.value", mower_connection_status) end 
                            if (debug == 1) then Debug("white", "Connection is " ..mower_connection_status) end
                          elseif (d.name == 'state') and d.value == "bad" then
                            local mower_state = "bad"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstate.value", mower_state) end
                            if (debug == 1) then Debug("white", "Radio link is " ..mower_state) end
                          elseif (d.name == 'state') and d.value == "poor" then
                            local mower_state = "poor"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstate.value", mower_state) end
                            if (debug == 1) then Debug("white", "Radio link is " ..mower_state) end
                          elseif (d.name == 'state') and d.value == "good" then
                            local mower_state = "good"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstate.value", mower_state) end
                            if (debug == 1) then Debug("white", "Radio link is " ..mower_state) end
                          elseif (d.name == 'state') and d.value == "excellent" then
                            local mower_state = "excellent"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstate.value", mower_state) end
                            if (debug == 1) then Debug("white", "Radio link is " ..mower_state) end
                          elseif (d.name == 'state') and d.value == "undefined" then
                            local mower_state = "Undefined"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstate.value", mower_state) end
                            if (debug == 1) then Debug("white", "Radio link is " ..mower_state) end
                          elseif (d.name == 'temperature') and (d.unit == 'C') then
                            local mower_temperature = (d.value.. " °C")
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowertemperature.value", mower_temperature) end
                            if (debug == 1) then Debug("white", "Ambient termperature is " ..mower_temperature) end
                          elseif (d.name == 'temperature') and (d.unit == 'F') then
                            local mower_temperature = (d.value.. " °F")
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowertemperature.value", mower_temperature) end
                            if (debug == 1) then Debug("white", "Ambient termperature is " ..mower_temperature) end
                          elseif (d.name == 'status') and (d.value == "paused") then
                            local mower_status = "operation paused"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "ok_cutting") then
                            local mower_status = "OK - cutting away the grass!"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "ok_searching") then
                            local mower_status = "OK - searching"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "ok_charging") then
                            local mower_status = "OK - charging"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "ok_leaving") then
                            local mower_status = "OK - leaving"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "wait_updating") then
                            local mower_status = "waiting for update to be completed"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "wait_power_up") then
                            local mower_status = "waiting for power up to complete"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "parked_timer") then
                            local mower_status = "parked - on timer"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "parked_park_selected") then
                            local mower_status = "parked - per selection"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "off_disabled") then
                            local mower_status = "off - disabled"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "off_hatch_open") then
                            local mower_status = "off - hatch open"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "unknown") then
                            local mower_status = "unknown"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "error") then
                            local mower_status = "an error occurred"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "error_at_power_up") then
                            local mower_status = "error at power up"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "off_hatch_closed") then
                            local mower_status = "off - hatch closed"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "ok_cutting_time_overridden") then
                            local mower_status = "OK - cutting time overridden"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "Parked_autotimer") then
                            local mower_status = "parked - per automatic timer"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "parked_daily_limit_reached") then
                            local mower_status = "parked - daily limit reached"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'status') and (d.value == "undefined") then
                            local mower_status = "undefined"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerstatus.value", mower_status) end 
                            if (debug == 1) then Debug("white", "Status is " ..mower_status) end
                          elseif (d.name == 'manual_operation') and (d.value == true) then
                            local mower_manual_operation = "yes"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowermanualoperation.value", mower_manual_operation) end
                            if (debug == 1) then Debug("white", "Manual operation: " ..mower_manual_operation) end
                          elseif (d.name == 'manual_operation') and (d.value == false) then
                            local mower_manual_operation = "no"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowermanualoperation.value", mower_manual_operation) end
                            if (debug == 1) then Debug("white", "Manual operation:  " ..mower_manual_operation) end
                          elseif (d.name == 'error') and (d.value == "no_message") then
                            local mower_error = "all clear"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowererror.value", mower_error) end
                            if (debug == 1) then Debug("white", "Error message: " ..mower_error) end
                          elseif (d.name == 'error') and (d.value ~= "no_message") then
                            local mower_error = d.value
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowererror.value", mower_error) end
                            if (debug == 1) then Debug("white", "Error message: " ..mower_error) end
                          elseif (d.name == 'source_for_next_start') and (d.value == "no_source") then
                            local mower_source_for_next_start = "no source"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowersourcefornextstart.value", mower_source_for_next_start) end 
                            if (debug == 1) then Debug("white", "Source for next start is " ..mower_source_for_next_start) end
                          elseif (d.name == 'source_for_next_start') and (d.value == "completed_cutting daily_limit") then
                            local mower_source_for_next_start = "completed cutting - reached daily limit"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowersourcefornextstart.value", mower_source_for_next_start) end
                            if (debug == 1) then Debug("white", "Source for next start is " ..mower_source_for_next_start) end
                          elseif (d.name == 'source_for_next_start') and (d.value == "countdown_timer") then
                            local mower_source_for_next_start = "will resume when timer countdown is complete"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowersourcefornextstart.value", mower_source_for_next_start) end
                            if (debug == 1) then Debug("white", "Source for next start is " ..mower_source_for_next_start) end
                          elseif (d.name == 'source_for_next_start') and (d.value == "mower-charging") then
                            local mower_source_for_next_start = "will resume when finished charging "
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowersourcefornextstart.value", mower_source_for_next_start) end
                            if (debug == 1) then Debug("white", "Source for next start is " ..mower_source_for_next_start) end
                          elseif (d.name == 'source_for_next_start') and (d.value == "completed_cutting_autotimer") then
                            local mower_source_for_next_start = "completed cutting - according to timer"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowersourcefornextstart.value", mower_source_for_next_start) end
                            if (debug == 1) then Debug("white", "Source for next start is " ..mower_source_for_next_start) end
                          elseif (d.name == 'source_for_next_start') and (d.value == "undefined") then
                            local mower_source_for_next_start = "undefined"
                            if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowersourcefornextstart.value", mower_source_for_next_start) end
                            if (debug == 1) then Debug("white", "Source for next start is " ..mower_source_for_next_start) end
                          elseif (d.name == 'timestamp_next_start') then
                            stamp_timestamp_next_start = string.len(tostring(d.value))                        
                            if (stamp_timestamp_next_start == 17) then  
                              local mower_timestamp_next_start = (MakeTimeStamp2(d.value))
                            elseif (stamp_timestamp_next_start == 20) then         
                              local mower_timestamp_next_start = (MakeTimeStamp3(d.value))   
                              if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowertimestampnextstart.value", mower_timestamp_next_start) end
                              if (debug == 1) then Debug("white", "Next start on " ..mower_timestamp_next_start) end end
                            elseif (d.name == 'override_end_time') then
                              stamp_override_end_time = string.len(tostring(d.value))                       
                              if (stamp_override_end_time == 17) then  
                                local mower_override_end_time = (MakeTimeStamp2(d.value))
                              elseif (stamp_override_end_time == 20) then         
                                local mower_override_end_time = (MakeTimeStamp3(d.value)) 
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.moweroverrideendtime.value", mower_override_end_time) end
                                if (debug == 1) then Debug("white", "Override end time is on " ..mower_override_end_time) end end
                              elseif (d.name == 'firmware_status') and (d.value == "up_to_date") then
                                local mower_firmware_status = "up to date"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.mowerfirmwarestatus.value", mower_firmware_status) end
                                if (debug == 1) then Debug("white", "Firmware is " ..mower_firmware_status) end
                              end
                            end
                          end
                        end

                        --Find GARDENA Sensors            
                        if v.category == "sensor" then
                          if (VirtualDevice ~= nil) then

                          end
                          for a, b in pairs(v.abilities) do
                            for c, d in pairs(b.properties) do
                              if (d.name == 'last_time_online') then
                                check = tostring(d.value)
                                if (check == "") then
                                  print ("nil value")
                                else            
                                  local sensor_online = (MakeTimeStamp3(d.value))
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensoronline.value", sensor_online) end
                                  if (debug == 1) then Debug("white", "Last on-line: " ..sensor_online) end end
                                elseif (d.name == 'level') then
                                  local sensor_battery_level = (d.value .. " %")
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorbatterylevel.value", sensor_battery_level) end
                                  if (debug == 1) then Debug("white", "Battery level is " ..sensor_battery_level) end
                                elseif (d.name == 'disposable_battery_status') and (d.value == 'out_of_operation') then
                                  local sensor_battery_status = "Out of operation"
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorbatterystatus.value", sensor_battery_status) end
                                  if (debug == 1) then Debug("white", "Battery health is " ..sensor_battery_status) end
                                elseif (d.name == 'disposable_battery_status') and (d.value == 'replace_now') then
                                  local sensor_battery_status = "Replace now"
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorbatterystatus.value", sensor_battery_status) end
                                  if (debug == 1) then Debug("white", "Battery health is " ..sensor_battery_status) end
                                elseif (d.name == 'disposable_battery_status') and (d.value == 'low') then
                                  local sensor_battery_status = "Low"
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorbatterystatus.value", sensor_battery_status) end
                                  if (debug == 1) then Debug("white", "Battery health is " ..sensor_battery_status) end
                                elseif (d.name == 'disposable_battery_status') and (d.value == 'ok') then
                                  local sensor_battery_status = "OK"
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorbatterystatus.value", sensor_battery_status) end
                                  if (debug == 1) then Debug("white", "Battery health is " ..sensor_battery_status) end
                                elseif (d.name == 'disposable_battery_status') and (d.value == 'undefined') then
                                  local sensor_battery_status = "Undefined"
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorbatterystatus.value", sensor_battery_status) end
                                  if (debug == 1) then Debug("white", "Battery health is " ..sensor_battery_status) end
                                elseif (d.name == 'quality') then
                                  local sensor_quality = (d.value .. " %" )
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorquality.value", sensor_quality) end
                                  if (debug == 1) then Debug("white", "Signal quality is " ..sensor_quality) end
                                elseif (d.name == 'connection_status') and (d.value == "unknown") then
                                  local sensor_connection_status = "unknown"
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorconnectionstatus.value", sensor_connection_status) end
                                  if (debug == 1) then Debug("white", "Connection status is " ..sensor_connection_status) end
                                elseif (d.name == 'connection_status') and (d.value == "status_device_unreachable") then
                                  local sensor_connection_status = "lost"
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorconnectionstatus.value", sensor_connection_status) end
                                  if (debug == 1) then Debug("white", "Connection status is " ..sensor_connection_status) end
                                elseif (d.name == 'connection_status') and (d.value == "status_device_alive") then
                                  local sensor_connection_status = "alive"
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorconnectionstatus.value", sensor_connection_status) end
                                  if (debug == 1) then Debug("white", "Connection status is " ..sensor_connection_status) end
                                elseif (d.name == 'state') and d.value == "bad" then
                                  local sensor_state = "bad"
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorconnectionstatus.value", sensor_connection_status) end
                                  if (debug == 1) then Debug("white", "Connection status is " ..sensor_state) end
                                elseif (d.name == 'state') and d.value == "poor" then
                                  local sensor_state = "poor"
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorstate.value", sensor_state) end
                                  if (debug == 1) then Debug("white", "Radio link is " ..sensor_state) end
                                elseif (d.name == 'state') and d.value == "good" then
                                  local sensor_state = "good"
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorstate.value", sensor_state) end
                                  if (debug == 1) then Debug("white", "Radio link is " ..sensor_state) end
                                elseif (d.name == 'state') and d.value == "undefined" then
                                  local sensor_state = "undefined"
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorstate.value", sensor_state) end
                                  if (debug == 1) then Debug("white", "Radio link is " ..sensor_state) end
                                elseif (b.type == 'soil_temperature_sensor') and (d.name == 'temperature') and (d.unit == 'C') then
                                  local sensor_soil_temperature = (d.value .. " °C")
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorsoiltemperature.value", sensor_soil_temperature) end
                                  if (debug == 1) then Debug("white", "Soil temperature is " ..sensor_soil_temperature) end
                                elseif (b.type == 'soil_temperature_sensor') and (d.name == 'temperature') and (d.unit == 'F') then
                                  local sensor_soil_temperature = (d.value .. " °F")
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorsoiltemperature.value", sensor_soil_temperature) end
                                  if (debug == 1) then Debug("white", "Soil temperature is " ..sensor_soil_temperature) end
                                elseif (b.type == 'ambient_temperature_sensor') and (d.name == 'temperature') then
                                  local sensor_ambient_temperature = (d.value .. " °C" )
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorambienttemperature.value", sensor_ambient_temperature) end
                                  if (debug == 1) then Debug("white", "Ambient temperature is " .. sensor_ambient_temperature) end
                                elseif (b.type == 'ambient_temperature_sensor') and (d.name == 'temperature') and (d.uni == 'F') then
                                  local sensor_ambient_temperature = (d.value .. " °F" )
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorambienttemperature.value", sensor_ambient_temperature) end
                                  if (debug == 1) then Debug("white", "Ambient temperature is " .. sensor_ambient_temperature) end
                                elseif (d.name == 'frost_warning') and (d.value == "no_frost") then
                                  local sensor_frost_warning = "No frost warning"
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorfrostwarning.value", sensor_frost_warning) end
                                  if (debug == 1) then Debug("white", sensor_frost_warning) end
                                elseif (d.name == 'frost_warning') and (d.value == "frost") then
                                  local sensor_frost_warning = "Frost warning!"
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorfrostwarning.value", sensor_frost_warning) end
                                  if (debug == 1) then Debug("white", sensor_frost_warning) end
                                elseif (d.name == 'frost_warning') and (d.value == "undefined") then
                                  local sensor_frost_warning = "Frost warning status undefined"
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorfrostwarning.value", sensor_frost_warning) end
                                  if (debug == 1) then Debug("white", sensor_frost_warning) end
                                elseif (d.name == 'humidity') then
                                  local sensor_humidity = (d.value .. " %")
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorhumidity.value", sensor_humidity) end
                                  if (debug == 1) then Debug("white", "Soil humidity is " ..sensor_humidity) end
                                elseif (d.name == 'light') then
                                  local sensor_light = (d.value.. " lx")
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorlight.value", sensor_light) end
                                  if (debug == 1) then Debug("white", "Light intensity is " ..sensor_light) end
                                elseif (d.name == 'firmware_status') and (d.value == "up_to_date") then
                                  local sensor_firmware_status = "up to date"
                                  if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.sensorfirmwarestatus.value", sensor_firmware_status) end
                                  if (debug == 1) then Debug("white", "Firmware is " ..sensor_firmware_status) end              
                                end
                              end
                            end
                          end
                        end

                        --Find GARDENA Watering Computers          
                        if v.category == "watering_computer" then

                          for a, b in pairs(v.abilities) do
                            for c, d in pairs(b.properties) do
                              if (d.name == 'last_time_online') then
                                local watering_computer_online = (MakeTimeStamp(d.value))
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputeronline.value", watering_computer_online) end
                                if (debug == 1) then Debug("white", "Last on-line on " ..watering_computer_online) end
                              elseif (d.name == 'level') then
                                local watering_computer_battery_level = (d.value .. " %")
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerbatterylevel.value", watering_computer_battery_level) end
                                if (debug == 1) then Debug("white", "Battery level is " ..watering_computer_battery_level) end
                              elseif (d.name == 'disposable_battery_status') and (d.value == 'out_of_operation') then
                                local watering_computer_battery_status = "Out of operation"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerbatterystatus.value", watering_computer_battery_status) end
                                if (debug == 1) then Debug("white", "Battery health is " ..watering_computer_battery_status) end
                              elseif (d.name == 'disposable_battery_status') and (d.value == 'replace_now') then
                                local watering_computer_battery_status = "Replace batteries now"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerbatterystatus.value", watering_computer_battery_status) end
                                if (debug == 1) then Debug("white", "Battery health is " ..watering_computer_battery_status) end
                              elseif (d.name == 'disposable_battery_status') and (d.value == 'low') then
                                local watering_computer_battery_status = "Batteries are low"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerbatterystatus.value", watering_computer_battery_status) end
                                if (debug == 1) then Debug("white", watering_computer_battery_status) end
                              elseif (d.name == 'disposable_battery_status') and (d.value == 'ok') then
                                local watering_computer_battery_status = "OK"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerbatterystatus.value", watering_computer_battery_status) end
                                if (debug == 1) then Debug("white", "Battery health is " ..watering_computer_battery_status) end
                              elseif (d.name == 'disposable_battery_status') and (d.value == 'undefined') then
                                local watering_computer_battery_status = "Undefined"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerbatterystatus.value", watering_computer_battery_status) end
                                if (debug == 1) then Debug("white", "Battery health is " ..watering_computer_battery_status) end
                              elseif (d.name == 'quality') then
                                local watering_computer_quality = (d.value .. "%" )
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerquality.value", watering_computer_quality) end
                                if (debug == 1) then Debug("white", "Signal quality is " ..watering_computer_quality) end
                              elseif (d.name == 'connection_status') and (d.value == "unknown") then
                                local watering_computer_connection_status = "unknown"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerconnectionstatus.value", watering_computer_connection_status) end
                                if (debug == 1) then Debug("white", "Connection status is " ..watering_computer_connection_status) end
                              elseif (d.name == 'connection_status') and (d.value == "status_device_unreachable") then
                                local watering_computer_connection_status = "lost"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerconnectionstatus.value", watering_computer_connection_status) end
                                if (debug == 1) then Debug("white", "Connection status is " ..watering_computer_connection_status) end
                              elseif (d.name == 'connection_status') and (d.value == "status_device_alive") then
                                local watering_computer_connection_status = "alive"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerconnectionstatus.value", watering_computer_connection_status) end
                                if (debug == 1) then Debug("white", "Connection status is " ..watering_computer_connection_status) end
                              elseif (d.name == 'state') and d.value == "bad" then
                                local watering_computer_state = "bad"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerstate.value", watering_computer_state) end
                                if (debug == 1) then Debug("white", "Radio link is " ..watering_computer_state) end
                              elseif (d.name == 'state') and d.value == "poor" then
                                local watering_computer_state = "poor"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerstate.value", watering_computer_state) end
                                if (debug == 1) then Debug("white", "Radio link is " ..watering_computer_state) end
                              elseif (d.name == 'state') and d.value == "good" then
                                local watering_computer_state = "good"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerstate.value", watering_computer_state) end
                                if (debug == 1) then Debug("white", "Radio link is " ..watering_computer_state) end
                              elseif (d.name == 'state') and d.value == "undefined" then
                                local watering_computer_state = "undefined"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerstate.value", watering_computer_state) end
                                if (debug == 1) then Debug("white", "Radio link is " ..watering_computer_state) end
                              elseif (d.name == 'valve_open') and (d.value == false) then
                                local watering_computer_valve_open = "closed"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputervalveopen.value", watering_computer_valve_open) end
                                if (debug == 1) then Debug("white", "Water valve is " ..watering_computer_valve_open) end
                              elseif (d.name == 'valve_open') and (d.value == true) then
                                local watering_computer_valve_open = "open"
                                if (debug == 1) then Debug("white", "Watervalve is " ..watering_computer_valve_open) end
                              elseif (d.name == 'manual_override') and d.value == "inactive" then
                                local watering_computer_manual_override = "inactive"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputermanualoverride.value", watering_computer_manual_override) end
                                if (debug == 1) then Debug("white", "Manual override is " ..watering_computer_manual_override) end
                              elseif (d.name == 'manual_override') and d.value == "open" then
                                local watering_computer_manual_override = "open"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputermanualoverride.value", watering_computer_manual_override) end
                                if (debug == 1) then Debug("white", "Manual override is " ..watering_computer_manual_override) end
                              elseif (d.name == 'manual_override') and d.value == "undefined" then
                                local watering_computer_manual_override = "undefined"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputermanualoverride.value", watering_computer_manual_override) end
                                if (debug == 1) then Debug("white", "Manual override is " ..watering_computer_manual_override) end
                              elseif (d.name == 'button_manual_override_time') then
                                local watering_computer_button_manual_override_time = d.value.. " minutes"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerbuttonmanualoverridetime.value", watering_computer_button_manual_override_time) end
                                if (debug == 1) then Debug("white", "Manual override time is " ..watering_computer_button_manual_override_time) end
                              elseif (d.name == 'last_manual_override_time') then
                                local watering_computer_last_manual_override_time = d.value.. " minutes"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerlastmanualoverridetime.value", watering_computer_last_manual_override_time) end
                                if (debug == 1) then Debug("white", "Last manual override lasted " ..watering_computer_last_manual_override_time) end
                              elseif (d.name == 'temperature') and (d.unit == 'C') then
                                local watering_computer_temperature = d.value.. " °C"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputertemperature.value", watering_computer_temperature) end
                                if (debug == 1) then Debug("white", "Ambient temperature is " .. watering_computer_temperature) end
                              elseif (d.name == 'temperature') and (d.unit == 'F') then
                                local watering_computer_temperature = d.value.. " °F"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputertemperature.value", watering_computer_temperature) end
                                if (debug == 1) then Debug("white", "Ambient temperature is " .. watering_computer_temperature) end
                              elseif (d.name == 'frost_warning') and (d.value == "no_frost") then
                                local watering_computer_frost_warning = "no frost warning"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerfrostwarning.value", watering_computer_frost_warning) end
                                if (debug == 1) then Debug("white", watering_computer_frost_warning) end
                              elseif (d.name == 'frost_warning') and (d.value == "frost") then
                                local watering_computer_frost_warning = "frost warning!"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerfrostwarning.value", watering_computer_frost_warning) end
                                if (debug == 1) then Debug("white", watering_computer_frost_warning) end
                              elseif (d.name == 'frost_warning') and (d.value == "undefined") then
                                local watering_computer_frost_warning = "frost warning status undefined"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerfrostwarning.value", watering_computer_frost_warning) end
                                if (debug == 1) then Debug("white", watering_computer_frost_warning) end
                              elseif (d.name == 'adaptive_scheduling_last_decision') and (d.value == "undefined") then
                                local watering_computer_adaptive_scheduling_last_decision = "undefined"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputeradpativeschedulinglastdecision.value", watering_computer_adaptive_scheduling_last_decision) end
                                if (debug == 1) then Debug("white", "Adaptive scheduling last decision is " ..watering_computer_adaptive_scheduling_last_decision) end
                              elseif (d.name == 'adaptive_scheduling_last_decision') and (d.value == "watered_sensor_timeout") then
                                local watering_computer_adaptive_scheduling_last_decision = "timed out by soil moisture sensor"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputeradpativeschedulinglastdecision.value", watering_computer_adaptive_scheduling_last_decision) end
                                if (debug == 1) then Debug("white", "Adaptive scheduling last decision " ..watering_computer_adaptive_scheduling_last_decision) end
                              elseif (d.name == 'adaptive_scheduling_last_decision') and (d.value == "skipped") then
                                local watering_computer_adaptive_scheduling_last_decision = "skipped by adaptive scheduling"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputeradpativeschedulinglastdecision.value", watering_computer_adaptive_scheduling_last_decision) end
                                if (debug == 1) then Debug("white", "Adaptive scheduling last decision " ..watering_computer_adaptive_scheduling_last_decision) end
                              elseif (d.name == 'adaptive_scheduling_last_decision') and (d.value == "watered") then
                                local watering_computer_adaptive_scheduling_last_decision = "to water"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputeradpativeschedulinglastdecision.value", watering_computer_adaptive_scheduling_last_decision) end
                                if (debug == 1) then Debug("white", "Adaptive scheduling last decision is " ..watering_computer_adaptive_scheduling_last_decision) end
                              elseif (d.name == 'scheduled_watering_end') then
                                local watering_computer_scheduled_watering_end = MakeTimeStamp3(d.timestamp)
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerscheduledwateringend.value", watering_computer_scheduled_watering_end) end
                                if (debug == 1) then Debug("white", "Watering is scheduled to end on " ..watering_computer_scheduled_watering_end) end
                              elseif (d.name == 'scheduled_watering_next_start') then
                                local watering_computer_scheduled_watering_next_start = MakeTimeStamp3(d.timestamp)
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerscheduledwateringnextstart.value", watering_computer_scheduled_watering_next_start) end
                                if (debug == 1) then Debug("white", "Watering is scheduled to start on " ..watering_computer_scheduled_watering_next_start) end
                              elseif (d.name == 'firmware_status') and (d.value == "up_to_date") then
                                local watering_computer_firmware_status = "up to date"
                                if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerfirmwarestatus.value", watering_computer_firmware_status) end
                                if (debug == 1) then Debug("white", "Firmware is " ..watering_computer_firmware_status) end            
                              end
                            end
                          end
                        end
                      end
                    end
                  end,
                })
            end
            if ( sourceTrigger["type"] == "autostart" or "manual") then
              gAuth()
            end  

  14. Il y a 9 heures, pepite a dit :
    
    ------------------------------------------------------
    -- Customize the following data (GARDENA smartsystem)
    ------------------------------------------------------
    local username = 'name@domain.com'
    local password = 'yourpassword'

    Ensuite vérifie si ces variables globales sont créées :

     

    
         addGlobal('gardena_parameters', "")
          addGlobal('gardena_command', "")
          addGlobal('gardena_userid', "")
          addGlobal('gardena_token', "")
          addGlobal('gardena_location', "")

    '

    pepite,

    excuse moi pour ma naïveté mais ou as-tu trouvé cela? quel script? et comment? 

  15. Il y a 3 heures, pepite a dit :

    Salut salut,

     

    Pas de panique ;-)

    Je viens d'aller lire, tu dois avoir un script dans le fichier ZIP que tu as téléchargé.

    Lance le et dans la fenetre de DEBUG tu vas récupérer l' ID UNIQUE que tu dois noter en fonction du device :

     

    Ensuite

     

    
    Note the device type and unique identifier. You will need this to

    Puis création du VD correspondant :

     

    
    Create a corresponding virtual device in Fibaro HC2, by importing the relevant virtual device template, which you can download below.

    Puis tu rentres dans le champ adresse IP l'ID unique que tu as noté en fonction des devices que t'as remonté le script

     

    
    Enter the unique identifier  found in the Debug window of the status script  in the IP address field of the virtual device.

    Un petit save du VD puis relance du script à priori

     

    
    Save the virtual device. Restart the status script if the status information does not update within one minute.

     

    Salut pepite et merci

    voci le dossier téléchargé:

     

    5ab020adecc57_Capturedcran2018-03-1921_41_21.png.f77c0a0e7965c15f2fff203cc1130f5c.png 

    lequel est le script et comment le "débuger"

    merci

×
×
  • Créer...