[SOLVED] MQTT v2 Binding with Tasmota Sonoff T1 rollershutter

Hello,

i am new at Openhab and try to find out if there a way to get rollershutter item work with the new MQTT V2 binding, using at least OH 2.5. M2 ( because rollershutter should work in this version)
There are a lot of posts how to get it work with Binding V1, but not any sample of V2.
Does anybody got this work with and could paste me a sample how to setup item and a thing ?

Welcome @ubi
There are plenty of samples for V2.

Have a look at:

This should be enough to get you started.

I highly recommend that you use the PaperUI to configure your things

Thank You @vzorglub
But this samples are not really what i am looking for, although this are very helpful discussions to understand how OH works.
I was already able to get My Sonof T1 work as switch but i had to add 2 items for Power1 and Power2 instead of one rollershutter item.

I tried to find out how to use the item and thing Rollershutter. I already found out that the Syntax of “Rollershutter” and “rollershutter” is different in things and items files because of Lowercase. But no one sample, also not in the documentation.

Also i do not really understand how to configure the thing Rollershutter to get it work propertly.

I know this are questions from a noob, but i do not see there to find more Information.
I could go and use the Binding V1 version, because there are a lot of samples with everithing you need, but is it the right way to use old system ?

When you add a channel to your Sonoff T1 thing, is there a rollershutter channel type option ?

Hi,

yes, i am not sure if i had it in Openhab2.4, but since i installed the last snapsht of OH 2.5 i can add channel rollershutter and link an item to it.

I think my problem could be, what i do not know how to setup the Thing and the Item. Do i need to use JSONPATH? If yes i get errors like:

Executing the JSONPATH-transformation failed: Invalid path '$.POWER' in 'OFF'
21:51:08.948 [WARN ] [rofiles.JSonPathTransformationProfile] - Could not transform state '100' with function '$.POWER' and format '%s'

I don’t know
What does the JSON look like?
Can you post the MQTT1 config examples that you mention.
That would help to understand the config required

Earlier you stated that you needed to have Power1 and Power2, the error complains about Power, what is actually needed?

Hello,

i fgured it out how to get this working with Sonoff T1.
First of all you would need to flash your Sonoff device with Tasmota but forked by Stefan Bode https://github.com/stefanbode/Sonoff-Tasmota because it will be easier later, as this fork support values from 1-100.

I used PAPER UI like suggested from Vincent, but this is not a really good way if you need support, as you would have always need to post screenshots instead of code.
So here some Screenshots:

a) Install MQTT Binding from Addons
b) Add an MQTT Broker with username and passwort ( “Show More” Button)


c) Make sure your sonoff device can connect to this broker.
I changed the topic to RWL in this sreenshot

d) Add a new MQTT Generic Thing and let it use your currently added MQTT Broker
e) Add a rollershutter channel and use SHUTTERPOSITION1 in your command topic

f) Add new item with rollershutter Type and link it to this channel

as reslut you will get an Rollershutter like this:
control

You can see in the last screenshot, that i have added a Dimmer Channel ( Percentage value) that also can work with this settings.

Using this code in your sitemap file would give you something line this:

 Frame label="Jalousien" {
    Slider item=RWL icon="rollershutter"
    Switch item=RWL mappings=[0="ZU ", 15="15%",30="30%",  78="78%" , 100=" AUF "]


You can slide or use predefined values.

Most of informations i got from openhabforum.de but it is in German, so i think it would be good to post it here for all people with the same problem.

2 Likes

Well done, please tick your post as the solution.
I will explore this tasmota fork

Excuse me, I’m triying to understand the steps. I am with a sonoff daul with Tasmota an I am trying to do the same, but I don’t understand where you use Power2.

As you can see from the screenshots above you do not need POWER1 or POWER2 if you use Stefan Bode Tasmota Fork. The reason is: Stefan Bodes Fork can work with values 0-100.

e) Add a rollershutter channel and use SHUTTERPOSITION1 in your command topic

Ok, understood. It is ok this?

Great news: Stefan Bodes code is now avaliable in Tasmota from Arendst. You would need to compile the binary from the development brunch. I tried it and it works.

there is one thing that i do not understand and would need your help:

If i try to open the shutter complete from 15 back to 0 the icon on sitemap looks like complete closed rollershutter. and i have following in log:tail:

22:34:13.635 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'RolloEZ' received command 0
22:34:13.639 [INFO ] [arthome.event.ItemStatePredictedEvent] - RolloEZ predicted to become 0
22:34:13.644 [INFO ] [smarthome.event.ItemStateChangedEvent] - RolloEZ changed from 15 to 0
22:34:14.370 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'RolloEZ' received command 0
22:34:14.374 [INFO ] [arthome.event.ItemStatePredictedEvent] - RolloEZ predicted to become 0
22:34:18.374 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'RolloEZ' received command 100
22:34:18.379 [INFO ] [arthome.event.ItemStatePredictedEvent] - RolloEZ predicted to become 100
22:34:18.384 [INFO ] [smarthome.event.ItemStateChangedEvent] - RolloEZ changed from 0 to 100

Why does the item change from 0 to 100? In real the shutter do not move to 100, it stays open. I can only see the value 100 in the log:tail and on sitemap - the icon looks like closed shutter.

Where could i search for more logs? I checked MQTTFX and the result of Shutter1 is 0, not 100.

You can see on this picture what i mean, in real the shutter is open and the MQTT says it is 0.

.closed%20icon

Where does this come from? (5 seconds after you first command 0)

autoupdate sees that command 100, and applies its prediction of a 100 state result.

Thank You rossko, i found the error. I had 2 channels: Rollershutter and dimmer, and one of them had the wrong state topic: it should be stat/RWL/SHUTTER1 but i had: stat/RWL/POWER1

16:26:37 SHT: Start shutter in direction 1
16:26:37 MQT: stat/RolloEZ/RESULT = {"POWER1":"ON"}
16:26:37 MQT: stat/RolloEZ/POWER1 = ON
16:26:37 MQT: stat/RolloEZ/RESULT = {"ShutterPosition1":0}
16:26:37 MQT: stat/RolloEZ/SHUTTER1 = 0
16:26:37 MQT: stat/RolloEZ/RESULT = {"POWER1":"OFF"}
16:26:37 MQT: stat/RolloEZ/POWER1 = OFF

This last “OFF” was interpreted as 100, thats why it was predicted to be 100 but didnn’t changed the cmnd topic to 100.

Hi David,

you got it to work like this? i´m trying the same. Can you post your THING file?
Or did someone else do it via file and not via PaperUI?

best regards

Hi Ubi
Thanks for the post, I too am battling with Sonoff-Tasmota and OpenHAB. I have a Ubuntu 18.04.3 with OH 2.5.0-1
I followed the steps to install the embedded MQTT broker, it installed moquette


I installed the MQTT Binding too

and although I am not sure if I need it, I installed the JSON transformation
Continuing, I created a generic MQTT thing

and configured it

This is where I run into issues, I set up the channels with commands which work when entered on the sonoff console but there is no activity on the item in Paper UI

Here’s the sonoff MQTT configuration

In your explanation you lose me at step (e) - is SHUTTERPOSITION1 a made up command?
(f) where do you create the item with rollershutter type, is the another generic MQTT thing?
and how do you link the channel to the JSONpath transformation?
more information would be greatly appreciated.

Hi,

In my Setup the Goal was to get Rollershutter close and open or to Bring it to the specific position like 44% for example.

You use another sonoff Part. It looks like tempera tursensor.
You would not need the firmware from Stefanbode.

Just for Information:. The commands you Type in the console are Not Always mqtt commands.
I think status8 from your Screenshot ist Not a command.

Install mqttFX. And Test this First. So you will find out which mqtt states and commands you need.

And do Not forget to use the Log:tail from openhab Log. So you could better Inderstand If commands from sonof reach the mqtt Broker and how openhab Interpret your commands.

Thanks Ubi

I figured it out, problem was in the command syntax and JSONPATH transformation. All fixed now.