Rollershutter HomeKit Percentage Problem

Hi there,

im using openHAB 2.5 and having problems with the displaystate of my sunblinds/awning.
When the sunblind is fully extendet, the percentage from the knx actor is at 100%

My Home App on iPhone does show the Icon of a closed blind.
If i set the blind to 20% -> The Home App shows 80% opend, but its only 20% open.

I want to get this in sync.

Im using the KNX Binding.

Thing Definition

Type rollershutter : Markise "Markise"                  [ upDown="3/1/20+3/1/22", stopMove="3/1/21", position="3/1/26+<3/1/23" ]

Item Definition

Rollershutter   Markise                     "Markise [%d %%]"                               <rollershutter>                     [ "WindowCovering" ]    { channel="knx:device:bridge:jalosieaktor:Markise"[profile="transform:JS", function="InvertPercent.js"]}

I found a possible solution with the JS Transform Plugin but i cannot get it to work: Reverse the percentage for the rollershutter

I tried to implement it in the thing and item definition:

Item Definition

Rollershutter   Markise                     "Markise [%d %%]"                               <rollershutter>                     [ "WindowCovering" ]    { channel="knx:device:bridge:jalosieaktor:Markise"[profile="transform:JS", function="InvertPercent.js"]}

Thing Definition

Type rollershutter : Markise "Markise"                  [ upDown="3/1/20+3/1/22", stopMove="3/1/21", position="3/1/26+<3/1/23", transformationPattern="JS:InvertPercent.js", transformationPatternOut="JS:InvertPercent.js" ]

InvertPercent.js

(function(i) {
    if (isNaN(i)) {
        return (i);
    }
    return(100-i);
}) (input)

Thanks for helping out :slight_smile:

I’m no JS expert but you may be able to do the inversion in a rule?

Here is an example for inverting a dimmer item for Alexa that may help.

rule "Buero_Colortemp_Alexa Commands"
when
  Item Buero_Colortemp_Alexa received command
then
  Buero_Colortemp_Test.sendCommand(100 - receivedCommand as PercentType)
end

rule "Buero_Colortemp_Test Changes"
when
  Item Buero_Colortemp_Test changed
then
  Buero_Colortemp_Alexa.postUpdate(100 - Buero_Colortemp_Test.state as PercentType)
end

You will need to create a proxy item and use it to update the value on the app.

Hi and thanks for your reply. I think this could work, but its a bit ugly :slight_smile:
I will have a try till i have a better solution.

Agreed, just keep the curtain closed. :laughing:

1 Like

is the Buero_Colortemp_Test a thing or an item ?

Sorry for the delayed response, it’s an item.