Hallo in die Runde,
ich habe das Forum durchforstet und zu meinem Thema keine wirkliche Lösung gefunden.
Nun wurde sich ja auch mit den Mesh Routen beschäftigt und da hat yeep einen Beitrag eingestellt zum auslesen der IDs im System.
Ich hatte vor geraumer Zeit ein Script gefunden, in dem wurde angezeigt welches Gerät in welcher Scene verwendet wird. Leider läuft es nicht mehr und es kommen nur noch API Fehler. Da ich leider nicht in der Lage bin es anzupassen, wollte ich hier fragen ob es jemand von Euch eventuell kann.
--[[
%% properties
%% globals
--]]
function getUserData(dID)
local mStr = ""
uIds = api.get("/users")
for i in ipairs(uIds) do
if (uIds[i].id == dID) then
mStr = mStr .. uIds[i].email
if ( uIds[i].hasGPS == true) then mStr = mStr .. " : hasGPS=" .. json.encode(uIds[i].tracking) end
if (json.encode(uIds[i].deviceRights) ~= "[]") then mStr = mStr .. " : deviceRights=<small>" .. json.encode(uIds[i].deviceRights) .. "</small>" end
if (json.encode(uIds[i].sceneRights) ~= "[]" ) then mStr = mStr .. " : sceneRights=<small>" .. json.encode(uIds[i].sceneRights) .. "</small>" end
break
end
end
return mStr
end
function getSceneData(dID,lType)
local mStr, parentId, fontColor = "",0,"<font color=yellowgreen>"
local header = api.get("/scenes?id=" .. dID)["name"]
if (lType ~= nil) then
if ( api.get("/scenes?id=" .. dID)["roomID"] == 0) then header = "Unassigned:" .. api.get("/scenes?id=" .. dID)["name"]
else header = fibaro:getRoomName(api.get("/scenes?id=" .. dID)["roomID"]) .. ":" .. api.get("/scenes?id=" .. dID)["name"] end
end
mStr= mStr .. "<font color=lightblue>" .. dID .. ": </font>" .. fontColor .. header .. "</font><small><font color=grey> [ " .. string.gsub(api.get("/scenes?id=" .. dID)["type"] ,"com.fibaro.","")
mStr = mStr .. " : Max Instances=" .. api.get("/scenes?id=" .. dID)["maxRunningInstances"]
if (api.get("/scenes?id=" .. dID)["visible"] == false) then mStr = mStr .. " : Hidden" end
if (api.get("/scenes?id=" .. dID)["alexaProhibited"] == false) then mStr = mStr .. " : Alexa enable" end
if (api.get("/scenes?id=" .. dID)["autostart"] == true) then mStr = mStr .. " : Autostart" end
mStr = mStr .. " : " .. api.get("/scenes?id=" .. dID)["runConfig"] .. " ]</font></small><br>"
return mStr
end
function getDeviceData(dID,lType)
local mStr, parentId, fontColor, bLvl = "",0,"<font color=yellowgreen>",0
local header = fibaro:getName(dID)
if (fibaro:getType(dID) == "HC_user") then
if (lType ~= nil) then
mStr = mStr .. "<font color=lightblue>" .. dID .. ": </font><font color=yellowgreen>HC_User:" .. header .. "</font><small><font color=grey> [ " .. getUserData(dID).. " ]</font></small><br>"
else
mStr = mStr .. "<font color=lightblue>" .. dID .. ": </font><font color=yellowgreen>" .. header .. "</font><small><font color=grey> [ " .. getUserData(dID).. " ]</font></small><br>"
end
return mStr
end
if (lType ~= nil) then
if ( fibaro:getRoomID(dID) == 0) then header = "Unassigned:" .. fibaro:getName(dID)
else header = fibaro:getRoomName(fibaro:getRoomID(dID)) .. ":" .. fibaro:getName(dID) end
end
if (fibaro:getType(dID) == "com.fibaro.zwaveDevice"
or api.get("/devices?id=" .. dID)["visible"] == false) then fontColor = "<font color=darkgrey>" end
mStr= mStr .. "<font color=lightblue>" .. dID .. ": </font>" .. fontColor .. header .. "</font><small><font color=grey> [ " .. string.gsub(fibaro:getType(dID) ,"com.fibaro.","")
if (api.get("/devices?id=" .. dID)["parentId"] ~= nil) then parentId = api.get("/devices?id=" .. dID)["parentId"] end
if (parentId == 1) then mStr = mStr .. " : Master" elseif (parentId>1) then mStr =mStr .. " : ParentID=" .. parentId end
if (tonumber(fibaro:getValue(dID, "batteryLevel")) ~= nil
and fibaro:getType(dID) ~= "com.fibaro.zwaveDevice") then
bLvl = api.get("/devices?id=" .. dID)["properties"]["batteryLevel"]
if not (bLvl) then bLvl=100 end
if (tonumber(fibaro:getValue(dID, "batteryLevel")) < bLvl) then bLvl = tonumber(fibaro:getValue(dID, "batteryLevel")) end
mStr = mStr .. " : Battery=" ..bLvl .. "%"
end
if (api.get("/devices?id=" .. dID)["properties"]["Push"] == true) then mStr = mStr .. " : Push" end
if (api.get("/devices?id=" .. dID)["properties"]["DeviceUID"] ~= nil) then mStr = mStr .. " : UID=<small>" .. api.get("/devices?id=" .. dID)["properties"]["DeviceUID"] .. "</small>" end
if (api.get("/devices?id=" .. dID)["visible"] == false) then mStr = mStr .. " : Hidden" end
if (api.get("/devices?id=" .. dID)["enabled"] == false) then mStr = mStr .. " : Disabled" end
if (fibaro:getValue(dID,"value") ~=nil) then mStr = mStr .. " ] [ value=" .. fibaro:getValue(dID,"value") .. " ]</font></small><br>"
else mStr = mStr .. " ]</font></small><br>" end
return mStr
end
local dList = "<br>"
local plainList = false
fibaro:debug("Gathering system information.....")
fibaro:debug(os.date('%c'));
if not plainList then
rIds = api.get("/rooms")
for i in ipairs(rIds) do
dList = dList .. "<font color=wheat>--~~== " .. string.upper(rIds[i].name) .. " room ==~~--</font><br>"
dIds = fibaro:getDevicesId({roomID = rIds[i].id})
for j,dID in ipairs(dIds) do
dList= dList .. getDeviceData(dID)
end
dIds = api.get("/scenes")
for j in ipairs(dIds) do
if (api.get("/scenes?id=" .. dIds[j].id)["roomID"] == rIds[i].id) then
dList= dList .. getSceneData(dIds[j].id)
end
end
end
dList = dList .. "<font color=wheat>--~~== Unassigned room ==~~--</font><br>"
dIds = fibaro:getDevicesId({roomID = 0,interfaces ={"zwave"}})
for j,dID in ipairs(dIds) do
dList= dList .. getDeviceData(dID)
end
dIds = api.get("/scenes")
for j in ipairs(dIds) do
if (api.get("/scenes?id=" .. dIds[j].id)["roomID"] == 0) then
dList= dList .. getSceneData(dIds[j].id)
end
end
dList = dList .. "<font color=wheat>--~~== System Users ==~~--</font><br>"
dIds = fibaro:getDevicesId({roomID = 0,type="HC_user"})
for j,dID in ipairs(dIds) do
dList= dList .. getDeviceData(dID)
end
dList = dList .. "<font color=wheat>--~~== Mobile devices list ==~~--</font><br>"
dIds = fibaro:getDevicesId({roomID = 0,type="iOS_device"})
for j,dID in ipairs(dIds) do
dList= dList .. getDeviceData(dID)
end
fibaro:debug(dList .. "<span style=text-align:center>")
else
ids = fibaro:getDevicesId({})
dList = dList .. "<font color=wheat>--~~== Devices list ==~~--</font><br>"
for i,dID in ipairs(ids) do
dList= dList .. getDeviceData(dID,1)
end
dList = dList .. "<font color=wheat>--~~== Scenes list ==~~--</font><br>"
dIds = api.get("/scenes")
for j in ipairs(dIds) do
dList= dList .. getSceneData(dIds[j].id,1)
end
fibaro:debug(dList .. "<span style=text-align:center>")
end
Vielleicht findet sich jemand, der soviel Ahnung und Zeit hat.
Ich Danke Euch schonmal und wünsche allen eine schöne Zeit.
Gruß secundani