That’s what you get when you call .state. But when you call .numericState or .quantityState you get null back if the state of the Item is not a Number or a QuantityType. As far as I know this is how .numericState and .quantityState has always worked so it’s odd this code worked before. It shouldn’t have ever worked.
Show that code. .state always returns the state of the Item as a String. It never returns null.
The old behavior with .numericState and .quantityState was incorrect. They always should have returned null when the Item’s state was NULL or UNDEF. But .state should always return the state as a String, even if it’s NULL or UNDEF so that is a regression.
In the mean time you can work around the problem by installing the openhab node module and toggling on “Do not cache…” in the JS Scripting settings. Then edit $OH_CONF/automation/js/node_modules/src/items/items.js and remove the line that calls _isNullOrUndefined(rawState) from _stateOrNull. It should be around line 27. The function should look like:
function _stateOrNull (rawState) {
if (rawState === null) return null;
return rawState.toString();
}