rule "Substitute internal vars according contact states"
// internal items: Kurenie_Mod, Kurenie_Plamen
// KNX items. Kurenie_Status, Kotol_Mod
when
System started or
Item Kurenie_Status changed
then
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
end
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.
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.
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
when
System started or
Item Kotol_Plamen changed or
Item Kotol_Mod changed
then
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)
end