Hi @Bastler36,
you need for each rollo to drive own set on items:
Rollo-Schalter.items
// Rollo WC
Switch RolloWCHi { channel="plclogo:pulse:Logo8_3:VB100_2:state" } // pulse to start Rollo up
Switch RolloWCDo { channel="plclogo:pulse:Logo8_3:VB102_6:state" } // pulse to start Rollo down
Switch RolloWCHiActive { channel="plclogo:digital:Logo8_3:Outputs:Q2" } // Logo relay for motor up
Switch RolloWCDoActive { channel="plclogo:digital:Logo8_3:Outputs:Q3" } // Logo relay for motor down
Number RolloWCPosition (RolloPositions) { channel="plclogo:memory:Logo8_3:VW27:value" } // rollo's position (0% for completely open, 100% completely closed)
Rollershutter RolloWC "Rollo WC" <rollershutter>
// Rollo Haustechnik
Switch RolloHaustechnikHi { channel="plclogo:pulse:Logo8_3:VB101_2:state" } // pulse to start Rollo up
Switch RolloHaustechnikDo { channel="plclogo:pulse:Logo8_3:VB101_4:state" } // pulse to start Rollo down
Switch RolloHaustechnikHiActive { channel="plclogo:digital:Logo8_3:Outputs:Q4" } // Logo relay for motor up
Switch RolloHaustechnikDoActive { channel="plclogo:digital:Logo8_3:Outputs:Q5" } // Logo relay for motor down
Number RolloHaustechnikPosition (RolloPositions) { channel="plclogo:memory:Logo8_3:VW29:value" } // rollo's position (0% for completely open, 100% completely closed)
Rollershutter RolloHaustechnik "Rollo Haustechnik" <rollershutter>
We can combine all Position Items in a group and use then “string-crunching”
Rollo-Schalter.rules
rule "RolloPositionsReceivedUpdate"
when
Member of RolloPositions received update
then
var Number value = newState as Number
val String name = triggeringItem.name.replace("Position","")
val RollershutterItem item = ScriptServiceUtil.getItemRegistry?.getItem(name) as RollershutterItem
item.postUpdate(Math.max(Math.min(value.intValue, 100), 0)) // return a number in the range of 0 to 100.
end
Attension: Examples above may contain syntax error: I copied and adapted the stuff from different rules
See my initial post, this tutorial is based on, for theory of operation.
Kind regards,
Alexander