Knx and TRÅDFRI


(Rasmus Balle) #1

Hello guys.
When using a knx device to control TRÅDFRI devices, how does it handle the dimming process when using relative dimming?
Is it sending a brightness level all time when button is pressed?


(Udo Hartmann) #2

Afaik you have to build rules to translate INCREASE/DECREASE commands to a “increase/decrease brightness by 5”.


(Rasmus Balle) #3

Okay… yes of course…, but how to do that? Simply set the relative dim input to “when item changed”
Then trigger the rule to dim up / down?


(Udo Hartmann) #4

Are you using knx1 or knx2? If it’s knx2, you have to define a dimmer-control Channel. Then simply use a rule like

rule "control Tradfri via knx"
when
    Item myKnxDimmerControl received command
then
    switch (receivedCommand) {
        case ON : myTradfriItem.sendCommand(ON)
        case OFF : myTradfriItem.sendCommand(OFF)
        case INCREASE : {
            if(myTradfriItem.state instanceof Number) myTradfriItem.sendCommand(myTradfriItem.state + 5)
            else myTradfriItem.sendCommand(5)
        }
        case DECREASE : {
            if(myTradfriItem.state instanceof Number) myTradfriItem.sendCommand(myTradfriItem.state - 5)
            else myTradfriItem.sendCommand(95)
        }
    }
end

Read 4 bit dimming command from KNX bus
(Rasmus Balle) #5

Perfect - thanks… I’m migrating over to knx2, currently I use knx 1…

I’ve seen around that it also could be made directly in the item config - where it just has a link to “two things” both the hue/TRÅDFRI and knx - but not sure if that will work correctly :slight_smile: