[SOLVED] MQTT and dimmer / slider control

MQTT and dimmer / slider control

I have some blinds that are controlled by an arduino. The arduino publishes the actual blind position (/devices/shutter/blind1/position) and waits at /devices/shutter/blind1/targetpos/set for an mqtt message with a number between 0 and 100, which is the new target position it will have to go. After receiving new target arduino will publish this target at /devices/shutter/blind1/targetpos. During moving the arduino publishes every second the actual position at /devices/shutter/blind1/position.

With this behavior I can set target positions by sending a target value via mqtt and follow movements by watching /devices/shutter/blind1/position. Now I want to add openhab2:

item:
Dimmer blind1 “[%.1f %%]” {mqtt="<[hctl2:/devices/shutter/blind1/position:state:default], >[hctl2:/devices/shutter/blind1/targetpos/set:state:*:default]"}
Remark: I also tried Number instead of Dimmer

sitemap:
Slider item=blind1 label=“Blind 1”

My problem is:
If I tap the slider at new target (let assume 80%, actual position is 0), openhab2 publishes value 80 at /devices/shutter/blind1/targetpos/set. It is acknowledged from arduino at /devices/shutter/blind1/targetpos with 80 too and my blind1 starts moving. But after one second the new actiual position ist published by arduino with value (lets assume 3.4) at /devices/shutter/blind1/position. Now Openhab2 is reading this value and moves the dot on the slider to this position (wanted behaviour). But now this position is also published by Openhab2 at /devices/shutter/blind1/targetpos/set and my arduino stops movement, because new target is already reached.

I think, publishing the intermediate position is because of the part “>[hctl2:/devices/shutter/blind1/targetpos/set:state:*:default]” in my item definition. But if I omit this part, I can only watch position / movement of blind1. I’m looking for a possibility to watch the actual position and to set new target via tapping without setting new targets by regular position updates.

Does anyone have a solution to this?
thanks

Use a command for the outbound:

Dimmer blind1 “[%.1f %%]” {mqtt="<[hctl2:/devices/shutter/blind1/position:state:default], >[hctl2:/devices/shutter/blind1/targetpos/set:command:*:default]"}

Thanks a lot - it works like a charm.