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:
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: