Shutters amd MQTT

Hi

I’m trying to use the shutters items with MQTT, but I haven’t understand how to do it.
I found only HTTP/GET example.
I’m interested not only to UP and DOWN, but also to the STOP and % commands.

Thanks
Woody

Assuming you just want the pass the state of the Item unchanged you should be able to do the following:

{mqtt=">[broker:topic:command:*:default]"}

This will post any command sent to the Item without transform to topic on broker. If you need to convert the state to something in specific you will need to change default to a transform.

Thanks Rich

Let’s say I have a switch like this.

Switch switch2 (All) {mqtt=">[localbroker:localnet/openHAB/devices/led2:command:ON:default],>[localbroker:localnet/openHAB/devices/led2:command:OFF:default]"}

I saw in the demo pack that for the shutter the image used is this one:

With the DOWN/STOP/UP commands

What should be the Item connected to those three buttons using the MQTT protocol?

I saw that there is an item called Shutter used instead of Switch, but I haven’t understood how to use it.

Thanks
Woody

First you are mixing things. The Item type determines how the Item behaves and what sort of commands you can send to it and what sort of data it can receive. ALL interaction with MQTT is defined in the Item.

The sitemap determines how it looks and can be controlled on your sitemap. The sitemap is completely unaware of how the Item deals with the data (e.g. sending it out over an MQTT message).

Please see the Items wiki page. The Item type you are looking for is Rollershutter.

Please see the Sitemap wiki page. I think that control is a Setpoint, though use whatever sitemap element is used in the demo.sitemap.

1 Like

Thanks for the explanation.

So, if I understood well the item should be something like this:

Rollershutter itemname “labeltext” (group) {mqtt=">[localbroker:localnet/openHAB/devices/sh1:command:DOWN:default],>[localbroker:localnet/openHAB/devices/sh1:command:STOP:default],>[localbroker:localnet/openHAB/devices/sh1:command:UP:default],<[localbroker:localnet/openHAB/devices/sh1:state:default]"}

I believe so. The only warning I’d give is I have no experience with Rollershutter Items nor have I created two way MQTT Items so I can’t say for certain that would work.

You would only need to give >[localbroker:localnet/openHAB/devices/sh1:command:*:default] to let all possible commands through, instead of one for each command.

…and add , autoupdate="false" after the MQTT section so you only get state updates from MQTT, and not also from sending commands.

Hi,

I have a similar setup here. However, I would like to translate the UP and DOWN command to “1” or “2”, respectively. The openhab log shows me that the item received an UP or DOWN. However, there is no message arriving at the MQTT server. I can fake a “1” or “2” by using mosquitto_pub which works fine. At the same time Switch items work flawlessly.

What am I doing wrong. How can I debug the error?
My typical switch looks like:
Switch A_L_OG_AN1 “Ankleide” (gOG,gLichtOG) {mqtt=">[openhab:/openhab/plugin/Ads/MAIN.SW_HWOUT.A_L_OG_AN1:command:ON:1],>[openhab:/openhab/plugin/Ads/MAIN.SW_HWOUT.A_L_OG_AN1:command:OFF:0],<[openhab:/eventbus/plugin/Ads/MAIN.SW_HWOUT.A_L_OG_AN1:command:MAP(mqtt2oh.map)]"}

My Roller shutter looks like:
Rollershutter RL_SZ “Schlafzimmer Fenster” (gOG,gShutterOG) {mqtt=">[openhab:/openhab/plugin/Ads/MAIN.SW_RL.RL_SZ:command:UP:1],>[openhab:/openhab/plugin/Ads/MAIN.SW_RL.RL_SZ:command:DOWN:2]}

Best regards

It looks like you are missing the closing " on the Rollershutter item’s MQTT binding config string.

Hi,

thank you for pointing this out. I would have been happy, if it had turned out to be that simple.
However, this did not solve it. I still do not get an MQTT message. Is there a log trace for this that I could analyze? Or is there a log that would have shown me the syntax error?

BTW: There is more strange behavior to this. Maybe it is connected. Meanwhile the items lines look like this:

Rollershutter RL_SZ “Schlafzimmer Fenster” (gOG,gShutterOG) {mqtt=">[openhab:/openhab/plugin/Ads/MAIN.SW_RL.RL_SZ:command:UP:1],>[openhab:/openhab/plugin/Ads/MAIN.SW_RL.RL_SZ:command:DOWN:2]"}

Rollershutter RL_SZD “Schlafzimmer Decke” (gOG,gShutterOG) {mqtt=">[openhab:/openhab/plugin/Ads/MAIN.SW_RL.RL_SZD:command:UP:1],>[openhab:/openhab/plugin/Ads/MAIN.SW_RL.RL_SZD:command:DOWN:2]"}

I added this line to the sitemap:

Group item=gShutterOG label=“Rollläden” icon=“rollershutter”

I expected to see a line “Rollläden” with two entries. However, I see only one entry. Whichever is the first in the items file. If I swap the lines in the items file, then I see the other.

Thanks

Maybe you guys worked it out already. For the ones coming after us, the main point is to define the MQTT binding strictly in order: UP, DOWN, STOP. If you put STOP in the middle - as it would be logical for me, since the button is there - it will not work.
In the title field the [(%d)] shows the actual value of the shutters - typically “-” unitialized, 100 - down, 0 - up.

Rollershutter ShuttersBed "Bedroom Shutter [(%d)]" <rollershutter> (Log, gShutters) {mqtt=">[JagoMQTT:Shutters:command:UP:4],>[JagoMQTT:Shutters:command:DOWN:5],>[JagoMQTT:Shutters:command:STOP:6] "}

1 Like