Categories
Projects Technology Uncategorized

The window shades are automated.

The robotic window shade project is completely operational.  Ever since the IKEA motorized blinds were installed, this is how they needed to work.  It seems like it’s been longer than a few weeks since work started on 2 weeks since on Implementing Home Assistant.

Writing software is one of those things that can only be learned by doing.  In my last post on this project, the last line is:

Figuring out how programming works shouldn’t be too difficult.

Right now, that sounds really optimistic because this was a frustrating and arduous process.  It’s always like that.  Reading the documentation and starter guides, the words were all familiar, but they didn’t mean what I thought they meant.  Look at a bunch of examples, then experiment with different commands.

My engineering nephew looked at the programming, and made some brief observations that got me to reconsider my understanding of how it worked.  Reading over the documentation again, I figured out what the words meant.

Home Assistant does have it’s own vocabulary.  A pre-existing program from an experienced user is called a ‘blueprint’.  The blueprint recommended for window shades had 3000 lines of code, handled motorized windows along with the shades, and was indecipherable to me.  I could use it, but I’d never understand it.

Back when computers had very little memory, programmers worked to write elegant code that did the job without using too much memory.  Elegant code is fast and reliable.  That is an antiquated philosophy now that motherboards have Gigabytes of RAM and processors running at Gigahertz speeds. 

My software has 51 lines of code, and closes the shades based on the outside temperature, amount of cloud cover and the elevation of the sun above the horizon.

Before the word, ‘algorithm’, meant the method a tech billionaire employs to manipulate a user’s lizard brain to increase engagement, an algorithm was a method to explain what software is supposed to do using regular human language.  A flowchart was often helpful.

Here’s the flowchart for my software:

There are many ways to solve a problem.  The IKEA hub has the flexibility of a programmable thermostat.  Shades could be raised or lowered at specific times, or relative to sunrise and sunset.  That doesn’t fully address seasonal changes or weather.  Home Assistant provides vast flexibility. 

Light and temperature sensors could have been used, but Home Assistant has some built-in features.  The elevation and azimuth of the sun are standard functions, as well as a few dozen bits of data from Accuweather.  The panel is from an Accuweather data feed.

When the sun is at a specific angle above the horizon, the software decides to lower the shades or not.  The shades won’t continually bob up and down as conditions change.  That seemed too complex, would drain the shade batteries and would probably get irritating.

Leave a Reply

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