I would be very surprised if this has ever worked.
The Events: state node has a conditional “If State” test, which you are using.
You have set the condition test to >= which is a [numeric] state-value comparator, against the literal value in the following field.
You have set the value-field to use the JSONata expression, which is returning an object. Something like {"temperature": 27}
The bit inside the JSONata expression is most likely working as you intended. The $entities() function gets the entity object for the pool-target-temperature, and then the state value is converted into a number.
First issue would be when the entity state is “unknown” or “unavailable”. The $number() function in JSONata fails with a terminal error if the function is given a string that cannot be parsed as a number.
Second issue would be the node attempting to compare the pool heater entity state value against the object. Regardless of whether you have the [deprecated] state casting set or not, the subject entity state value being either a number or a string, you are comparing
27 >= {“temperature”: 27} or
“27” >= {“temperature”: 27}
and the node is saying
as the node internal processing cannot turn the RHS object into a number / string at this point.
Further:
Sorry, no. This is only the Output Properties, which is for the output message and has nothing to do with the internal node operation.
To correct this, you need to retain the “Pool Heater: Water temperature” entity state as a string, and perform the entire test within one JSONata expression. Note that the comparator “>=” does not always work for string values representing un-formatted numbers. “3” comes after “21”, unfortunately.
So, if you were to set the “If State” comparator test to “JSONata”, then the following field, holding a JSONata expression, must evaluate to true / false, with true being the “If State” succeeds result.
A full expression would be
$number($entity().state) >= $number($entities("input_number.pool_target_temp").state)
which obtains the state value of the node subject entity (Pool Heater - Water Temperature), as well as the state value of the pool-target-temperature. Converting both to a number means the logic test >= will return a Boolean value from the expression.
However, if either entity state is “unavailable” or “unknown” then the $number() function fails. A bit of extra code can address this, returning false overall, assuming that that is the fallback result you wish for.
(
$pool:=$entity().state;
$target:=$entities("input_number.pool_target_temp").state;
$pt:= $pool in ["unavailable", "unknown"] ? 0 : $number($pool);
$tt:= $target in ["unavailable", "unknown"] ? 100 : $number($target);
$pt >= $tt;
)
The general principle is to return true if pool temperature is >= target temperature, with the pool temperature resorting to 0 and the target temperature to 100 if either entity state value is unavailable or unknown. You can choose your own numbers to suit your situation.
This code has been tested as far as I am able to.