Globale Tabelle LAN2.5

Moin Moin,
ich verwende das VD Lan2.5 um den Online-Status von einigen Geräten abzufragen. Die Werte werden in eine Globale Tabelle gespeichert. Wie kann ich die Werte einzeln auslesen um sie in einer anderen Szene zu verwenden?

-- Local variable declaration
thisId            = fibaro:getSelfId();

-- ** USER CONFIGUATION - NOTIFICATION & UPDATE OPTIONS **
local HC2email    = "true"     -- Notification Alerts using Fibaro email service
local HC2popUp    = "true"      -- Notification Alerts using Fibaro popup service notifications
local pushOver    = "false"      -- Notification Alerts using Pushover Notification Service (Tutorial by AutoFrank)
local ALLINONE    = "false"     -- Notification Alerts using 'All in one Notification' scene (created by jompa68)
local updateFreq  = "1000"      -- Set the frequency (milliseconds) that you want to vd to poll the LAN per device
local vdCheck     = "false"     -- Set  to true to check quantity and format of vd labels is correct
local updateData  = "false"      -- Set to true to update the data in the table. ** SET BACK TO FALSE ONCE COMPLETE **
--local updateData  = "true"

-- ** USER CONFIGUATION - NETWORK TABLE DEVICES **
function popTable()
  jsonNetwork = {
    {device = "Internet",     ip="142.250.186.67", port="80",    online = "1", alert = "0", alertTrack = "0"},
    {device = "Samsung TV",   ip="192.18.18.144",  port="8080",    online = "1", alert = "0", alertTrack = "0"},
    {device = "Reciver",  ip="192.18.18.37",  port="8080",    online = "1", alert = "0", alertTrack = "0"},

  }
  
  local jNetTable = json.encode(jsonNetwork)
  fibaro:setGlobal("NetworkTable", jNetTable)
  local jN = json.decode(fibaro:getGlobalValue("NetworkTable"))
  if jN[1].device == "" then
    fibaro:debug("Network table did NOT get created successfully. Please debug")
  else
    fibaro:debug("Network table successfully updated")
  end
  fibaro:debug("The following devices have been setup for alerts:")
  for i = 1, #jN do
    if jN[i].alert == "1" then
      fibaro:debug(jN[i].device)
    end
  end
end

function updateTable()
  if fibaro:getGlobalValue("NetworkTable") == nil then
    local HC2 = Net.FHttp("127.0.0.1",11111);
    local response ,status, err = HC2:POST('/api/globalVariables','{"name":"NetworkTable","value":""}');
      --setTimeout(popTable, 3000)
    if (tonumber(status) == 200 and tonumber(err)==0) then
      fibaro:log("Global variable NetworkTable created");
    end
  else
    --popTable()
  end
  popTable()
end

-- Code to check if the quantity and format of the virtual device labels matches whats in the global table
function labelCheck()
    
    fibaro:log("vdCheck mode enabled")
    local device, localhost, port = fibaro:getSelfId(), '127.0.0.1', 11111; 
    diag = Net.FHttp(localhost, port);
    response = diag:GET("/api/virtualDevices")
    jT = json.decode(response);

    for i = 1, #jT do
      if jT[i].name == "LAN Monitor 2.0" then
        if #jT[i].properties.rows == #jN then labelCount = "true" else labelCount = "false" end
        for r = 1, #jT[i].properties.rows do 
          for e = 1, #jT[i].properties.rows[r].elements do 
            if (string.match(jT[i].properties.rows[r].elements[e].name, "Label")) == "Label"
              then
                labelMatch = labelMatch else labelMatch = "false"
            end  
          end 
        end     
      end
    end
    if  labelCount == "true" and labelMatch ~= "false" then
        fibaro:debug("Quantity and format of labels is correct") else
          if labelCount == "false" then fibaro:debug("Quantity of labels incorrect")  fibaro:log("Quantity of labels incorrect") end
          fibaro:sleep(3000)
          if labelMatch == "false" then fibaro:debug("Label format is incorrect")     fibaro:log("Label format is incorrect") end
    end
end

-- MAIN CODE

if vdCheck == "true" then labelCheck() end

if updateData == "true" then
  updateTable()
else
  local jN = json.decode(fibaro:getGlobalValue("NetworkTable"))
  if jN[1].device == "" then 
    fibaro:debug("Network Table not populated") 
  else
    for i = 1, #jN do
      fibaro:debug(jN[i].device)
      tcpSocket         = Net.FTcpSocket(jN[i].ip, jN[i].port)
      bytes, errorCode  = tcpSocket:write("test")
      tcpSocket:disconnect()
      
      if errorCode == 0 then
        jN[i].online = 1
        if vdCheck == "false" then fibaro:log(""..jN[i].device.." is online") end
        fibaro:call(thisId, "setProperty", "ui.Label"..i..".value","Online")
        if jN[i].alert == "1" and jN[i].alertTrack == "1" then
          fibaro:debug("Notify Alert! "..jN[i].device.." is back online")
          if pushOver == "true" then
            local dvc, prio   = "Dad_Phone,Kitchen_iPad", "0"
            local ttl, msg    = "Home LAN Alert!", "Alert! "..jN[i].device.." is back online"
            local requestBody = '&device='..dvc ..'&priority=' ..prio ..'&title=' ..ttl ..'&message=' ..msg 
            fibaro:setGlobal("pushoverBody", requestBody)
          end
          if ALLINONE == "true" then fibaro:setGlobal("TelegramMessage", "Home LAN Alert! "..jN[i].device.." is back online") end
          if HC2email == "true" then fibaro:call(2, "sendEmail","Home LAN Alert!", ""..jN[i].device.." is back online") end
          if HC2popUp == "true" then HomeCenter.PopupService.publish({ title = 'Home LAN Alert! ',
            subtitle = os.date("%I:%M:%S %p | %B %d, %Y"), 
            contentTitle = jN[i].device,
            contentBody = 'is back online', type = 'Success',}) end
          jN[i].alertTrack = "0"
        end
      else
        jN[i].online = 0
        if vdCheck == "false" then fibaro:log(""..jN[i].device.." is OFFLINE") end
        fibaro:call(thisId, "setProperty", "ui.Label"..i..".value","*OFFLINE*")
        if jN[i].alert == "1" and jN[i].alertTrack == "0" then
          fibaro:debug("Notify Alert! "..jN[i].device.." is offline")
          if pushOver == "true" then
            local dvc, prio   = "Dad_Phone,Kitchen_iPad", "0"
            local ttl, msg    = "Home LAN Alert!", "Alert! "..jN[i].device.." is OFFLINE"
            local requestBody = '&device='..dvc ..'&priority=' ..prio ..'&title=' ..ttl ..'&message=' ..msg 
            fibaro:setGlobal("pushoverBody", requestBody) end
          if ALLINONE == "true" then fibaro:setGlobal("TelegramMessage", "Home LAN Alert! "..jN[i].device.." is offline") end
          if HC2email == "true" then fibaro:call(2, "sendEmail","Home LAN Alert!", ""..jN[i].device.." is offline") end
          if HC2popUp == "true" then HomeCenter.PopupService.publish({ title = 'Home LAN Alert! ',
            subtitle = os.date("%I:%M:%S %p | %B %d, %Y"), 
            contentTitle = jN[i].device,
            contentBody = 'has gone offline', type = 'Success',}) end
          jN[i].alertTrack = "1"
        end      
      end
      jNetTable = json.encode(jN)
      fibaro:setGlobal("NetworkTable", jNetTable)
      fibaro:sleep(updateFreq)
    end
  end
end