Number wled_FX "FX" {channel="mqtt:topic:wled:W_Effect"}
Things file:
Thing mqtt:topic:wled "Wled" (mqtt:broker:689cb32c)
{
Channels:
Type number : W_Effect "WLED Effect" [ commandTopic="wled/80da2c/api" ]
}
openHAB 2.5.2 Release Build
When I use selection tool in basicUI it should send “0” or “1” or “2” or “3”
to MQTT Broker “wled/80da2c/api” topic.
BUT!!! I receive in broker “0.000000” or “1.000000” or “2.000000” or “3.000000”
Tell me plz is it an issue, or it just i did something wrong?
…No errors in logs and with openHAB 2.5.0 Release Build was OK.
I’m just interesting where does it gets from “.000000” ??
Can you check selection tool with mqtt on your system? Same behavior?
And why it was OK on previous releases?
Because this problem appeared only with updating to 2.5.2 (((
I think the MQTT binding treats all Number type channels as floating point. You might be able to use the “Outgoing Value Format” field with %d or %.0f to strip off the decimal places.
Or you can use a Percentage value type channel instead which uses PercentType which only supports integers.
I’ve tried like this: “Outgoing Value Format” …in MQTT binding it calls “formatBeforePublish”, but it doesn’t help((
MQTT channels doesn’t have “Percentage” type channel, I’ve tried “Dimmer” type, but it also published like this: 1.0, 2.0, 3.0, and so on(((
You could try an outgoing transformation or maybe use a String instead of Number. It seems you are not doing math with these, just mapping a selection. It goes out on the MQTT message as text anyway.