LogicMachine Forum
communication vbus solar resol - Printable Version

+- LogicMachine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10)
+--- Thread: communication vbus solar resol (/showthread.php?tid=346)

Pages: 1 2 3


RE: communication vbus solar resol - KoBra - 09.03.2021

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


RE: communication vbus solar resol - KoBra - 16.03.2021

(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?


RE: communication vbus solar resol - admin - 16.03.2021

The examples posted in this thread are for the LAN module


RE: communication vbus solar resol - KoBra - 02.01.2023

Dear all, hopefully somebody has a clue.

I have the resol module with script https://openrb.com/logicmachine-as-gateway-to-resol-via-vbus-protocol
but keep getting the reply "* string: VBus modules not available"


RE: communication vbus solar resol - admin - 03.01.2023

Check that you have three user libraries created: user.luavbus, user.luavbuspacket and user.vbusprofiles


RE: communication vbus solar resol - KoBra - 03.01.2023

(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.


RE: communication vbus solar resol - KoBra - 04.01.2023

(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



RE: communication vbus solar resol - admin - 05.01.2023

Post a screenshot of your User libraries tab. Make sure that "auto load library" is disabled for all vbus libraries.


RE: communication vbus solar resol - KoBra - 06.01.2023

(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

   


RE: communication vbus solar resol - admin - 06.01.2023

library names for vbus must be all lowercase


RE: communication vbus solar resol - KoBra - 06.01.2023

(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:


RE: communication vbus solar resol - Erwin van der Zwart - 07.01.2023

Do you have require('user.vbus') at the start of the scripts that needs to use the user libs?


RE: communication vbus solar resol - KoBra - 07.01.2023

(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'



RE: communication vbus solar resol - KoBra - 08.01.2023

(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'



RE: communication vbus solar resol - admin - 09.01.2023

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.


RE: communication vbus solar resol - KoBra - 09.01.2023

(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 )


RE: communication vbus solar resol - admin - 09.01.2023

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



RE: communication vbus solar resol - KoBra - 09.01.2023

(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'



RE: communication vbus solar resol - admin - 09.01.2023

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



RE: communication vbus solar resol - KoBra - 09.01.2023

(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'