---
title: My Blinds' Light Sensors Were Lying for Months. So the House Calculates the Sun Instead.
description: My blinds' light sensors sat in shade for months. Now Home Assistant calculates the sun on each window from a weather station, and a deadband stops flapping.
image: https://willcurran.com/hubfs/will-curran-brand/blinds-calculate-the-sun-featured.png
---

[Skip to content](https://willcurran.com/blog/blinds-calculate-the-sun#main)

[Will Curran](https://willcurran.com/)

[Home](https://willcurran.com/) [Portfolio](https://willcurran.com/portfolio) [Press](https://willcurran.com/media) [Blog](https://willcurran.com/blog) [Favorites](https://willcurran.com/favorites) [Speaking](https://willcurran.com/speaking) [Consulting](https://willcurran.com/consult) 

[Hire Will](https://willcurran.com/hire)

[Writing](https://willcurran.com/blog) Home — My Blinds' Light Sensors Were Lying for Months. So the House Calculates the Sun Instead. [Subscribe](https://willcurran.com/blog/subscribe)

Home

# My Blinds' Light Sensors Were Lying for Months. So the House Calculates the Sun Instead.

The light sensors in Will's blinds read 1 or 2 on sunny and stormy days alike because the window header shaded them, so his house now calculates the sunlight on each window from a weather station and the sun's position. The build log covers the physics, why a time delay is not ...

![](https://willcurran.com/hs-fs/hubfs/will-curran-brand/will-curran-avatar.jpg?width=44&height=44&name=will-curran-avatar.jpg)

Will Curran Oct 28, 2026 · 8 min read

<https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fwillcurran.com%2Fblog%2Fblinds-calculate-the-sun>

On this page

![A marigold sun on a dotted arc shining onto a window with a half-lowered blind, beside the title The house calculates the sun.](https://willcurran.com/hs-fs/hubfs/will-curran-brand/blinds-calculate-the-sun-featured.png?width=1600&height=900&name=blinds-calculate-the-sun-featured.png)

The light sensors built into my blinds reported a 1 or a 2 for fourteen straight days. Minimum 1, maximum 2. One of those days was the sunniest in the stretch. Another was a storm day. The blinds could not tell them apart.

Fourteen days is only how far back I checked. The sensors had been effectively useless for months; an automation note from late March was already working around them. So the house now calculates the sunlight arriving at the glass, from a weather station and the position of the sun.

## The sensor was sitting in the shade

The readings were not stale. The sensors reported about every ten minutes, right on schedule. They were reporting the truth about the wrong spot.

These blinds are top-mounted, and the light sensor sits at the top of the blind, tucked under the window header, which shades it. The sun lands on the lower part of the glass.

My workaround had been to borrow the light reading from a blind in another room, a coarse 1-to-10 number. Better than a 1 or a 2, and still a guess about a different window.

## How I noticed

A reading of 1 or 2 is a valid number, so nothing looked broken. I kept seeing intense light, and the blinds did not react. In early September I asked my assistant for a data-only check: change nothing, pull the history, tell me what the sensors had been saying. That is where the fourteen days of 1s and 2s came from.

## Stop measuring at the blind, calculate at the glass

The weather station has a pyranometer, which measures solar radiation on a flat, level surface about once a minute. Home Assistant already knows the sun's elevation and azimuth. From those two you can work out how much sunlight hits a vertical window without putting a sensor near it.

You do have to do the geometry, because a flat sensor and a window disagree about the sun most of the day. With the sun about 10 degrees up, a flat sensor catches about 18% of the direct beam, while a window facing that sun catches about 98%.

With the sun high and off to one side, it flips: the flat sensor sees most of the beam and the window a fraction. Drag the sun below to see both. The numbers are synthetic.

![At a sun height of 10 degrees, straight onto the window, a flat, level sensor like a weather station catches 0.17 of the beam while the glass catches 0.98.](https://willcurran.com/hs-fs/hubfs/will-curran-brand/blinds-calculate-the-sun-sun-slider.png?width=1440&height=990&name=blinds-calculate-the-sun-sun-slider.png)

## The model, in plain words

1. **How clear is the sky?** The clearness index compares what the station measures with what arrives at the top of the atmosphere at that sun angle.
2. **How much is direct, and how much is diffuse?** The Erbs correlation, published in 1982, splits the light into the direct beam from the sun's disc and the scattered light from the rest of the sky.
3. **How square-on is the sun to the glass?** The share of the direct beam that lands on a vertical window is the cosine of the incidence angle, set by the sun's height and how far the sun's direction is from the way the window faces.
4. **Add the sky and the ground.** A vertical window sees half the sky, so it gets half the diffuse light, plus light bounced off a ground assumed to reflect 20%.

For anyone who wants the formulas, this is what runs:

- `E0 = 1361 · (1 + 0.033 · cos(360 · day_of_year / 365))`
- `kt = GHI / (E0 · sin(elevation))`
- `kd = 1 − 0.09·kt` when `kt ≤ 0.22`; `kd = 0.165` when `kt > 0.80`; otherwise `kd = 0.9511 − 0.1604·kt + 4.388·kt² − 16.638·kt³ + 12.336·kt⁴`
- `DHI = GHI · kd` and `DNI = (GHI − DHI) / sin(elevation)`, floored below 3° of elevation
- `cos(inc) = cos(elevation) · cos(sun_azimuth − window_azimuth)`
- `POA = DNI · cos(inc) + 0.5 · DHI + 0.5 · 0.2 · GHI`

GHI is the station reading. POA is the answer: watts per square metre on the window. The 3° floor exists because dividing by the sine of a tiny angle turns noise into enormous numbers.

## Lesson one: a time delay is not hysteresis

The first version used one threshold, 400 W/m², plus timing: above 400 for 3 minutes to close, below it for 10 minutes to reopen.

On broken-cloud days the station swung wildly within single hours. Cloud gaps outlasted ten minutes, so the blinds went close, open, close three times on each of the first two days. The delays did exactly what I told them to.

A delay only asks how long something has been true. What I needed was a gap in the value itself. Now the blinds close at 400 W/m² and do not reopen until the window drops below 250, so a cloud that takes the window from 600 to 300 changes nothing. That version has been live since October 19.

For heat, a room closes when the window is at 400 or more and the room is above 73°F or outside is above 80°F. It reopens when the window drops below 250, or once the room has cooled to 72°F and outside has dropped to 79°F.

![Synthetic cloudy day of sun on the glass swinging across 400 and 250 W/m². Cloud dips between about 270 and 365 W/m² last more than 10 minutes. A time-delay-only rule on one 400 line moves the blind 8 times; a 400/250 deadband closes once and opens once, when the sun is really gone.](https://willcurran.com/hs-fs/hubfs/will-curran-brand/blinds-calculate-the-sun-deadband-chart.png?width=1440&height=1190&name=blinds-calculate-the-sun-deadband-chart.png)

## Lesson two: one timeout stopped everything, and still looked like success

The blinds are SwitchBot Blind Tilts, which talk over Bluetooth. Every so often a call hangs for 40-odd seconds, and sometimes it still lands.

In an early version, one timeout aborted the rest of the automation. One room's blinds were nested inside another room's branch, so the second room never moved. Home Assistant still showed the automation as triggered, so it looked like it had run.

The first fix was to let each step continue on error and run the rooms in parallel branches. That traded one problem for another: several Bluetooth commands at once produced connection timeouts of their own. Since October 19 it runs one room at a time, each step allowed to fail without stopping the rest. Slower, which hardly matters for blinds.

Then there was the tilt direction. Home Assistant's standard "close tilt" command turned these slats the wrong way and reported success. Now every tilt move in this automation sets an explicit position, and every move is read back for up to 90 seconds. If it did not land, it retries once and then raises a warning.

## What is live

The old blind automation is off. Now each room has a state, and the sun model feeds heat into it. If the house cannot tell a room's state, the blinds hold where they are.

On October 19 I verified the path that applies every room at once, a single room changing state, and the heat deadband, plus 15 rendered scenarios. Glare now has its own rule as well, added on October 21.

## The parts that were not magic

The physics was the easy part. A correlation from 1982 and some trigonometry are well-trodden ground. Everything after that was plumbing: a sensor that was wrong for months while staying in range, a debounce that looked like stability until real weather arrived, and a command that did the opposite of what it said.

## Where I was the bottleneck

The sensors did not notice they were wrong. I noticed, because the light was intense and the blinds were not moving. The history pull, the model and the fixes all followed from that one complaint. I think that is the right split: the house can do the math, and it took me noticing the light to say the number was wrong.

## If you are about to try this

- **Pull the min and max before you trust a sensor,** and look at where it physically sits. Two weeks of history will tell you whether it measures anything.
- **Measure flat, compute the window.** A horizontal reading is the wrong number for vertical glass, especially when the sun is low.
- **Use two thresholds, not just a delay.** Close high, reopen low, and leave a real gap between them.
- **Assume wireless calls fail, and read back.** Keep one device's failure from stopping the rest, and never trust a reported success on a cover.

## Build it yourself

What it does: closes a blind when the sunlight on the window and the heat say it should, and reopens only once the light has clearly dropped. The parts:

- **Home Assistant**, with its built-in sun integration for elevation and azimuth.
- **Any weather station that reports solar radiation in W/m²** from a pyranometer.
- **A motorized cover Home Assistant can set to a position.** I use SwitchBot Blind Tilts; any cover works.
- A room temperature sensor and an outdoor temperature reading, for the heat condition.

How the pieces fit: a chain of template sensors does the math. One computes the clearness index and applies the Erbs split into direct and diffuse, and one per side of the house turns those into watts on the glass, using the direction that side faces (you measure that yourself). An automation compares each window's number with a close threshold and a lower reopen threshold, checks the heat conditions, then moves covers one room at a time, continues past errors, sets an explicit position and reads it back.

Give this to your AIBuild me a Home Assistant setup that closes blinds based on the sunlight hitting each window, calculated rather than measured at the blind. Inputs: my weather station's horizontal solar radiation (W/m²), the sun integration's elevation and azimuth, and the direction each window faces, which I will give you. Create template sensors that compute the clearness index, split radiation into direct and diffuse with the Erbs correlation, and give plane-of-array irradiance for each vertical window: direct times the cosine of the incidence angle, plus half the diffuse, plus 20% ground reflection. Floor the direct beam at low sun angles. Write an automation with a value deadband: close at 400 W/m² when the room or outdoors is hot, reopen below 250. Move covers one at a time, continue on error so one timeout cannot stop the rest, set explicit positions instead of tilt-close commands, and read the position back with one retry and a warning. First, show me my current blind light sensors' history so we know what we are replacing.

If your blinds have been lying to you too, or you have a better diffuse model than Erbs for a vertical window, I am easy to reach.

Filed under [Home](https://willcurran.com/blog/tag/home)

![](https://willcurran.com/hs-fs/hubfs/will-curran-brand/will-curran-avatar.jpg?width=64&height=64&name=will-curran-avatar.jpg)

Will Curran

I spent sixteen years building one company, and I have been in the event industry since 2007. These days I write about the technology I actually use — trucks, radios, home infrastructure, and the tools that survive past the first invoice.

[All posts by Will →](https://willcurran.com/blog/author/will-curran)

Get the next one by email

One email per post. No digest, no sponsors.

[← Previous A Day-Old Plugin Didn't Touch My House Audio Until It Passed Four Gates](https://willcurran.com/blog/day-old-plugin-four-gates)

## Related reading

[Home My Doorbell Can't Interrupt Spotify, So It Asks Who Owns the Music 5 min read](https://willcurran.com/blog/my-doorbell-asks-who-owns-the-music) [Home The Heat Rating That Decides a Desert Garage Mini-Split 4 min read](https://willcurran.com/blog/desert-garage-mini-split-heat-rating) [Home Movie Mode Means the Robot Vacuum Waits 6 min read](https://willcurran.com/blog/movie-mode-vacuum)

[Will Curran](https://willcurran.com/)

[LinkedIn — 29,339+ followers](https://www.linkedin.com/in/willcurran) [GitHub](https://github.com/rancur) [YouTube](https://www.youtube.com/channel/UCJgscc27l4fpkWx1SeK05xg/) [Spotify](https://open.spotify.com/user/rancur) [SoundCloud DJ mixes](https://www.soundcloud.com/thewillsee) [Twitch](https://www.twitch.tv/thewillsee) [Last.fm](https://www.last.fm/user/default) [Trakt — movies & TV](https://trakt.tv/users/willcurran) [Goodreads](https://www.goodreads.com/user/show/55302838-will-curran) [Will See Music](https://www.thewillsee.com) [Arizona Meshtastic](https://azmsh.net) [Electric Forest Meshtastic](https://efmesh.com)

© 2026 Will Curran — All rights reserved. [RSS](https://willcurran.com/blog/rss.xml) [Back to top](https://willcurran.com/blog/blinds-calculate-the-sun#main)

```json
{
  "@context" : "https://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Will Curran",
    "url" : "https://willcurran.com/blog/author/will-curran"
  },
  "dateModified" : "2026-10-28T16:00:00.753Z",
  "datePublished" : "2026-10-28T16:00:00.000Z",
  "headline" : "My Blinds' Light Sensors Were Lying for Months. So the House Calculates the Sun Instead.",
  "image" : [ "https://willcurran.com/hubfs/will-curran-brand/blinds-calculate-the-sun-featured.png" ],
  "mainEntityOfPage" : {
    "@id" : "https://willcurran.com/blog/blinds-calculate-the-sun",
    "@type" : "WebPage"
  },
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "url" : "https://willcurran.com/hubfs/image-1.png"
    },
    "name" : "Will Curran LLC"
  }
}
```