-
Notifications
You must be signed in to change notification settings - Fork 4
/
Diagnostics.lua
54 lines (47 loc) · 2.25 KB
/
Diagnostics.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
------------------------------------------------------------------------
-- Copyright (c) 2020-2021 Daniele Bochicchio
-- License: MIT License
-- Source Code: https://github.com/dbochicchio/Vera-VirtualDevices
------------------------------------------------------------------------
-- DIANGOSTICS
-- Use this file to see your configuration and get some warning about the configuration
-- Go to http://VeraIP/cmh/#develop_apps, copy this code, excute and see results into logs
-- http://VeraIP/cgi-bin/cmh/log.sh?Device=LuaUPnP
for deviceID, v in pairs(luup.devices) do
local deviceType = luup.attr_get("device_file", deviceID) or ""
local impl_file = luup.attr_get("impl_file", deviceID) or ""
if deviceType == "D_DimmableLight1.xml" or
deviceType == "D_VirtualDimmableLight1.xml" or
deviceType == "D_VirtualAlarmPartition1.xml" or
deviceType == "D_VirtualDoorLock1.xml" or
deviceType == "D_VirtualHeater1.xml" or
deviceType == "D_VirtualRGBW1.xml" or
deviceType == "D_VirtualRGBW2.xml" or
deviceType == "D_VirtualSceneController1.xml" or
deviceType == "D_VirtualDoorSensor1.xml" or
deviceType == "D_VirtualSmokeSensor1.xml" or
deviceType == "D_VirtualFloodSensor1.xml" or
deviceType == "D_VirtualFreezeSensor1.xml" or
deviceType == "D_VirtualWindowCovering1.xml" or
-- impl_file
impl_file == "I_VirtualBinaryLight1.xml" or
impl_file == "I_VirtualRGBW1.xml" or
impl_file == "I_VirtualHeater1.xml" or
impl_file == "I_VirtualGenericSensor1" or
impl_file == "I_VirtualDoorLock1.xml" or
impl_file == "I_VirtualAlarmPartition1.xml" or
impl_file == "I_VirtualSceneController1.xml"
then
local parentID = luup.attr_get("id_parent", deviceID)
local debugMode = 0 -- TODO
-- warnings
local warning = ""
if parentID ~= "0" and #impl_file>0 then
warning = warning .. 'Parent ID specified, please remove impl_file attr / '
end
if parentID == "0" and not impl_file:lower():find("^i_virtual") then
warning = warning .. 'impl_file should be set to the virtual one / '
end
luup.log('Virtual Device #' .. tostring(deviceID) .. ' - ' .. luup.devices[deviceID].description .. ' - Parent: ' .. tostring(parentID) .. ' - impl_file: ' .. impl_file .. ' - DebugMode: ' .. debugMode .. ' - Warning: ' .. (warning ~= "" and warning or "none"))
end
end