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.

problems with scripts
#7
I'm using resident functions because for some reason the event-based functions aren't responding well to those events; the final code I used looks like this:

-- Leer valores KNX
local puerta = grp.getvalue('1/0/14') -- 0 = abierta, 1 = cerrada
local presencia = grp.getvalue('1/0/13') -- 0 = no hay nadie, 1 = presencia
local estado = grp.getvalue('32/1/1') -- 0..3
local alarma =grp.getvalue('32/3/12')

log (estado)
log(puerta)
log(presencia)
log(alarma)

-- DETECCIÓN DE OCUPACIÓN INDEBIDA
if estado == 0 then -- Si no está alquilada la vivienda -- -- Y --
if puerta == false or presencia == true then -- Si la puerta esta abierta O el sensor de presencia detecta presencia --
grp.write('32/1/1', 3) -- Se activa el sistema antiocupación --
alert('Alerta, Vivienda 1ºB OCUPADA')
grp.write('32/3/12', true)
end
end

-- PROBLEMA RESUELTO → VOLVER A NO ALQUILADA
if estado == 3 then
if puerta == true and presencia == false then
grp.write('32/1/1', 0)
grp.write('32/3/12', false)
end
end


I was writing the event-based scripts in the same addresses, in this case, on 32/3/12, and the scripts are not running automatically.
Reply


Messages In This Thread
problems with scripts - by ALEJANDRO - 07.01.2026, 13:21
RE: problems with scripts - by Daniel - 07.01.2026, 14:15
RE: problems with scripts - by ALEJANDRO - 07.01.2026, 14:40
RE: problems with scripts - by Daniel - 07.01.2026, 14:50
RE: problems with scripts - by ALEJANDRO - 07.01.2026, 15:32
RE: problems with scripts - by ALEJANDRO - 09.01.2026, 12:02

Forum Jump: