i would like to operate HVAC control from KNX with one control item in OH; this item (Number, with mapping, 1, 2, 3, 4) get after updating HVAC via OH or KNX (via switch in the room) value from 33, 34, 36, 40 (means comfort, standby, night, freeze);
channel command/address is like 5.010:“control address”+<“state address”
so i need a generic rule to change the HVAC control items from 33 to 1, 34 to 2, 36 to 3 and 40 to 4; the result is the correct state information in widgets with the HVAC control item;
the simple process/rule for one specific HVAC control item is not a problem, like …
triggers:
- id: "1"
configuration:
itemName: HEA_MDE_414
type: core.ItemStateChangeTrigger
conditions: []
actions:
- inputs: {}
id: "2"
configuration:
type: application/vnd.openhab.dsl.rule
script: |-
var Number new_state = 0
val mde_com = 33.0
val mde_stb = 34.0
val mde_ngt = 36.0
val mde_fre = 40.0
new_state = HEA_MDE_414.state as Number
switch (new_state)
{
case (mde_com): { new_state = new_state - 32 }
case (mde_stb): { new_state = new_state - 32 }
case (mde_ngt): { new_state = new_state - 33 }
case (mde_fre): { new_state = new_state - 36 }
}
HEA_MDE_414.postUpdate(new_state)
logInfo('text',"MDE_414 : " + HEA_MDE_414.state)
logInfo('text',"new_state : " + new_state)
type: script.ScriptAction
but i have approx. 60 HVAC control items and will not write 60 rules with the same content (like switch/case statement);
have anybody an idea?