[SOLVED] Problem with dezimals in value openhab 2.5.1 and 2.5.2 (mqttv2)

i have installed version 2.5.0 again, with this version its working fine again

Perhaps you only needed to restart OH a few times for everything to work correctly. I restarted 3 time plus one reboot before all was good after update from 2.4 stable. Anyway, glad you have it working and please click square box with solution to mark topic as solved.

Thanks

it is solved for me now, but i cant go to the latest version (2.5.1).
that’s a shame because I don’t get to the last versions of the bindings if this problem stay.
maybe its a bug in OH 2.5.1, because it is defined in the sitemap that it should increase in 0.5 steps, but this does not happen.

I will do more tests

I’m sure I saw some changes in github at least partly related to this … from memory, folk were getting “7E1” payloads instead of “70”. This is in the same area, so I think it may be worth trying the most recent snapshot.

As @rossko57 mentioned you can try the recent snapshot. For an apt based install here is the commands (per the docs) to move from version to version.

Apt Based Systems

Upgrading is as easy as:

sudo apt-get update
sudo apt-get upgrade

You may want to switch to a different repo, or an older (but more stable) version of openHAB. To do this, simply select the repo as in the installation instructions above, then find the version by bringing a list of all versions available to install:

sudo apt-get update
apt-cache showpkg openhab2

Once you know which version you want, you can upgrade/downgrade to it by using the apt-get install openhab2=[version] command, for example:

sudo apt-get install openhab2=2.1.0-1

When you run the showpkg command, like above, you should have a full list to choose from. Pick the one you want and enter it like described in the last command.

1 Like

i have read something on github that some has a simmilar problem, so i will close this, it looks like there is a bug.
i will try the next release :slight_smile:

the problem is also on 2.5.2!
What i have tried.

i have tried to tranform the output with formatBeforePublish="%.1f" :

Type number : temperature "Temperature" 		[ stateTopic="zwave2mqtt/Schlafzimmer/Thermostat_Schlafzimmer/thermostat_setpoint/heating_1", transformationPattern="JSONPATH:$.value", commandTopic="zwave2mqtt/Schlafzimmer/Thermostat_Schlafzimmer/thermostat_setpoint/heating_1/set", formatBeforePublish="%.1f"]

than i get the value 20,5, but i need a 20.5, with a point instead of a comma .

@David_Graeff can you help me, is something changed this way since 2.5.0 in the mqtt binding?

Try this:

Type number : temperature "Temperature" 		[ stateTopic="zwave2mqtt/Schlafzimmer/Thermostat_Schlafzimmer/thermostat_setpoint/heating_1", transformationPattern="JSONPATH:$.value", commandTopic="zwave2mqtt/Schlafzimmer/Thermostat_Schlafzimmer/thermostat_setpoint/heating_1/set", transformationPattern="JSONPATH:$.value", formatBeforePublish="{\"value\":%.1f}" ]

thank you, but i also get a value with comma :frowning:

2020-02-22_18h06_43

and this is from the stateTopic when i push the button on the thermostat:
2020-02-22_18h06_58

so its required this point. :frowning:

bevore it was working with the step=0.5 setting in the thing file

in the item file the transformation with %.1f is working, so the problem is only with the mqtt binding

Try it with transformationPatternOut and see if that makes a difference.

Type number : temperature "Temperature" 		[ stateTopic="zwave2mqtt/Schlafzimmer/Thermostat_Schlafzimmer/thermostat_setpoint/heating_1", transformationPattern="JSONPATH:$.value", commandTopic="zwave2mqtt/Schlafzimmer/Thermostat_Schlafzimmer/thermostat_setpoint/heating_1/set", transformationPattern="JSONPATH:$.value", transformationPatternOut="{\"value\":%.1f}" ]

You may want to try transformationPatternOut with your original config as well.

Type number : temperature "Temperature" 		[ stateTopic="zwave2mqtt/Schlafzimmer/Thermostat_Schlafzimmer/thermostat_setpoint/heating_1", transformationPattern="JSONPATH:$.value", commandTopic="zwave2mqtt/Schlafzimmer/Thermostat_Schlafzimmer/thermostat_setpoint/heating_1/set", transformationPatternOut="%.1f" ]

its the same, not working, it seems like he is not using the transformation right.

maybe we should wait for what Graeff says to this problem

One last thing to try is changing %.1f to %d.

Type number : temperature "Temperature" 		[ stateTopic="zwave2mqtt/Schlafzimmer/Thermostat_Schlafzimmer/thermostat_setpoint/heating_1", transformationPattern="JSONPATH:$.value", commandTopic="zwave2mqtt/Schlafzimmer/Thermostat_Schlafzimmer/thermostat_setpoint/heating_1/set", transformationPatternOut="%d" ]

also not, no value is sending with this transformationPatternOut function when i bush the up ore down button of the setpoint

I’ve been looking at issues on github and seem you may need to use a JS transformation as a workaround until there is a fix.

JS transformatioin I found as the workaround:

(function(i) {
    if(isNaN(i)) return -1; // choose an appropriate error value
    return Math.round(i)
})(input)

1 Like

what could be the reasen if the output is -1?
This happens now, the thing is a number and should work

i found also this on github #6566, the value in the contribution is with a point :neutral_face:

Mqtt has not changed. The local for the system is taken into account for decimal value parsing and output (english local: “.”, german local “,” for example). That’s not ideal, but internally the standard java API is used which is local aware.

Either use a javascript script, or a second transformation (regex) to replace commas into dots, would be my advice. Maybe someone else has a smarter idea.

2 Likes

Hi David, nice to see you around :+1:

do you mean the preferences setting in the paperui?
ore the settings in the linux system?
then i will change it to english, this should not be the problem.
currently i use the docker version, and there i see LANG and LC_ALL is de_AT.UTF-8.

thank you very much for this info, now its working again, i have changed all settings in docker to en_US.UTF-8 :slight_smile: