I thought I’d share this work in progress, based on my previous post here. I am an amateur both in Lua and in KNX… so take with a huge grain of salt.

All these scripts do is open a socket to a defined IP and Port and send a telnet command… then add an “Enter”… then wait for an answer. It closes right after that, as the Pioneer does not like more than one telnet connection at a time and I don’t want to hog the port.

The new firmware of the Logic Machine by openrb has brought a new way of programing KNX. As can bee seen in the screenshot, no programming is done with code. All you do is use the blocks to create the logic you might need.

This example is a scene that opens or closes the ventilation based on the state of a group.

I have been optimizing my DMX scripts for the LogicMachine. The following is a set of functions that will enable you to turn a set of DMX channels on/off.

-- set of variables for zones in the apartment
alllights = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24}
bathroomlights = {7,8,20}
livinglights = {5,6,9,10,11,12,14,15,16,17,18,19}
kitchenlights = {13}
bedroomlights = {1,2}
entrancelights = {4}
-- turns DMX stripe to full on or off based on two groups
function dmxtoggle(channel, state)
-- group that contains the value for ON
on = grp.getvalue('5/7/17')
-- group that contains the value for OFF
off = grp.getvalue('5/7/18')
if (state == true) then
DMX.set(channel, on)
else
DMX.set(channel, off)
end
end
-- loops through all lights
-- lights is an array of the channel(s) to be set
-- state is the state of the group
function dmxlooptoggle(lights, state)
for index, value in ipairs(lights) do
dmxtoggle(value, state)
end
end
--Loops through an array of channels and sets them to a value
function dmxloopset(lights, value)
for index, channel in ipairs(lights) do
DMX.set(channel, value)
end
end

To use it, create a user library, I called it mydmx. Then copy/paste the above code and change the variables to the light groups you want to switch together.

To then run it use the following code. The first line enables the above user library. Then the dmxlooptoggle is called to change the bathroom light to the value of the group (on/off). the last code updates a group that holds the status object (on/off).