last week unfortunately my KNX dimmer (Busch-Jaeger 6968, Powernet) broke down. Now I want to replace it with a Z-Wave device. For testing purposes I use a Zipato RGBW bulb. I created a rule which passes over the commands from KNX to Z-Wave:
rule "Brücke KNX zu RGBW Deckenfluter"
when
Item OG_WoZi_Deckenfluter changed
then
logInfo("Beleuchtung",OG_WoZi_Deckenfluter.state.toString)
sendCommand(OG_WoZi_RGBW_Deckenfluter,OG_WoZi_Deckenfluter.state.toString)
end
With simple ON/OFF commands this works like a charm. But when I want to dim nothing happens except of some errors thrown in the log:
2018-05-21 10:30:03.612 [INFO ] [e.smarthome.model.script.Beleuchtung] - UNDEF
2018-05-21 10:30:03.622 [WARN ] [rthome.model.script.actions.BusEvent] - Cannot convert 'UNDEF' to a command type which item 'OG_WoZi_RGBW_Deckenfluter' accepts: [PercentType, OnOffType, IncreaseDecreaseType, RefreshType].
So I turned on KNX tracing to see what is going on when a dimming button is pushed:
2018-05-21 10:33:57.447 [TRACE] [nx.internal.client.AbstractKNXClient] - Received a Group Write telegram from '1.2.6' to '0/0/26'
2018-05-21 10:33:57.451 [DEBUG] [.internal.handler.DeviceThingHandler] - Thing 'knx:device:bridge:generic' received a Group Write telegram from '1.2.6' for destination '0/0/26'
2018-05-21 10:33:57.457 [TRACE] [.internal.handler.DeviceThingHandler] - Thing 'knx:device:bridge:generic' processes a Group Write telegram for destination '0/0/26' for channel 'knx:device:bridge:generic:OG_WoZi_Deckenfluter'
2018-05-21 10:33:57.461 [TRACE] [g.knx.internal.dpt.KNXCoreTypeMapper] - toType datapoint DPT = 3.007
2018-05-21 10:34:00.287 [TRACE] [nx.internal.client.AbstractKNXClient] - Received a Group Write telegram from '1.2.6' to '0/0/26'
2018-05-21 10:34:00.289 [DEBUG] [.internal.handler.DeviceThingHandler] - Thing 'knx:device:bridge:generic' received a Group Write telegram from '1.2.6' for destination '0/0/26'
2018-05-21 10:34:00.296 [TRACE] [.internal.handler.DeviceThingHandler] - Thing 'knx:device:bridge:generic' processes a Group Write telegram for destination '0/0/26' for channel 'knx:device:bridge:generic:OG_WoZi_Deckenfluter'
2018-05-21 10:34:00.298 [TRACE] [g.knx.internal.dpt.KNXCoreTypeMapper] - toType datapoint DPT = 3.007
2018-05-21 10:34:00.300 [DEBUG] [g.knx.internal.dpt.KNXCoreTypeMapper] - toType: KNX DPT_Control_Dimming: break received.
Does anybody have a hint for me how to get dimming working? I think I have to create an absolute dimming value to be sent to the RBGW-bulb. But I don’t know how to catch the KNX-commands. Or is there another way to archive this?
well you dont send any dimming value! the KNX button sends either INCREASE or DECREASE
make a rule when KNX buttons sends ex INCREASE, current zwave dimming value +10
rule "Dusch Scene KNX Volume"
when
Item SonosBVol received command
then
var Number Volume = VolumeBadrum.state as DecimalType
var Number NewVol = Volume + 10
var Number OldVol = Volume - 10
if (SonosBVol.state==OFF){
sendCommand(VolumeBadrum, NewVol)
}
if (SonosBVol.state==ON){
sendCommand(VolumeBadrum, OldVol)
}
end
here is an example from my KNX button volume control for my Sonos
i dont have any zwave dimmers but isnt there an increase and decrease zwave command?
I already tried to use the “received command” statement in a rule. But unfortunately nothing happens The rule is not triggered when I push a button:
rule "Test mit received command"
when
Item OG_WoZi_Deckenfluter received command
then
logInfo("mytest", "Command received!")
end
IMHO this rule should work but it doesn’t:
2018-05-22 09:29:54.051 [TRACE] [nx.internal.client.AbstractKNXClient] - Received a Group Write telegram from '1.2.6' to '0/0/25'
2018-05-22 09:29:54.057 [DEBUG] [.internal.handler.DeviceThingHandler] - Thing 'knx:device:bridge:generic' received a Group Write telegram from '1.2.6' for destination '0/0/25'
2018-05-22 09:29:54.070 [TRACE] [.internal.handler.DeviceThingHandler] - Thing 'knx:device:bridge:generic' processes a Group Write telegram for destination '0/0/25' for channel 'knx:device:bridge:generic:OG_WoZi_Deckenfluter'
2018-05-22 09:29:54.075 [TRACE] [g.knx.internal.dpt.KNXCoreTypeMapper] - toType datapoint DPT = 1.001
==> /var/log/openhab2/events.log <==
2018-05-22 09:29:54.095 [GroupItemStateChangedEvent] - gOG_Lampen changed from OFF to ON through OG_WoZi_Deckenfluter
2018-05-22 09:29:54.101 [vent.ItemStateChangedEvent] - OG_WoZi_Deckenfluter changed from 0 to 100
2018-05-22 09:29:54.106 [GroupItemStateChangedEvent] - gLampen changed from OFF to ON through gOG_Lampen
==> /var/log/openhab2/openhab.log <==
2018-05-22 09:29:56.813 [TRACE] [nx.internal.client.AbstractKNXClient] - Received a Group Write telegram from '1.2.6' to '0/0/25'
2018-05-22 09:29:56.819 [DEBUG] [.internal.handler.DeviceThingHandler] - Thing 'knx:device:bridge:generic' received a Group Write telegram from '1.2.6' for destination '0/0/25'
2018-05-22 09:29:56.830 [TRACE] [.internal.handler.DeviceThingHandler] - Thing 'knx:device:bridge:generic' processes a Group Write telegram for destination '0/0/25' for channel 'knx:device:bridge:generic:OG_WoZi_Deckenfluter'
2018-05-22 09:29:56.834 [TRACE] [g.knx.internal.dpt.KNXCoreTypeMapper] - toType datapoint DPT = 1.001
==> /var/log/openhab2/events.log <==
2018-05-22 09:29:56.849 [GroupItemStateChangedEvent] - gOG_Lampen changed from ON to OFF through OG_WoZi_Deckenfluter
2018-05-22 09:29:56.856 [GroupItemStateChangedEvent] - gLampen changed from ON to OFF through gOG_Lampen
2018-05-22 09:29:56.860 [vent.ItemStateChangedEvent] - OG_WoZi_Deckenfluter changed from 100 to 0
==> /var/log/openhab2/openhab.log <==
2018-05-22 09:29:59.467 [TRACE] [nx.internal.client.AbstractKNXClient] - Received a Group Write telegram from '1.2.6' to '0/0/26'
2018-05-22 09:29:59.472 [DEBUG] [.internal.handler.DeviceThingHandler] - Thing 'knx:device:bridge:generic' received a Group Write telegram from '1.2.6' for destination '0/0/26'
2018-05-22 09:29:59.485 [TRACE] [.internal.handler.DeviceThingHandler] - Thing 'knx:device:bridge:generic' processes a Group Write telegram for destination '0/0/26' for channel 'knx:device:bridge:generic:OG_WoZi_Deckenfluter'
2018-05-22 09:29:59.489 [TRACE] [g.knx.internal.dpt.KNXCoreTypeMapper] - toType datapoint DPT = 3.007
2018-05-22 09:30:01.825 [TRACE] [nx.internal.client.AbstractKNXClient] - Received a Group Write telegram from '1.2.6' to '0/0/26'
2018-05-22 09:30:01.829 [DEBUG] [.internal.handler.DeviceThingHandler] - Thing 'knx:device:bridge:generic' received a Group Write telegram from '1.2.6' for destination '0/0/26'
2018-05-22 09:30:01.838 [TRACE] [.internal.handler.DeviceThingHandler] - Thing 'knx:device:bridge:generic' processes a Group Write telegram for destination '0/0/26' for channel 'knx:device:bridge:generic:OG_WoZi_Deckenfluter'
2018-05-22 09:30:01.842 [TRACE] [g.knx.internal.dpt.KNXCoreTypeMapper] - toType datapoint DPT = 3.007
2018-05-22 09:30:01.846 [DEBUG] [g.knx.internal.dpt.KNXCoreTypeMapper] - toType: KNX DPT_Control_Dimming: break received.
==> /var/log/openhab2/events.log <==
2018-05-22 09:30:01.864 [vent.ItemStateChangedEvent] - OG_WoZi_Deckenfluter changed from 0 to UNDEF
Any ideas why this rule is not triggered?
When I change the value within the basic UI this rule is triggered.
2018-05-22 09:47:44.389 [ome.event.ItemCommandEvent] - Item 'OG_WoZi_Deckenfluter' received command 35
==> /var/log/openhab2/openhab.log <==
2018-05-22 09:47:44.399 [TRACE] [.internal.handler.DeviceThingHandler] - Handling command '35' for channel 'knx:device:bridge:generic:OG_WoZi_Deckenfluter'
2018-05-22 09:47:44.408 [DEBUG] [nx.internal.client.AbstractKNXClient] - Wrote value '35' to datapoint 'command DP 0/0/28 'knx:ip:bridge', DPT id 5.001, low priority' (0. attempt).
2018-05-22 09:47:44.432 [INFO ] [clipse.smarthome.model.script.mytest] - Command received!
==> /var/log/openhab2/events.log <==
2018-05-22 09:47:44.437 [vent.ItemStateChangedEvent] - OG_WoZi_Deckenfluter changed from UNDEF to 35
2018-05-22 09:47:44.442 [GroupItemStateChangedEvent] - gLampen changed from OFF to ON through gOG_Lampen
2018-05-22 09:47:44.448 [GroupItemStateChangedEvent] - gOG_Lampen changed from OFF to ON through OG_WoZi_Deckenfluter
I think I found a solution: Because I’m use the KNX2 binding it is necessary to set *-control in the .items file. Now commands were received and the rule was triggered.My rule looks like this:
rule "Test mit received command"
when
Item OG_WoZi_Deckenfluter received command
then
logInfo("mytest", "Command received!")
logInfo( "mytest", "Command war: " + receivedCommand.toString )
switch (receivedCommand) {
case INCREASE : {
OG_WoZi_RGBW_Deckenfluter.sendCommand((OG_WoZi_RGBW_Deckenfluter.state as Number)+5)
}
case DECREASE : {
OG_WoZi_RGBW_Deckenfluter.sendCommand((OG_WoZi_RGBW_Deckenfluter.state as Number)-5)
}
case OFF : {
OG_WoZi_RGBW_Deckenfluter.sendCommand(OFF)
}
case ON : {
OG_WoZi_RGBW_Deckenfluter.sendCommand(ON)
}
}
end
This works as expected. The only issue now is when keeping the button pressed the rule is only triggered once. The goal is to increase/decrease the value as long the button is pressed. Any ideas how to solve this?
Finally I built this workaround. A short press turns the light ON/OFF, a long press increases/decreases the value by 10. This works pretty good for me unless the KNX Stop Command isn’t evaluated. Comments and improvements are welcome
var dimlevel = 0
rule "Test mit received command"
when
Item OG_WoZi_Deckenfluter_Old received command
then
logInfo("mytest", "Command received!")
logInfo( "mytest", "Command war: " + receivedCommand.toString )
switch (receivedCommand) {
case INCREASE : {
if (dimlevel <= 90) {
dimlevel +=10
}
OG_WoZi_Deckenfluter.sendCommand(dimlevel)
}
case DECREASE : {
if (dimlevel >= 10) {
dimlevel -=10
}
OG_WoZi_Deckenfluter.sendCommand(dimlevel)
}
case OFF : {
OG_WoZi_Deckenfluter.sendCommand(0)
}
case ON : {
if (dimlevel >= 10) {
OG_WoZi_Deckenfluter.sendCommand(dimlevel)
}
else {
dimlevel = 50
OG_WoZi_Deckenfluter.sendCommand(dimlevel)
}
}
}
end