All,
After a smooth upgrade to OpenHAB 4.2 I just discovered the Basic Profiles transformations bundle. It seems that I can get rid of several one-line rules, e.g. just toggling a switch item when a button was pressed.
I have some use cases though where I have a list of fixed values for a (say) String item and upon every press of a button (triggers an event) I assign the next value from the list to that String item.
At the moment I implemented this as a rule, like this:
switch (receivedEvent) {
...
case "3001": {
// Long press "Light" button
switch (vSetLightConfig_Kitchen.state.toString) {
case "NORMAL": { vSetLightConfig_Kitchen.sendCommand("REDUCED") }
case "REDUCED": { vSetLightConfig_Kitchen.sendCommand("EVENING") }
case "EVENING": { vSetLightConfig_Kitchen.sendCommand("NIGHT") }
case "NIGHT": { vSetLightConfig_Kitchen.sendCommand("NORMAL") }
default: { vSetLightConfig_Kitchen.sendCommand("NORMAL") }
}
}
...
}
I wonder if it would be possible (and useful) to have this kind of logic covered by a (new) transformation profile. (Using a MAP transformation would certainly be another way to get rid of the coded rule…)
Thanks,
Dietmar