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
#43
I finally got it working thanks to AI. For everybody struggeling. Please find my working script below.
Code:
local http = require('socket.http') local bit = require('bit') -- CONFIGURATION local url = 'http://192.168.1.1/current/current_packets.vbus' local alarm_obj = '0/4/28' -- DPT 1.005: 1 = ALARM, 0 = OK function parseVBus()   local response, status = http.request(url)     -- 1. HTTP Connection Check (Network/KM2 Failure)   if status ~= 200 or not response then     grp.checkupdate(alarm_obj, true) -- ALARM ON     log("[SLL ALARM] KM2 unreachable. Network or Power issue.")     return   end   local function getVal(b1, b2)     if not b1 or not b2 then return 0 end     local v = (b2 * 256) + b1     if v > 32767 then v = v - 65536 end     return v * 0.1   end   -- 2. Find the primary SLL Data Header   local p = response:find('\16\00\113\34\16')     if p then     -- System is healthy     grp.checkupdate(alarm_obj, false) -- ALARM OFF (OK)     -- SENSORS     local s1 = getVal(response:byte(p+16), response:byte(p+17))     local s2 = getVal(response:byte(p+18), response:byte(p+19))     local s3 = getVal(response:byte(p+20), response:byte(p+21))         local s4 = 0     local p_extra = response:find('\16\00\00\01\76', p)     if p_extra then        s4 = getVal(response:byte(p_extra+18), response:byte(p_extra+19))     end     -- PWM & RELAYS (Verified Mapping)     local pwa = response:byte(p+32) or 0 -- PWM A     local r2  = response:byte(p+33) or 0 -- Relay 2 (Diverting Valve)     local mask = response:byte(p+40) or 0     local r1  = (bit.band(mask, 0x01) == 0x01) and 100 or 0 -- Relay 1 (Pump Power)     -- Safety Cleanup     if pwa > 100 then pwa = 0 end     if r1 > 100 then r1 = 100 end     if r2 > 100 then r2 = 100 end     -- KNX UPDATES     grp.checkupdate('0/4/26', s1)     grp.checkupdate('0/4/20', s2)     grp.checkupdate('0/4/23', s3)     grp.checkupdate('0/4/21', s4)     grp.checkupdate('0/4/24', pwa)     grp.checkupdate('0/4/27', r1)     grp.checkupdate('0/4/25', r2)   else     -- 3. Data Header Missing (VBus Cable or Controller Mode Failure)     grp.checkupdate(alarm_obj, true) -- ALARM ON     log("[SLL ALARM] KM2 online but VBus data stream invalid.")   end end parseVBus()
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
RE: communication vbus solar resol - by KoBra - 28.02.2026, 17:08

Forum Jump: