Closing my blinds so I don't get blinded by the Light


 During the summer months, all I cared about with my blinds was cooling the house. Now it is Northern Hemisphere Winter, or what passes for it in California, and the sun is lower, towards the end of the day the sun streams through the French doors and into my Home Office right where I'm sat. Amazingly, not only can it be quite blinding, but it can actually make me quite warm.

This means I want to close my blinds depending on where the sun is in the sky. But it's not just elevation, but also the compass point (Azimuth), and it is specific to my location... San Jose, California.

Once more, enter Homebridge, that wonderful piece of code that enables all kinds of capabilities.

In this case, I'm using a plugin called Homebridge Sun plugin.

It gives me a light sensor, described as Lux, in the Home app.

You can see it here, in the top right of my "Room" called "San Jose". The other sensors are also from Homebridge and are weather sensors.

To do what I need to do, the light sensor is about as useful as a chocolate teapot!

What I need is Azimuth and Altitude of the Sun. Fortunately, the plugin does provide them, but you need to use either the Eve for Home or Home+ app to see them.








On the left you can see inside Home+, and on the right you can see Eve.

I like that, from the Eve app I can see that there is 1 Automation rule that this accessory is in, but I found that Home+ gave me a great deal more control over the automation than Eve did.

Actually Automating the blinds.

I have two Ikea Trader Roller blinds on my French Doors going from my Home Office to the deck at the rear of the house. One blind on each door. I have them grouped into a single blind inside Apple's Home app.

Setting up the plugin.

After you have installed, all you have to do is add the accessory to the config file.

{
    "accessory": "SunPosition",
    "name": "SunPosition",
    "location": {
        "lat": 37.33996,
        "long": -121.871662
    }
}

All it requires is the longitude and latitude of your location. The more exact you are, the more accurate the sun positioning is.

Restart Homebridge, and now you will start to see the sun position appear in your Homebridge log.

[11/12/2020, 4:05:21 PM] [SunPosition] Sun is 8.824012235586174 high at 239.31251206128667

[11/12/2020, 4:10:21 PM] [SunPosition] Sun is 7.965151039732809 high at 240.1438902628147

[11/12/2020, 4:15:21 PM] [SunPosition] Sun is 7.099117148881614 high at 240.9659701862848

As you can see, you get an update about every 5 minutes.

Essentially you'll have to be there when the Sun gets to a point where you want to block it. It may actually be between the points indicated, say at 3 minutes. Depends on how accurate you want to be. You can always get the current reading from your phone.

For me, the sun becomes inconvenient when:

  • Azimuth is GTE 217°, AND
  • Altitude is LTE 17°
At that point I want to set the Blinds to 60% open if there is someone in the Home Office.

This turns into a very complex automation for HomeKit.

First of all, I have to keep checking. I can't do this if I check for a value on Azimuth or Altitude. So I have to check to see if one of them has changed.

Basically, the logic looks like this:

IF
    azimuth has changed
WHEN (under the condition)
    Occupancy is Detected in the Study (Home Office)
AND
    Time of Day is between 30m after Sunrise and 30m before Sunset
AND
    azimuth is GTE 217°
AND
   altitude is LTE 17°
THEN
    Close the blinds to 60% open
ENDIF 

 Home+ doesn't understand groups of accessories, so I actually have to do the blinds as two separate actions.

The automation looks like this in Home+

<

It works nicely!

I'm intending to enhance this by adding a weather condition. I've covered that for hot days in another post. In this case, I'm thinking of making sure it only happens when I don't have cloud cover. I think I'll let this work for a few days yet before I get too adventurous.

Footnote:

As it happens in my case, I don't need to worry about opening the blinds again as it pretty much goes into Sunset.

However, if you want to, with Home+, you can actually set a range for Azimuth and Altitude.



Comments

  1. This is the most helpful Homekit / Homebridge post that I've found in a year!!! Now I just need to actually purchase automatable blinds!!

    ReplyDelete

Post a Comment

Popular Posts