Eines meiner ältesten Scripte für das HC2 hab ich jetzt an das HC3 angepasst. Das braucht man nicht oft , aber der Mensch ist ja bekanntermaßen neugierig.
--[[
--]]
-- file: HC3-Device-inventory.lua
-- version: 0.1.1 HC-3
-- Works with version up to ...
-- purpose:This script shows the device inventory and prints the output to
-- the debug window.
-- Copyleft 08-2017 - 2021 {jwi}
--
local version = "0.1.1"
local fc_lg = '<font color="lightgreen">'
local fc_o = '<font color="orange">'
local fc_c = '<font color="cyan">'
local fc_g = '<font color=green">'
local fc_lb = '<font color="lightblue">'
local adminmail = false -- | Wenn true wird eine Mail an den admin Benutzer geschickt
local bdevices = fibaro.getDevicesID({interfaces ={"battery"},parentId = 1, enabled = true, isPlugin = false })
local quickapps = fibaro.getDevicesID({interfaces ={"quickApp"},parentId = 0, enabled = true })
function checkDevices()
local bdev, users, iosdev, nbdev, cam = 0,0,0,0,0;
print(os.date('%c')..', Device inventory - Version: '.. version );
print(fc_c.. 'Gathering device data...')
local bdev = #bdevices
local alldev = 0
local dev = api.get('/devices')
for _,p in pairs(dev) do
if p.parentId == 1 then
alldev = alldev +1
end
end
nbdev = alldev - bdev
-- Count other devices
devices = fibaro.getDevicesID({visible = true, enabled = true, isPlugin = false })
for id = 1, #devices do
local dtype = fibaro.getType(devices[id])
if (dtype == 'iOS_device') then
iosdev = iosdev+1;
elseif (dtype == "com.fibaro.ipCamera") then
cam = cam +1;
end
end --for
plugins = fibaro.getDevicesID({ enabled = true, visible = true, isPlugin = true })
--vdevices = fibaro.getDevicesID({ enabled = true, visible = true, type="virtual_device" })
scenes = api.get("/scenes")
gvars = api.get("/globalVariables")
rooms = api.get("/rooms")
sections = api.get("/sections")
users = api.get("/users")
separator = '------------------------------------------------'
print(fc_g..'Here is your HC3 device list:')
print(fc_lg .. separator)
print(fc_lg.. alldev .. ' Total physical Z-Wave devices.')
print(fc_o.. nbdev ..' Non batterie devices.')
print(fc_o.. bdev ..' Batterie devices.')
print(fc_o.. #users ..' HC3 Users.')
print(fc_o.. iosdev ..' iOS/Android devices.')
print(fc_o.. cam ..' ip Cameras.')
print(fc_o.. #plugins .. ' Plugins in use.')
print(fc_o.. #quickapps .. ' QuickApps in use.' )
print(fc_o.. #scenes .. ' Scenes, including hidden scenes.')
print(fc_o.. #gvars .. ' Global variables.')
print(fc_o, 'There are '..#rooms ..' rooms in '..#sections.. ' sections.')
print(fc_lg.. separator)
if adminmail then
fibaro.alert("email", {2} , "Fibaro-Info - Geräte Inventur"..""
..alldev.." - Geräte sind insgesamt installiert\n"
..nbdev.." - Geräte mit Stromversorgung und\n"
..bdev.." - batteriebetriebene Geräte\n"
..#users.." - Benutzer\n"
..iosdev.. " - Android/iPhones Tablets\n"
..cam.. " - Kameras\n"
..#plugins.. " - Plugins\n"
..#quickapps.. " - Quickapps\n"
..#scenes.." - Szenen (auch versteckte)\n"
..#gvars.. " - globale Variablen\n"
..#rooms .." - Räume in "..#sections.." Bereichen \n"
.."Übermittelt am "..os.date('%c')..'\n\n' )
end
end --function
checkDevices()