Thing mqtt:topic:mosquitto: AC "AC" (mqtt:broker:mosquitto) []
{
Type number : TargetTemp "Target Temperature" [ stateTopic="AC/target_temperature/state", commandTopic="AC/target_temperature/command", unit="°C"]
}
Most of the time the updates are between 16 to 34. The problem starts when occasionally the update is NaN.
I would like to create a transformationPattern that ignores such updates and keeps the previous value.
Do you need a range filter, which accepts input of, say, 10, or 100, or do you need numeric validation filter, which will accept 10 and 100 but rejects NaN?
I haven’t tested it but I’d imagine NaN wouldn’t be accepted by the mqtt binding anyway?
You could use REGEX:\d+ (if you don’t receive decimal points) which would silence the NaN warning. REGEX:\d+(\.\d+)? to allow decimal points. Use min/max options to filter out unwanted range if required, but that’s a separate thing.
Thanks, where do I put the REGEX?
I tried to add it to the channel:
Type number : TargetTemp "Target Temperature" [ stateTopic="AC/target_temperature/state", commandTopic="AC/target_temperature/command", unit="°C", transformationPattern="REGEX:(\d+)"]
But I got below error:
[WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'mqtt.things' has errors, therefore ignoring it: [165,264]: mismatched character 'd' expecting set null