[SOLVED] Unset DateTime item

I want to unset a DateTime item. I have an item containing an alarm clock. If the alarm is canceled before executed, the item should be unset. Setting it to 0 seems wrong to me as it is a valid timestamp.

Also see https://github.com/openhab/openhab-android/issues/1737 for more information.

$ curl -X POST --header "Content-Type: text/plain" -d "UNDEF" "http://openhab8080/rest/items/AlarmClock" --silent
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 400 Bad Request</title>
</head>
<body><h2>HTTP ERROR 400</h2>
<p>Problem accessing /rest/items/AlarmClock. Reason:
<pre>    Bad Request</pre></p><hr><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.4.18.v20190429</a><hr/>

</body>
</html>

Does UNSET only work for a subset of items?

Try that:

curl -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "UNDEF" "http://openhab8080/rest/items/AlarmClock/state" --silent

Thanks! That works.

I used the REST API interface to generate the curl command

1 Like

(The difference is that you cannot send command UNDEF, that would be a nonsense, like shouting “do something!”.)

1 Like