HomeKit Automation Tips

Getting more out of your smart home devices

Some HomeKit Automations (using shortcuts) are broken in iOS 15 / tvOS 15

It seems like some HomeKit Automations are still broken in the release version of iOS 15 / tvOS 15. For instance, HomeKit shortcuts using conditional if statements where the brightness off a room (with a lux meter / motion sensor), or even the brightness of a lamp is checked, these conditionals are always interpreted as false.

 

I have a simple shortcut triggered by a button on a Hue Dimmer Switch:

If Lamp Is Off
>> Set Lamp to On 100% Brightness
Otherwise
>> If Lamp Brightness is greater than 50%

>>>> Set Lamp Brightness to 45%
>> Otherwise
>>>> Set Lamp to Off
>> End If
End If

This worked flawlessly before iOS 15 / tvOS 15, where if the lamp is off when you press the button, the lamp would turn on and to 100% brightness. If the lamp already was on with a brightness greater than 50%, it would dim the lamp to 45% brightness. Else, it would turn the lamp off.

After the update, the light will only turn the light on to 100%, or turn it off.

This breaks a lot of HomeKit Automation shortcuts, so let’s hope Apple fixes this bug quickly.

UPDATE: There is a workaround for this bug.
I’ve written a more comprehensive post where I share three examples of the workaround.

UPDATE: It appears that the bug has been fixed with iOS 15.1 / tvOS 15.1 / HomePod Software Version 15.1.

9 thoughts on “Some HomeKit Automations (using shortcuts) are broken in iOS 15 / tvOS 15”

    1. Hi Thomas,
      You’re right, it’s really annoying… especially since this bug was there during the whole beta process. However, if you want to get your shortcut working you can rewrite it like this:

      Get Brightness of Light Sensor
      Get numbers from from Brightness
      If Numbers is greater than 50
      >> Set KitchenLight to Brightness 100
      Otherwise
      >> Set KitchenLight to Brightness 50
      EndIf

      1. Hi Stefan,

        I already changed most of my automations days ago after your post regarding the workaround went online (and viral). That totally works for me. I have 40+ lights, 20+ sensors and 90+ automations in my home, so it’s basically still annoying to maintain.

        However, thanks for your effort and posts. I learned a lot about automations because of your blog and it really helped me getting more out of HomeKit. My biggest achievement so far is to write pretty much everything into a database on my own server (Linux, Apache, MariaDB, PHP) in order to have statistics and even to store and read information that cannot be done with automations/shortcuts yet. Such as: when a door/window opens, get the last state from another device (such as a radiator), write it into the database and read it again when the door/window closes (even days later). In about 4 months, there are around 200K+ events (motion detected, light on, light off, …) in the database 🙂

        However, you’re doing a great job here. Thanks.

        1. I’m not actually done fixing all my shortcuts… but I should really take a few hours and just get it done. The ones I’ve got left to fix are all the Hue Dimmer Switches, which are set to toggle between three different brightness levels and off for lamps around the home.

          Your setup linking in a webserver is actually something very similar to what I’ve done. I’ve got a Raspberry Pi 4 running as my home webserver (with Apache, MariaDB and PHP just like you). I’m using another Raspberry to run Hoobs (Homebridge) so that I can have scheduled dummy switches and regular dummy switches as Boolean variables.

          For instance, I’m logging weather data as well as temperature data from inside the home every hour. (Using a scheduled dummy switch for that, I only need to have a single logging shortcut to maintain.) The weather log can then be viewed on the webserver (when I get around to it, I’m going to add diagrams and other data to this):

          Weather log

          Using webhooks in the shortcuts really opens a lot of possibilities. I might write a few blog posts about this in the future.

          1. I like your idea with that dummy switch. Won’t work for me because I really don’t want to have a single server system at home – not even a Raspberry. It’s a mental thing, I simply don’t want to have such active components at home 🙂 My server is a dedicated root server in some cloud. So, I basically have 6 automations/shortcuts that run every 4 hours and gather the temperature from every temperature sensor in the house. It’s not convenient, but it works.

            At first, I tried to have *one* shortcut, starting daily at 0:00 with a loop of 24 times, getting all temperatures and then sleeping for 60 minutes to then start over again. That didn’t really work. It seems to me that shortcuts with very long waiting periods are totally unreliable.

            Do you see other options with HomeKit natively and without Homebridge or similar?

            1. I understand. I’ve got the RPs with the hubs and bridges for HomeKit stuff, so I mostly see them as part of that. You can’t log into them from the outside without going through the VPN into the home network. Before the RPs, I had made 12 automations for logging the weather data every 2 hours to a webserver that was hosted elsewhere, but when I had to make some changes… doing the same thing in 12 shortcuts drove me mad. At that time I was also using smart plugs instead of dummy switches as Boolean variables, so that I could set “states” (for instance, pay no attention to the motion sensor for 1 hour).

              I did a test about how long a HomeKit shortcut can run before being terminated, and with a AppleTV 4K as the HomeKit hub, it was impossible to go longer than 10 minutes (perhaps something I should retest now with tvOS 15). What is the maximal duration for a HomeKit shortcut?

              I really wish would add more options in Time Automations, so that you could repeat every x minutes. Built-in dummy switches would also be great, but I’m not hopeful at the moment.

              1. Funny. It seems you’re pretty much like me. We both had the same ideas, ran into the same problems, found the same workarounds. You just have Raspberrys at home and are even more experienced with HomeKit 🙂

                A question, maybe you can confirm…

                I use my database to log the radiator state when the window above the radiators open (“Heating” or “Off”). This is because my home turns the radiator off immediately when the window nearby opens. When the window is closed again, the webhook reads the radiator’s previous state from the database and I want to set that last state again. The values that are taken from the database are totally correct, I can see that by giving debug output. It seems like it’s the iOS/tvOS bug since 15 with IF statements. Do you think so too?

                I basically do when the window closes again:

                GET CONTENTS OF …
                SET VARIABLE LastState to Contents of URL
                IF LastState is “Heating”
                >> SET Kitchen Radiator TO “On / Start Heating”
                OTHERWISE
                >> Do nothing
                END IF

                This shortcut always does nothing. The value from GET CONTENTS is perfectly fine (“Heating”) and I’ve tried various methods for the variable type in the IF statement (Text, Name, etc.). The statement fails every time and falls back to OTHERWISE. I really think it’s the bug.

                1. I don’t know if this is an iOS/tvOS 15 bug, but it sure doesn’t work the way you would expect. The way you had solved it was absolutely the logical way to do it.

                  I tried to replicate it, adding a shortcut to a Hue Dimmer Switch button. I put an index.php file containing only the word Heating on my Pi web server and followed your shortcut exactly. But there were several things that didn’t work right. First, putting the contents of the URL directly into a variable doesn’t work. The if-statement only let me choose between has any value or does not have any value To remedy that, we must use Get text from “Contents of URL” before putting it into a variable. But if it’s a very short shortcut, I would use the Magic Variable instead, and point it to the text in Get text from….

                  Now, using if Text is Heating doesn’t work, and I’m not sure exactly why. However, if we change the conditional to contains, it works. And then we can remove Otherwise since it’s not doing anything.

                  Window / heater shortcut

                  Let me know if this solves it for you 🙂

  1. Thank you. With “Get Text from …” and “IF … contains” it works. I am not 100% sure if it’s highly reliable and will monitor it for a few days when it gets colder 🙂

Leave a Comment

Your email address will not be published. Required fields are marked *