Set contact item with http post request

Hi,
I am using a python script on my pi with executes

/usr/bin/curl --header “Content-Type: text/plain” --request POST --data “OPEN” http://ip:8080/rest/items/foo
but this causes this error in openhab.log
[WARN ] [o.i.r.i.resources.ItemResource] - Received HTTP POST request at ‘items/foo’ with an invalid status value ‘OPEN’.
In default.item:
Contact foo “Garage is [MAP(en.map):%s]”

Why is “OPEN” invalid? Is it possible to change Contact items with a http post request?

You can update the state of a Contact item, but you cannot command it to open or close (Door/window contacts are passive sensors.) Either switch to a Switch item, or update the state only, using PUT instead of POST (examples).

2 Likes