I have 9 Eurotronic Spirit Z-Wave valves. Each of them has 5 Channels binded to an Item. This Items are controlled with a cron-rule, based on temperature, time and state of a window. Actually the code in the rule is duplicated for each valve
Now I would like to iterate through all valves and in the first tries, I’ve created a group for all valves, for each valve another group and for each type of channel (valve-mode, setpoint temperature, actual temperature etc) also a group. The business logic (code for controlling) is realized in lambda and for calling this, I need the items per valve. To get these values, I’ve created nested loops with 3 levels… not really sophisticated.
Maybe I didn’t unterstand the Design Pattern but is there another possibilty for grouping items without GroupItem (static data with members of type Item, own pojo something like that)?
for explaining some sample code:
val Functions$Function3<GenericItem, GenericItem, Boolean, Boolean> someLogic
rule “control valve”
var Number tempActual = Item.getState as Number
var Number valveMode = Item.getState as Number
someLogic.apply(tempActual, valveMode …)