Homekit - Rollershutter position inversion

Hi All,

i wanted to know how you are dealing with the inversion of the rollershutter position within homekit. From the documentation it mentions:

openHAB Rollershutter is defined by default as:
OPEN if position is 0%,
CLOSED if position is 100%.
In contrast, HomeKit window covering/door/window have inverted mapping
OPEN if position 100%
CLOSED if position is 0%

So that is perfectly fine for me when just using “OPEN” or “CLOSE”. But i often want to control my rollershutter more precise and drive to a certain position, where 100 should be fully closed and 0 should be fully open. To achieve this, i have to use

{homekit="WindowCovering" [inverted="false"]}

But then “OPEN” and “CLOSE” do not work as intended anymore, but is closing the rollershutter on my voice command “OPEN” and vice versa.

How do you deal with that? Do you have any hints how to prevent inversion for the position drive but use the inversion for normal “OPEN” / “CLOSE”?

Thanks in advance
Patrick

Hi Patrick,

this is strange, usually if OPEN/CLOSE are working correctly then also any values in between are working correctly.

what happen to your physical blind if move it in home app to 80%

Hi @yfre

sorry for my late reply. My little boy was sick over the week, followed by me. Sorry for that.

I catched several more information: If i close the rollershutter in openHAB (i.e. 100%) Homekit shows the shutter being open 1%. Weird. Why 1%? If i move this down to 0%, the rollershutter opens completely.

But answering your question: Everything else besides 0 or 100% is fine. Moving to 85% in the homekit app moves the shutters to 85% closed. BUT: 85% looks just like being nearly fully opened. And instantly HomeKit shows the shutter being fully closed (i had to make the picture during moving the slider, on release of the slider, it directly went to fully closed).

Here a short picture story, starting at fully closed:


Now going to 85% in HomeKit App (which is shown as nearly open) (don’t mind that this is now shutter2, just realized that i was missing a picture of my test today):


Conclusion => Percentage works perfectly, but homekit is really weird. Has anybody an idea?

Here is my *.items file


Rollershutter      MQTT_Rolll7Pos        "Rollladen 7 [%.0f %%]"         <rollershutter>    (gRolll7, gRolllPos)     {channel="mqtt:topic:mqttbroker:Rolll:Rolll7Pos"}
Number             MQTT_Rolll7Target     "Rollladen 7 [%.0f %%]"         <rollershutter>    (gRolll7)                {homekit="WindowCovering" [inverted="false"]}
Rollershutter      MQTT_Rolll7Cmd        "Rollladen 7 [%.0f %%]"         <rollershutter>    (gRoll7)                 {channel="mqtt:topic:mqttbroker:Rolll:Rolll7"}

A rule pushes the “Pos” channel to the Target and Cmd channel as status, so that they also reflect the current state. ( I think i have to do this for HomeKit also, but haven’t done yet).

rule "Rollershutter - postUpdate positions to target and command channels"
when
    Item MQTT_Rolll7Pos changed
then

    // Rule to push the Position Channel to the Target and Command Channel
    // This helps, that target and command channel also show the position

    // to keep it simple just update ALL positions

    postUpdate(MQTT_Rolll7Target , MQTT_Rolll7Pos.state)
    postUpdate(MQTT_Rolll7Cmd, MQTT_Rolll7Pos.state)

end

Another very hugh rule calculates the drive time from the current and the target position, determines the drive direction sendCommand to the Cmd channel, triggers a timer and sendCommand a STOP. That works perfectly fine.

Thereby Roll7Pos is only a state MQTT item ranging from 0 to 15000, reflecting the milliseconds my shutter drives where 0 is fully open and 15000 is fully closed.

My rollershutter react on rollershutter commands “OPEN”, “CLOSED”, “STOP”. Therefore i need the Rolll7Cmd channel.

The Rolll7Target channel is the interaction menu, specifying how much open i want to have the shutter.

Finally, my status channel is configured like this

Any help would highly highly be appreciated. Thanks a lot!
Patrick

Hey Patrick,
hope you son is healthy again.
yes, visualization of home is a little bit strange, especially if it is almost fully closed or almost fully open. but the number it shows is the number it receives from openHAB. so, if it shows 1% then it is the number it got from openHAB. so, maybe check the openHAB events logs to see who sends 1%

Hey Eugen,

indeed, you are right. I can find the 1% in the logs, but not by whom they were triggered. The only thing i can see, is that the *.rules file was loaded to the very same time (maybe, i am playing around a little too much now :wink:).

In the meantime, i believe my desired state is not achievable with bord utilities. This is

  • Tell HomeKit i want to close the shutter completely
    “Hey Siri, schließe Rollladen 2” or “Hey Siri, mache Rollladen 2 zu”
  • Tell HomeKit i want to open the shutter completely
    “Hey Siri, öffne Rollladen 2” or “Hey Siri, mache den Rollladen 2 auf”
  • Tell HomeKit i want to drive to a defined position (where 0 = open and 100 = closed)
    “Hey Siri, fahre Rollladen 2 auf 85%” (which is nearly closed, only lits are visible) or
    “Hey Siri, fahre Rollladen 2 auf 30%” (which is only for a little shadow when the sun is strong)

So hey, we are all somehow engineers and are pushing forward to our goals. So i have re-configured my home, made a separate HomeKit Item only for HomeKit and configured an additional rule:

Rollershutter    MQTT_EG_Wohnzimmer_Rollladen2HomeKit      "Rollladen 2 [%.0f %%]"      <rollershutter>     {homekit="WindowCovering" [inverted="false"]}
rule "Rollershutter - Populate Homekit Target"
when
    Item MQTT_EG_Wohnzimmer_Rollladen2HomeKit received command
then


    // Get triggeringItem
    var list = ScriptServiceUtil.getItemRegistry.getItems(triggeringItemName);
    // reality check does an item with that name exist?
    if (list == newArrayList) {
        logWarn("Rollershutter - Populate Group Commands", "Item name lookup failed: '{}''", triggeringItemName);
        return;
    } 
    var triggering_item = list.get(0);

    logInfo("Rollershutter - Homekit", "HomeKit triggering_item: " + triggering_item.name)
    logInfo("Rollershutter - Homekit", "HomeKit receivedCommand: " + receivedCommand)

    // HomeKit inverted=false
    //   0 => geschlossen
    // 100 => offen

    // openHAB
    //   0 => offen
    // 100 => geschlossen

    var Number correctedCommand = 0
    var Number HomeKitState = 0

    if (receivedCommand == 100) {
        correctedCommand = 0
    } else if (receivedCommand == 0) {
        correctedCommand = 100
    } else {
        correctedCommand = receivedCommand
    }

    HomeKitState = (100 - correctedCommand)

    logInfo("Rollershutter - Homekit", "HomeKit correctedCommand: " + correctedCommand)

    if (triggering_item.name == MQTT_Rolll2HomeKit.name) {
        sendCommand(MQTT_Rolll2Target, correctedCommand)
        postUpdate(MQTT_Rolll2HomeKit, HomeKitState)
    } 
    
end

So finally that’s it and now i am happy. Maybe not the best programmed solution but for me a topic is solved again. The only not so nice thing is, the slider in HomeKit is not useful to handle with your finger, but that is not my usecase, therefore i do have the openHAB App. HomeKit is just used for Voice Control.

Thanks for your contribution.

Best regards and merry christmas
Patrick

1 Like