I receive values from my watermeter using AI on the edge. In case there are invalid values, the MQTT sender sends empty values. This is correct behavior from my point of view. Nevertheless I receive the following warning. Any idea how to fix this to have a clean log?
2024-03-12 17:46:23.261 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '' from channel 'mqtt:topic:watermeter:Zaehlerstand' not supported by type 'NumberValue': null
You can use a REGEX transformation that only matches numbers.
REGEX:([\d]+)
If it’s anything else beyond one or more digits the message will be ignored without warning. If you need to support negative signs or decimals or units of course the REGEX needs to be more complicated.
No, it will still eventually be converted to a Number just like it is now.
An MQTT message always is a String. It gets converted to a Number (assuming it’s a number Channel) just before it gets sent to the Item as a command or update.
I think you need to decide if storing a value in influxDB is more important than clearing the WARN. It seems to me if you are going to convert to a number for graphing purposes, then just send that number to mqtt in the first place. Another option is to filter out the Warn with regex. Just an observation.
This is exactly what that PR is meant to address. Though note that in the context of this thread, many persistence addons (including InfluxDB) will simply ignore NULL values, and not record anything at all when an item goes to NULL (which would be the same as its current behavior in your case, if you have it set to persist on change).