Set Contact by Switch

Hi all,
I am new with OpenHAB and I’m checking some basic stuff out but it seems not working and i don’t know why.

I’ve defined two Items:

Contact CT_EG_Wohnzimmer "Contact Wohnzimmer" 
Switch SW_EG_Wohnzimmer	"Schalter Wohnzimmer"	

an Sitemap:

sitemap Haus label="Hauptmenue"
{
  Frame {
			Default item=CT_EG_Wohnzimmer
			Default item=SW_EG_Wohnzimmer
        }
}

and a small Rule which should change the state of the contact to open when the switch state is changed but it doesn’t work.

rule "Tuer_Alarm"
when
	Item SW_EG_Wohnzimmer changed 
then
	CT_EG_Wohnzimmer.sendCommand(OPEN)
end

I’ve get the following error: “The method or field CT_EG_Wohnzimmer is undefined”

What i’ve doing wrong?

Thx to all

Hi again, found it out by myself.

rule "Tuer_Alarm_ON"
when
	Item SW_EG_Wohnzimmer changed to ON
then
	postUpdate("CT_EG_Wohnzimmer","OPEN")
end

This works

Switch SW_EG_Wohnzimmer "Schalter Wohnzimmer[%s]"
Contact CT_EG_Wohnzimmer “Contact Wohnzimmer[%s]”

rule "Tuer_Alarm"
when
Item SW_EG_Wohnzimmer changed
then
if (SW_EG_Wohnzimmer.state == ON) {postUpdate(CT_EG_Wohnzimmer,“CLOSED”)} else {postUpdate(CT_EG_Wohnzimmer,“OPEN”)}
end

Please be aware that a contact item is per definition a read only item, so there is no .sendCommand() method. But there should at least be a .postUpdate() method, so this should also work:

rule "Tür Alarm"
when
    Item SW_EG_Wohnzimmer changed
then
    CT_EG_Wohnzimmer.postUpdate(if(SW_EG_Wohnzimmer.state == ON) OPEN else CLOSED)
end