[SOLVED] Help for if rule with Contact Items

please correct me in this situation. Thanks.

rule "Substitute internal vars according contact states"
// internal items: Kurenie_Mod, Kurenie_Plamen
// KNX items. Kurenie_Status, Kotol_Mod
    System started or
    Item Kurenie_Status changed 
    if(Kurenie_Status.state == OPEN) Kurenie_Plamen.postUpdate(OPEN)  //not working help please
    Kurenie_Mod.postUpdate(if (Kurenie_Status.state == OPEN) Kotol_Mod.state as Number else 0) //OK

What type of item is Kurenie_Plamen and what do you see in the logs when the rule fires?

does this really work?


Kurenie_Mod.postUpdate(if (Kurenie_Status.state == OPEN) (Kotol_Mod.state as Number).intValue else 0)

I run into a problem if I do not use it this way if the type of the item is not clear. Maybe the “else 0” part lead OH to know that “Kotol_Mod.state as Number” is of type int.

internal items no binding address:
Number Item Kurenie_Mod 1-100%
Contact Item Kurenie_Plamen 0/1

KNX binding items.
Contact Kurenie_Status 0/1
Number Kotol_Mod 1-100 %

If this is a 0/1 then you may need to use MAP transformation to transform the 0/1 to OPEN/CLOSED.


Contact Kurenie_Status  "Door [MAP(contact.map):%s]"

map cfg file:


0/1 means OPEN/CLOSED

Your rule is looking for item state OPEN not 0. Use the transformation or change the rule.

if(Kurenie_Status.state as Number == 0)

EDIT: The item is labeled as a Contact and should work with OPEN/CLOSED. For some dumb reason I was relating this to a motion sensor with an Item Number type. Sorry for the confusion.

When the rule runs are you seeing any error messages in the logs? If so please post these messages.

Thanks, now it works without mapping

rule "Copy status and value" 
// status from real Contact Kotol_Plamen to internal Contact Kurenie/Ohrev_Plamen if Contact Kurenie_Status == OPEN
// value from real Number Kotol_Mod to internal Number Kurenie/Ohrev_Mod if Contact Ohrev_Status == OPEN
    System started or
    Item Kotol_Plamen changed or
    Item Kotol_Mod changed
    Kurenie_Plamen.postUpdate(if(Kurenie_Status.state == OPEN) Kotol_Plamen.state else CLOSED)
    Kurenie_Mod.postUpdate(if (Kurenie_Status.state == OPEN) Kotol_Mod.state as Number else 0)
    Ohrev_Plamen.postUpdate(if(Ohrev_Status.state == OPEN) Kotol_Plamen.state else CLOSED)
    Ohrev_Mod.postUpdate(if (Ohrev_Status.state == OPEN) Kotol_Mod.state as Number else 0)