| 
		
	
	
	
		
	Posts: 123 
	Threads: 23 
	Joined: Apr 2018
	
 Reputation: 
2 
	
	
		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
		
	 
	
	
	
		
	Posts: 123 
	Threads: 23 
	Joined: Apr 2018
	
 Reputation: 
2 
	
	
		 (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?
	 
		
	 
	
	
	
		
	Posts: 8413 
	Threads: 45 
	Joined: Jun 2015
	
 Reputation: 
481 
	
	
		The examples posted in this thread are for the LAN module
	 
		
	 
	
	
	
		
	Posts: 123 
	Threads: 23 
	Joined: Apr 2018
	
 Reputation: 
2 
	
	
		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"
	
		
	 
	
	
	
		
	Posts: 8413 
	Threads: 45 
	Joined: Jun 2015
	
 Reputation: 
481 
	
	
		Check that you have three user libraries created: user.luavbus, user.luavbuspacket and user.vbusprofiles
	 
		
	 
	
	
	
		
	Posts: 123 
	Threads: 23 
	Joined: Apr 2018
	
 Reputation: 
2 
	
	
		 (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.
	 
		
	 
	
	
	
		
	Posts: 123 
	Threads: 23 
	Joined: Apr 2018
	
 Reputation: 
2 
	
	
		 (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) doname = "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
 
		
	 
	
	
	
		
	Posts: 8413 
	Threads: 45 
	Joined: Jun 2015
	
 Reputation: 
481 
	
	
		Post a screenshot of your User libraries tab. Make sure that "auto load library" is disabled for all vbus libraries.
	 
		
	 
	
	
	
		
	Posts: 123 
	Threads: 23 
	Joined: Apr 2018
	
 Reputation: 
2 
	
	
		 (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
   
		
	 
	
	
	
		
	Posts: 8413 
	Threads: 45 
	Joined: Jun 2015
	
 Reputation: 
481 
	
	
		library names for vbus must be all lowercase
	 
		
	 
	
	
	
		
	Posts: 123 
	Threads: 23 
	Joined: Apr 2018
	
 Reputation: 
2 
	
	
		 (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:
	 
		
	 
	
	
	
		
	Posts: 1807 
	Threads: 7 
	Joined: Jul 2015
	
 Reputation: 
121 
	
	
		Do you have require('user.vbus') at the start of the scripts that needs to use the user libs?
	 
		
	 
	
	
	
		
	Posts: 123 
	Threads: 23 
	Joined: Apr 2018
	
 Reputation: 
2 
	
	
		 (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) doname = "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'
 
		
	 
	
	
	
		
	Posts: 123 
	Threads: 23 
	Joined: Apr 2018
	
 Reputation: 
2 
	
	
		 (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) doname = "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'
 
		
	 
	
	
	
		
	Posts: 8413 
	Threads: 45 
	Joined: Jun 2015
	
 Reputation: 
481 
	
	
		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.
	 
		
	 
	
	
	
		
	Posts: 123 
	Threads: 23 
	Joined: Apr 2018
	
 Reputation: 
2 
	
	
		 (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    )
	 
		
	 
	
	
	
		
	Posts: 8413 
	Threads: 45 
	Joined: Jun 2015
	
 Reputation: 
481 
	
	
		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
		
	 
	
	
	
		
	Posts: 123 
	Threads: 23 
	Joined: Apr 2018
	
 Reputation: 
2 
	
		
		
		09.01.2023, 08:57 
(This post was last modified: 09.01.2023, 08:57 by KoBra.)
		
	 
		 (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'
 
		
	 
	
	
	
		
	Posts: 8413 
	Threads: 45 
	Joined: Jun 2015
	
 Reputation: 
481 
	
	
		You need to remove these lines from the library: Code: for _, searcher in ipairs(package.searchers or package.loaders) doname = "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
		
	 
	
	
	
		
	Posts: 123 
	Threads: 23 
	Joined: Apr 2018
	
 Reputation: 
2 
	
	
		 (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) doname = "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'
 
		
	 |