MQTT sendCommand(100) sending 100,000000 after last update

Tags: #<Tag:0x00007fc1fe076788>

Hi everybody,
I am experiencing an odd behave since the last update a few days ago.
I use a fhem installation to control my DUOFern devices (accepting only int values).
I send an integer value with item.sendCommand(100) to MQTT and MQTTfx shows 100,000000 as the value which is not working at the subscriber side of the game.
My installation worked until a few days ago. I updated openHABian at that day only…

fhem.items

Number Rollo_EG_WZ_GFenster_position			"Position: [%d %%]"							<rollershutter>		{channel="mqtt:topic:mybroker:Rollo_EG_WZ_GFenster:position"}
String REGWZGF_Pos								"Positionen"								<rollershutter>
Switch REGWZGF_Stop								"Stop senden"													{channel="mqtt:topic:mybroker:Rollo_EG_WZ_GFenster:stop"}

rollershutter.rules

rule "REGWZGF Position" // EG großes Wohnzimmerfenster
	when
		Item vS_REGWZGF received command
	then
		switch receivedCommand 
		{
			case "open": {Rollo_EG_WZ_GFenster_position.sendCommand(0)}
			case "close": {Rollo_EG_WZ_GFenster_position.sendCommand(100)}
			case "stop": {REGWZGF_Stop.sendCommand(ON)}
		}
end 

phone.sitemap

Switch		item=vS_REGWZGF			label="Position"		mappings=["open"="Öffnen", "close"="Schließen"]
Text								label=""				icon=""
Slider		item=Rollo_EG_WZ_GFenster_position		label="Position"		

It does not matter if I choose an option of the switch item or I use the slider… every value will be logged as an integer in the logs but sent to MQTT as float (even a 0 will be 0,000000).

Does anybody know how to come back to integer?

Thanks a million!

I do not use roller shutters but what happens if you change this part

Number Rollo_EG_WZ_GFenster_position			"Position: [%d %%]"	

to

Number Rollo_EG_WZ_GFenster_position			"Position: [%d ]"	

omitting the two %%?

That wouldn’t change the value that the binding sees and sends.

Is the value always between 0 and 100? If so, use a Dimmer instead of a Number. Dimmer stores a PrecentType which forces integers.

1 Like

As many topics as I’ve read I should have known that. :unamused:

Starting to think I need to get some roller shutters :grin: just to test with as it seems a hot topic in the community.

As always thanks for helping me help and keeping me stright. :grinning:

That makes the difference!!
Thanks so much!

If you use Paper UI for the channel definition, you can also change the attribute “Outgoing value format” to “%0.f” of the channel.

Hi Ulf,
if I am able to avoid config GUIs with text based files, I do so (in this I am a bit of a conservative, old fashioned guy :sunglasses:). Text based files usually offering much more flexibility.
But as far as I understand the “&d” should do the same in text based configurations… or do I miss something here?

Thanks to all of you for supporting me!

Hi,
to define my Items in files I’m old fashioned too, but not for the mqtt things, but everyone his :grinning:
I tested %d in my Paper UI configuration and it works the same way there.
I think the two variants are comparable.

Have a nice sunday!