04.01.2023, 20:04
(03.01.2023, 11:16)KoBra Wrote:(03.01.2023, 09:36)admin Wrote: Check that you have three user libraries created: user.luavbus, user.luavbuspacket and user.vbusprofilesYep they are all installed. incl the fixing of the bug on line 42 as described earlier in the topic.
Found this in the error log
Code:
Resident script:23: attempt to index global 'vbus' (a nil value)
stack traceback:
I can't find the problem there as i just copy pasted that script
Code:
for _, searcher in ipairs(package.searchers or package.loaders) do
name = "luavbus"
local loader = searcher(name)
if type(loader) == 'function' then
package.preload[name] = loader
vbus = require (name)
break
end
name = "user.luavbus"
local loader = searcher(name)
if type(loader) == 'function' then
package.preload[name] = loader
vbus = require (name)
break
end
end
log_level = WARN
if ( vbus == nil ) then
log ( "VBus modules not available")
end
vbus.new(nil, TCPIP, "vbus" )
vbus.remote_host = "192.168.0.1"
vbus.remote_port = "7053"
vbus.password = "vbus"
vbus:connect()
-- filter = { srcAddress = 0x7e11, dstAddress = 0x0010 }
-- filter = { command = 0x200 }
packets = vbus:waitData(filter, 30 )
if (packets ~= nil ) then
log( string.format ( "Returned %d packets", #packets ) )
for key, packet in pairs(packets) do
-- print ( string.format ( "Packet: %s", packet ) )
-- print ( packet:profileprint() )
if ( packet.profileData ~= nil) then
for k, data in pairs ( packet.profileData ) do
if ( data.factor < 1 ) then
log( string.format ( "Name %s Value %.02f %s", data.name, data.value, data.unit ) )
else
log( string.format ( "Name %s Value %d %s", data.name, data.value, data.unit ) )
end
end
end
end
else
log( "No packet!!!")
end