Aller au contenu
Delacoste

Intégration possible de Gardena Smart System dans HC2?

Recommended Posts

ok tout compris ;-) merci @Did

 

Je suis très en avance, mais qu'as tu pour tes arroseurs ?

Partager ce message


Lien à poster
Partager sur d’autres sites

 Je n'ai pas mis d'arroseurs mais des tuyères RainBird 1804 SAM-PRS (c'est pour des surfaces moins grandes et donc qui consomment moins, après tu gères la durée pour compenser). Tu ajoutes ensuite les buses Uni Spray SÉRIE 8 à 18 VAN selon les diamètres que tu veux arroser, c'est assez souple mais il faut respecter la somme des charges des buses et aussi celles des longueurs de tuyaux et coudes ou tés en souterrain.

 

 

  • Like 1

Partager ce message


Lien à poster
Partager sur d’autres sites
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? 

Partager ce message


Lien à poster
Partager sur d’autres sites

ca progresse ;-)

Regarde dans le panneau de variables si tu as la variable "gardena_userid", sinon crée la manuellement pour voir.

Partager ce message


Lien à poster
Partager sur d’autres sites

Et lis ceci suite a ton erreur qu'a eu un autre utiisateur.

 

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

 

Laréponse du créateur du VD


 

Citation

 

@Daniel. The function gAuth takes your specified Gardena username and password to login to the Gardena portal. The debug log shows that the authentication request is successful. It then proceeds to retrieve a token and user_id from the Gardena site. Once retrieved it will create global variables gardena_token and gardena_userid (if they don't exist already). Thereafter it will write the retrieved roken and user_id to these global variables. The next functions in the script rely on the information contained in the global variables to execute (or they will fail with a LUA error). The first time that the status script is run, the global variable information may not yet be available to the functions that need it. What would resolve this, is stopping and starting the script a number of time. You can also check if the global variables gardena_token and gardena_userid do indeed exist and have information contained within them.


 

 

Partager ce message


Lien à poster
Partager sur d’autres sites
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  

Partager ce message


Lien à poster
Partager sur d’autres sites

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

Envoyé de mon Nexus 5X en utilisant Tapatalk

Partager ce message


Lien à poster
Partager sur d’autres sites
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?

Partager ce message


Lien à poster
Partager sur d’autres sites

Salut,

 

Tu vas dans le panneau de variables et tu regardes si les variables citées ci-dessus sont créées ? Si ce n'est pas le cas tu les créees.

 

Inutile de rechanger tes identifiants s'ils sont bons

 

Partager ce message


Lien à poster
Partager sur d’autres sites

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

Partager ce message


Lien à poster
Partager sur d’autres sites

J'ai dû inscrire, comme tu me l'as demandé, les variables: gardena_token et gardena_userid

 

c'est variables on été complétées par:

 

5ab2c44aaf4a0_Capturedcran2018-03-2121_39_40.thumb.png.638b09f3cea7e93d25d469a65cb4ac6a.png

Partager ce message


Lien à poster
Partager sur d’autres sites
Il y a 19 heures, pepite a dit :

Salut,

 

Tu vas dans le panneau de variables et tu regardes si les variables citées ci-dessus sont créées ? Si ce n'est pas le cas tu les créees.

 

Inutile de rechanger tes identifiants s'ils sont bons

Alors pepite, as-tu une idée??

Partager ce message


Lien à poster
Partager sur d’autres sites

Bonjour Une idée ? ben je n'ai pas de Gardena ;-) lol

 

Tu as une erreur lua, ligne 99 de ta scene 10 qui doit etre ta scène status.

 

A priori ca viendrait de la fonction MakeTimeStamp(datestring) lorsqu'il veut récuperer le last On line : la variable day n'a pas l'air d'exister.


 

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

 --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

 

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"

 

Sinon, essaie aussi d'envoyer un message sur le MarketPlace au créateur ;-)

 

Partager ce message


Lien à poster
Partager sur d’autres sites
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.

 

 

Partager ce message


Lien à poster
Partager sur d’autres sites

@Delacoste

J'ai regardé d'un peu plus près avec l'aide de mon "tuteur" LUA @Steven

 

Je pense que cela vient du format de date quand je regarde ta ligne "Dernière Transmission". Peux tu tester ceci. Après

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

Colle ceci

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

Dans  

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

Remplace

 local watering_computer_online = (MakeTimeStamp(d.value))

par

local watering_computer_online = (MakeTimeStamp1(d.value))

 

Partager ce message


Lien à poster
Partager sur d’autres sites

Merci pepite,

 

j'essaye ce soi et te redis. Mais un grand merci de t'être penché dessus.

Partager ce message


Lien à poster
Partager sur d’autres sites

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

Partager ce message


Lien à poster
Partager sur d’autres sites

ce que je comprends pas c'est que la sonde "passe" est il a le même format de données

IMG_0088.thumb.jpg.01e2b98aa42dc8a369b26c6aa6a7500f.jpg

Partager ce message


Lien à poster
Partager sur d’autres sites

bizarre bizarre, t'as bien changé ou il fallait ?

 

oui je suis d'accord avec toi pour la sonde.

Partager ce message


Lien à poster
Partager sur d’autres sites

--[[
%% 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

Modifié par Delacoste

Partager ce message


Lien à poster
Partager sur d’autres sites

Bonjour,

 

Pour le Gardena Sensor il n'utilise pas la même fonction pour formater la date.

 

Pour tester s'il récupère bien tout, on va "squeezer" le last-on-line".

Fais ceci au niveau " Find Gardena Watering Computers" :

 

--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
if (debug == 1) then Debug("white", "Squeeze du Last-On-line") end

 

 

Partager ce message


Lien à poster
Partager sur d’autres sites

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!!

 

Partager ce message


Lien à poster
Partager sur d’autres sites

Super.

 

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

 

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

 

Il est normal que tu n'es rien renseigné, la scène status s'occupe de tout, et a l'air de creer une variable par device trouvé maispour moi tu dois quand même mettre l'ip dans le VD.Tu dois avoir donc d'autres variables, regarde dans ton panneau de variables.

 - il regarde dans les propriétés des VDs l'IP, le compare à "identifier" de tes matériels gardena puis crée une variable globale à partir du nom. N'as tu aps une variable "voiture" ?


 

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

Ce qui a l'air de confirmer ce que tu penses, 1 VD par matériel, ce qui parait coherent ;-)

 

Ceci :
 

local VirtualDevice = fibaro:getGlobalValue(vName)

    if (VirtualDevice ~= nil) then fibaro:call(VirtualDevice, "setProperty", "ui.wateringcomputerbatterylevel.value", watering_computer_battery_level) end

Montre que les infos ne remontent pas si la variable globale n'existe pas. Variable dans laquelle il stocke l'id du VD.
 

local vValue = tostring(v.id)

fibaro:setGlobal(vName, vValue)

Ensuite clique sur les boutons de commande pour voir ce qu'il se passe.

Il met dans son mode opératoire que si rien ne remonte, il faut relancer la scene status. As tu essayé ?

Partager ce message


Lien à poster
Partager sur d’autres sites

×