Show opening percentage on RollerShutter item and invert RollerShutter value

Hello everyone,
after some hours of trying I gave up and finally signed up to this nice forum.
Maybe you can help me on my 2 issues.

I have a shutter connected to a Shelly 2.5 with Tasmota flashed. It is working really nice via MQTT: UP, DOWN, STOP.
The only issue is that the RollerShutter item is not receiving the position from the shutter.

It is not showing the opening percentage in the sitemap and doesnt dynamically change the icon.
Basically it stays like this:
grafik
I would like it to show the percentage instead of “-” and change the icon according to the percentage.

Second issue is that the opening percentage between Tasmota and openHAB is inverted,
eg. Fully Open => openHAB 0% <=> Tasmota 100%.
Can i invert the openHAB number easier without using the JavaScript below?

Best regards
Patrick

  • Platform information:
    • Hardware: RPi4, 4GB on external USB SSD
    • OS: openHABian
    • openHAB version: 2.5.3

The incoming MQTT message looks like this:

EG-Badezimmer-links/stat/SHUTTER1 80
  • Things configuration related to the issue
    Thing topic egbathroomshutter1 "Badezimmer Rolladen links" @ "Badezimmer" {
    Channels:
        Type rollershutter : rollershutter          "Badezimmer Rolladen links"           [stateTopic="EG-Badezimmer-links/stat/SHUTTER1", commandTopic="EG-Badezimmer-links/cmnd/ShutterPosition1", retained=false, transformationPattern="JS:rollershutter.js", transformationPatternOut="JS:rollershutter.js"]
        Type string : status                        "Badezimmer Rolladen links Status"    [stateTopic="EG-Badezimmer-links/tele/LWT", retained=false]
    }
  • Items configuration related to the issue
Rollershutter GF_Bathroom_Shutter1 "Rolladen links %d%%" <rollershutter> (GF_Bathroom, gShutter) ["Rollershutter"] {channel="mqtt:topic:mosquitto:egbathroomshutter1:rollershutter", autoupdate="false"}
  • Sitemap configuration related to the issue
Default item=GF_Bathroom_Shutter1 label="Badezimmer links"
  • JavaScript code related to the issue: rollershutter.js
(function(i) {
	if (isNaN(i)) {
		return (i);
	}
	return(100-i);
}) (input)
  • If logs where generated please post these here using code fences:

Which version of Tasmota do you use?

When using the current release 8.2 with built in shutter support (no more need to self compile), there is a parameter to invert the shutter. The mqtt command is cmnd/%topic%/shutterInvert1 1 where %topic% is the device specific topic

1 Like

label=“Badezimmer links [%d%%]”

1 Like

I also like using “Slider” in the sitemap. It lets me move it directly to the desired position.

1 Like

Thank you for your replies.
That solved everything.
I am using Tasmota 8.3 so it was really convenient to implement the shutter.
I inverted the shutter now and I read on the manual that this is a standard for knx so I have to get used to it if I implement it in the future.
The label is working too and I have the slider now, too.
Thanks again but I can only pick one post for solution.