OH3: Transform States from Contact to Switch within Groups

I would like to build within items (within gui, no script/rules) a hierarchy, between Contact and Switch items as well as within group hierarchy


  1. Transformation between Contact and Switch
    Contact: window OPEN or CLOSED
    Switch: Lamp ON or OFF > State Description, options: ON=OPEN, OFF=CLOSED

“Command options” not working

  1. Group hierarchy between windows and lamp
    Group: wdw_lamp; member base type: Contact; Aggregation function: All OPEN then OPEN else CLOSED

works only after manual saving the group item wdw_lamp within gui

Group hierarchy:
Group wdw_lamp with item/group heating valve as Contact (OPEN, CLOSED)

works not, because follow of (A) error?

What is the best and error free way to do that?

Not sure what you expect that to do. “Transforming” on/off to open/closed at the GUI for display is not going to affect how the Item state really is back at the server.

I would like to build a boolean hierarchie:

wdw_lamp_valve (open/closed) : =
(wdw_valve (open/closed) := wdw AND valve) OR Lampe (on/off)

How to transfer the value from lamp from (on/off) to (closed = on, open = off),
but not with script/rule?

You can’t. Contact type Items are only allowed to take states OPEN/CLOSED, Switch type Items are only allowed to take states ON/OFF.

You can make Groups of mixed Item types. You don’t have to use group aggregation functions, but if you do, the functions do not deal with all possible combinations.

Could you tell us what end result you are looking for, rather than tell us what doesn’t work?

Guessing you want to know if any lights are on or windows open, try this -
Make a number Group of lights, function to COUNT lights ON
Make a number Group of windows, function to COUNT windows OPEN
Make a switch or contact type Group of those two Groups, function to NOR OFF or OPEN as required.
(this exploits an internal cheat where OFF equivalent to “0” etc.)

Thanks, I will try the turnaround to number group - will give feed back later

One understanding question in an example, to build a number group via “Einstellungen” “Items”:
I have two KNX-based valve (normaly 1 bit, so CLOSED/OPEN) as items (valve_1, valve_2); if I build a number group “valve_bath” and select the two valve, I could not define COUNT for the group. It is only possible to declare them in the item DSL?

It’s a GUI limitation.

There’s a way to import a text-style definition in the GUI, you do not have to use xxx.items files.

Thank you very much for helping. It works!
But I need an easier function to invert a switch item (at the moment I using one group with NAND): ITEM lamp ON/OFF => OFF/ON for the COUNT(ON)-Number Group

You can make a Group with COUNT(OFF) as well, with different membership.

Or you can make another dummy Item and perhaps if your original data source is a binding channel, use a profile to invert.

I’ve never understood the lengths people got to to avoid using rules, they don’t cost anything.