Set Item state to Undefined via REST

I have a storm tracking system that uses the REST API to update a Location Item and outputs a null value when it loses the location of the storm it is tracking. I want to be able to set the Location Item to undefined so that I am not displaying an out of date location and can activate a rule when the track disappears.

I’ve tried all types of combinations of undef/undefined/null/NULL I can think of but the API just returns an invalid API call error.

Is there any way to set a Location Item to undefined using the REST API?

As ever with openHAB, bear in mind that commands and states are different things.

You cannot command NULL, that would be silly. “Do something but I won’t tell you what”

You can update to NULL (but in my view should not - NULL is kinda reserved for a new-born Item that has never had any value, yet).

You can update to UNDEF to indicate a problem fetching or calculating a meaningful value. This is what some bindings do e.g. in response to an error. This is probably what you want.

You cannot command UNDEF, silly again.

NULL and UNDEF are predefined state types like ON, but that can be found in any Item type state.

1 Like

Thanks. That helped solve my problem. I was using POST to send the value which equates to command. Using PUT instead does an update and will accept UNDEF with the desired result.