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
#21
Can i use instead of the LAN module also the KM2 that has connection to vbus.net also?

Vbus LAN : https://www.resol.de/en/produktdetail/76
Vbus KM2 datalogger : https://www.resol.de/en/produktdetail/209
Reply
#22
(09.03.2021, 11:33)KoBra Wrote: Can i use instead of the LAN module also the KM2 that has connection to vbus.net also?

Vbus LAN : https://www.resol.de/en/produktdetail/76
Vbus KM2 datalogger : https://www.resol.de/en/produktdetail/209

Nobody that has an answer?
Reply
#23
The examples posted in this thread are for the LAN module
Reply
#24
Dear all, hopefully somebody has a clue.

I have the resol module with script https://openrb.com/logicmachine-as-gatew...s-protocol
but keep getting the reply "* string: VBus modules not available"
Reply
#25
Check that you have three user libraries created: user.luavbus, user.luavbuspacket and user.vbusprofiles
Reply
#26
(03.01.2023, 09:36)admin Wrote: Check that you have three user libraries created: user.luavbus, user.luavbuspacket and user.vbusprofiles
Yep they are all installed. incl the fixing of the bug on line 42 as described earlier in the topic.
Reply
#27
(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.vbusprofiles
Yep 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
Reply
#28
Post a screenshot of your User libraries tab. Make sure that "auto load library" is disabled for all vbus libraries.
Reply
#29
(05.01.2023, 08:19)admin Wrote: Post a screenshot of your User libraries tab. Make sure that "auto load library" is disabled for all vbus libraries.

auto load library is off for all

   
Reply
#30
library names for vbus must be all lowercase
Reply
#31
(06.01.2023, 14:16)admin Wrote: library names for vbus must be all lowercase

changed all the scripts to lowercase but no difference:

Log tab: * string: VBus modules not available
Error Log tab: Resident script:23: attempt to index global 'vbus' (a nil value) stack traceback:
Reply
#32
Do you have require('user.vbus') at the start of the scripts that needs to use the user libs?
Reply
#33
(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'
Reply
#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
#35
This error means that the connection failed. Check that the IP address of Vbus device is correct and that you can ping it from LM.
Reply
#36
(09.01.2023, 07:59)admin Wrote: This error means that the connection failed. Check that the IP address of Vbus device is correct and that you can ping it from LM.

It was online but not responsive, now we are back to the previous error. (i should have thought of this Angel )
Reply
#37
Replace the top part of the user.vbus with this. Then restart the resident script via disable/enable. It will produce an error if your user libraries are not named in all lowercase (vbusprofiles and luavbuspacket).
Code:
local luavbus = {}

socket = require ("socket")
cjson = require("json")
vbusprofiles = require("user.vbusprofiles")
luavbuspacket = require("user.luavbuspacket")

local SERIAL, TCPIP = 0, 1
Reply
#38
(09.01.2023, 08:41)admin Wrote: Replace the top part of the user.vbus with this. Then restart the resident script via disable/enable. It will produce an error if your user libraries are not named in all lowercase (vbusprofiles and luavbuspacket).
Code:
local luavbus = {}

socket = require ("socket")
cjson = require("json")
vbusprofiles = require("user.vbusprofiles")
luavbuspacket = require("user.luavbuspacket")

local SERIAL, TCPIP = 0, 1

The response: 
Code:
User library vbus:15: module 'user.vbusprofiles' not found:
no field package.preload['user.vbusprofiles']
no file './user/vbusprofiles'
no file 'Library user/vbusprofiles'
no file 'User library vbusprofiles'
no file 'Library user/vbusprofiles.so'
no file 'Library user.so'
stack traceback:
[C]: in function 'require'
User library vbus:15: in main chunk
[C]: in function 'require'
so i changed name from vbusprofile > vbusprofiles
Code:
User library vbus:16: module 'uservbuspacket' not found:
no field package.preload['uservbuspacket']
no file './user/luavbuspacket'
no file 'Library user/luavbuspacket'
no file 'User library luavbuspacket'
no file 'Library user/luavbuspacket.so'
no file 'Library user.so'
stack traceback:
[C]: in function 'require'
User library vbus:16: in main chunk
[C]: in function 'require'
so i changed vbuspacket to luavbuspacket

now the error is:
Code:
User library vbus:725: attempt to index global 'cjson' (a boolean value)
stack traceback:
User library vbus:725: in function 'readDevicesProfiles'
User library vbus:240: in function 'waitData'
Reply
#39
You need to remove these lines from the library:
Code:
for _, searcher in ipairs(package.searchers or package.loaders) do
    name = "cjson"
    local loader = searcher(name)
    if type(loader) == 'function' then
      package.preload[name] = loader
      cjson  = require (name)
      break
    end
    name = "json"
    local loader = searcher(name)
    if type(loader) == 'function' then
      package.preload[name] = loader
      cjson  = require (name)
      break
    end
  end

  for _, searcher in ipairs(package.searchers or package.loaders) do
    name = "vbusprofiles"
    local loader = searcher(name)
    if type(loader) == 'function' then
      package.preload[name] = loader
      vbusprofiles  = require (name)
      break
    end
    name = "user.vbusprofiles"
    local loader = searcher(name)
    if type(loader) == 'function' then
      package.preload[name] = loader
      vbusprofiles  = require (name)
      break
    end
  end

  for _, searcher in ipairs(package.searchers or package.loaders) do
    name = "luavbuspacket"
    local loader = searcher(name)
    if type(loader) == 'function' then
      package.preload[name] = loader
      luavbuspacket  = require (name)
      break
    end
    name = "user.luavbuspacket"
    local loader = searcher(name)
    if type(loader) == 'function' then
      package.preload[name] = loader
      luavbuspacket  = require (name)
      break
    end
  end
Reply
#40
(09.01.2023, 09:29)admin Wrote: You need to remove these lines from the library:
Code:
  for _, searcher in ipairs(package.searchers or package.loaders) do
    name = "cjson"
    local loader = searcher(name)
    if type(loader) == 'function' then
      package.preload[name] = loader
      cjson  = require (name)
      break
    end
    name = "json"
    local loader = searcher(name)
    if type(loader) == 'function' then
      package.preload[name] = loader
      cjson  = require (name)
      break
    end
  end

  for _, searcher in ipairs(package.searchers or package.loaders) do
    name = "vbusprofiles"
    local loader = searcher(name)
    if type(loader) == 'function' then
      package.preload[name] = loader
      vbusprofiles  = require (name)
      break
    end
    name = "user.vbusprofiles"
    local loader = searcher(name)
    if type(loader) == 'function' then
      package.preload[name] = loader
      vbusprofiles  = require (name)
      break
    end
  end

  for _, searcher in ipairs(package.searchers or package.loaders) do
    name = "luavbuspacket"
    local loader = searcher(name)
    if type(loader) == 'function' then
      package.preload[name] = loader
      luavbuspacket  = require (name)
      break
    end
    name = "user.luavbuspacket"
    local loader = searcher(name)
    if type(loader) == 'function' then
      package.preload[name] = loader
      luavbuspacket  = require (name)
      break
    end
  end

now we go to 
Code:
User library vbus:303: bad argument #3 to 'format' (no value)
stack traceback:
[C]: in function 'format'
User library vbus:303: in function 'packetExtract'
User library vbus:205: in function 'waitData'
Reply


Forum Jump: