This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

communication vbus solar resol
#34
(07.01.2023, 22:29)KoBra Wrote:
(07.01.2023, 19:28)Erwin van der Zwart Wrote: Do you have require('user.vbus') at the start of the scripts that needs to use the user libs?

i changed line 9 in the script below from luavbus to vbus.
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.vbus"
  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.188"
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

it seems it improved a bit because now the error logs show 

Code:
User library Vbus:716: bad argument #1 to 'pairs' (table expected, got nil)
stack traceback:
[C]: in function 'pairs'
User library Vbus:716: in function 'readDevicesProfiles'
User library Vbus:233: in function 'waitData'

After starting the resident script now i get a different error. 
Code:
User library Vbus:149: attempt to index field 'socket' (a nil value)
stack traceback:
User library Vbus:149: in function 'connect'
Reply


Messages In This Thread
communication vbus solar resol - by 69jtdti - 15.07.2016, 16:13
RE: communication vbus solar resol - by lpala - 12.11.2016, 15:45
RE: communication vbus solar resol - by lpala - 01.12.2016, 09:36
RE: communication vbus solar resol - by lpala - 18.01.2017, 21:32
RE: communication vbus solar resol - by lpala - 22.01.2017, 17:20
RE: communication vbus solar resol - by admin - 23.01.2017, 08:49
RE: communication vbus solar resol - by lpala - 23.01.2017, 21:21
RE: communication vbus solar resol - by lpala - 22.02.2017, 08:37
RE: communication vbus solar resol - by lpala - 23.04.2017, 21:28
RE: communication vbus solar resol - by lpala - 29.04.2017, 07:19
RE: communication vbus solar resol - by admin - 13.11.2017, 06:57
RE: communication vbus solar resol - by lpala - 23.12.2017, 18:05
RE: communication vbus solar resol - by admin - 13.11.2017, 11:11
RE: communication vbus solar resol - by KoBra - 09.03.2021, 11:33
RE: communication vbus solar resol - by KoBra - 16.03.2021, 11:26
RE: communication vbus solar resol - by admin - 16.03.2021, 11:30
RE: communication vbus solar resol - by KoBra - 02.01.2023, 16:32
RE: communication vbus solar resol - by admin - 03.01.2023, 09:36
RE: communication vbus solar resol - by KoBra - 03.01.2023, 11:16
RE: communication vbus solar resol - by KoBra - 04.01.2023, 20:04
RE: communication vbus solar resol - by admin - 05.01.2023, 08:19
RE: communication vbus solar resol - by KoBra - 06.01.2023, 14:15
RE: communication vbus solar resol - by admin - 06.01.2023, 14:16
RE: communication vbus solar resol - by KoBra - 06.01.2023, 21:29
RE: communication vbus solar resol - by KoBra - 07.01.2023, 22:29
RE: communication vbus solar resol - by KoBra - 08.01.2023, 19:39
RE: communication vbus solar resol - by admin - 09.01.2023, 07:59
RE: communication vbus solar resol - by KoBra - 09.01.2023, 08:33
RE: communication vbus solar resol - by admin - 09.01.2023, 08:41
RE: communication vbus solar resol - by KoBra - 09.01.2023, 08:57
RE: communication vbus solar resol - by admin - 09.01.2023, 09:29
RE: communication vbus solar resol - by KoBra - 09.01.2023, 10:45
RE: communication vbus solar resol - by KoBra - 24.01.2023, 09:31
RE: communication vbus solar resol - by admin - 24.01.2023, 10:11

Forum Jump: