To identify the device and its behavior, can you execute below script once for every state (open, stop, close) and share the results (log) ?samourai47 wrote: Saturday 05 December 2020 9:09 It's the same configuration as used in the earlier question.
Code: Select all
--[[
script to identify device characteristics
sqlite3 is required
if you don't have sqlite3 yet on your system install it with sudo apt install sqlite3
enter device ID and time you want to execute this script
]]
------------------------ Your settings below this line
local executionTime = '11:52' -- format 'hh:mm'
local deviceID = 3244
------------------------ No changes required below this line
return
{
on =
{
timer =
{
'at ' .. executionTime, -- change to the time you want to dump the attributes of the device
},
devices =
{
deviceID,
},
},
logging =
{
level = domoticz.LOG_DEBUG,
marker = 'dumpAttributes',
},
execute = function(dz)
local myDevice = dz.devices(deviceID)
local sqlite = 'sudo sqlite3 '
local function dumpAttributes()
dz.log(myDevice.idx .. ': ' .. myDevice.name ,dz.LOG_FORCE)
dz.log(myDevice.idx .. ': ' .. myDevice.name .. ': attribute -> value (dzVents)',dz.LOG_FORCE)
dz.log(myDevice.idx .. ': ' .. myDevice.name ,dz.LOG_FORCE)
dz.log(myDevice.idx .. ': ' .. myDevice.name .. ': type, subType -> ' .. myDevice.deviceType .. ', '.. tostring(myDevice.deviceSubType),dz.LOG_FORCE)
dz.log(myDevice.idx .. ': ' .. myDevice.name .. ': switchTypeValue -> ' .. myDevice.switchTypeValue ,dz.LOG_FORCE)
dz.log(myDevice.idx .. ': ' .. myDevice.name .. ': adapters -> ' .. dz.utils._.str(myDevice._adapters),dz.LOG_FORCE)
dz.log(myDevice.idx .. ': ' .. myDevice.name .. ': rawData -> ' .. dz.utils._.str(myDevice.rawData),dz.LOG_FORCE)
dz.log(myDevice.idx .. ': ' .. myDevice.name .. ': hwType -> ' .. myDevice.hardwareType .. ', ' .. myDevice.hardwareTypeValue,dz.LOG_FORCE)
dz.log(myDevice.idx .. ': ' .. myDevice.name .. ': levelNames -> ' .. dz.utils._.str(myDevice.levelNames),dz.LOG_FORCE)
dz.log(myDevice.idx .. ': ' .. myDevice.name .. ': modes -> ' .. dz.utils._.str(myDevice.modes),dz.LOG_FORCE)
end
local function dumpDeviceStatus()
local sqlResult, result = dz.utils.osCommand(sqlite .. ' -header domoticz.db "select * from deviceStatus where id = ' .. myDevice.idx .. '"')
if result ~= 0 then
dz.log('Result: ' .. result, dz.LOG_ERROR)
else
sqlResult = dz.utils.stringSplit(sqlResult,'\n')
local header = dz.utils.stringSplit(sqlResult[1],'|')
local values = dz.utils.stringSplit(sqlResult[2],'|')
dz.log(myDevice.idx .. ': ' .. myDevice.name ,dz.LOG_FORCE)
dz.log(myDevice.idx .. ': ' .. myDevice.name .. ': field -> value (database)',dz.LOG_FORCE)
dz.log(myDevice.idx .. ': ' .. myDevice.name ,dz.LOG_FORCE)
for index, attribute in ipairs(header) do
dz.log(myDevice.idx .. ': ' .. myDevice.name .. ': ' .. dz.utils.rightPad(( attribute or '') ,15) .. ' -> ' .. ( values[index] or 'nil') ,dz.LOG_FORCE)
end
end
end
local function dumpVersions()
dz.log(myDevice.idx .. ': ' .. myDevice.name ,dz.LOG_FORCE)
dz.log(myDevice.idx .. ': ' .. myDevice.name .. ': system -> value (versions)',dz.LOG_FORCE)
dz.log(myDevice.idx .. ': ' .. myDevice.name ,dz.LOG_FORCE)
dz.log(myDevice.idx .. ': ' .. myDevice.name .. ': OS -> ' .. dz.utils.osCommand('sudo uname -a'),dz.LOG_FORCE)
dz.log(myDevice.idx .. ': ' .. myDevice.name .. ': Domoticz -> ' .. dz.settings.domoticzVersion,dz.LOG_FORCE)
dz.log(myDevice.idx .. ': ' .. myDevice.name .. ': Dzvents -> ' .. dz.settings.dzVentsVersion,dz.LOG_FORCE)
end
dumpAttributes()
dumpDeviceStatus()
dumpVersions()
end
}