Hi,
I have problem mapping the position value from a rollershutter to a MQTT number.
There are two items defined, a Number and a Rollershutter:
Number NumberRoller "" { channel="mqtt:topic:MqttBroker37:NumberRoller:numberRoller" }
Rollershutter RollerRoller "" { channel="mqtt:topic:MqttBroker37:RollerRoller:rollerroller" }
With the corresponding identically configured topics in the MQTT bridge
Bridge mqtt:broker:MqttBroker37 [ host="localhost", secure=false ]
{
Thing topic NumberRoller {
Channels:
Type number : numberRoller "" [
stateTopic="test/numberroller/0/pos",
commandTopic="test/numberroller/0/command/pos"
]
}
Thing topic RollerRoller {
Channels:
Type number : rollerroller "" [
stateTopic="test/rollerroller/0/pos",
commandTopic="test/rollerroller/0/command/pos"
]
}
}
And a basic sitemap showing both items as the default view and a slider
sitemap site label="sitemap"{
Frame label="Number" {
Default item=NumberRoller
Slider item=NumberRoller
}
Frame label="Rollershutter" {
Default item=RollerRoller
Slider item=RollerRoller
}
}
Both sliders on the sitemap have a [0…100] range, setting the the corresponding item to values from 0 to 100, as expected. The default view of the item (Number and Rollershutter) show the expected values between 0 and 100.
When I look at the MQTT messages that are generated by using the sliders I get values from 0-100 from the Slider using the Number item and values from 0-1 (!) from the slider using the Rollershutter item.
In the other direction, when an MQTT message with values from 0-100 is received by the channel of the Number item it updates the item as expected. Sending a message with a number larger that 1 to the channel connected to the Rollershutter item result is an exception (IllegalArgumentException: Value must be between 0 and 100).
It seems to me somewhere along the line there is a transformation from the [0…100] range of the rollershutter to a [0…1] range used in MQTT and vice versa. This transformation is not present when using the number item.
How do I get rid of that transformation to get a [0…100] range in the MQTT state and command topic?
I know I can use a transformation pattern on the state topic, but AFAIK there is no such thing for the command topic. Also it seems a little weird that I have to transform back to the range the Rollershutter is using itself (at least for display).
Thanks a lot,
Lars