#12: The smartest Shades? Hunter Douglas? Somfy?
Hardware Automation Home Assistant

#12: The smartest Shades? Hunter Douglas? Somfy?

William Zink

Introduction

When it comes to motorized shades there are a lot of different options. Some expensive and other cheaper DIY options. During my renovation I knew that keeping the old 1990's aluminum horizontal blinds wasn't an option. So when I began looking for some more modern and stylish options I came across the Hunter Douglas and chose them.

TL;DR - I replaced my old 1990's aluminum horizontal blinds with Hunter Douglas 5% opacity shades. I discuss my journey of using IFTTT (If This Then That), creating my own custom Lovelace card for Home Assistant, spending a year tracking the sun (azimuth and elevation), and finally discuss my overall thoughts on my Hunter Douglas shades.

Options

Here are all of the cover integrations that Home Assistant supports.

I began my search for shades before knowing what Home Assistant was. I didn't really know or understand how all of the pieces were set but I did want a system that had unity. I did know a few people in my building that with Hunter Douglas and each person spoke very highly of them. I went to their local store and was very impressed. Someone also gave me the name of a Somfy contact and I decided to let them both bid for the job. After discussing with both sales people I found some options that I really liked, which included just shades rather than shutters / blinds. With this I could still see the city through the shades and there was less moving parts. I also found that Hunter Douglas would allow me to have two shades rather than 4 due to my windows being so large.

I have two of these giant windows (46" x 10' each pane)

I had found that (at the time) Somfy app was a little immature and didn't support IFTTT and the sales person did know if they had an API or not. The representative asked why I would even want an API, you could do everything through the iOS app... While true, getting to a single iOS app was my goal and adding another one to the repertoire didn't seem prudent.

After the price quotes, and the representative discussions I found that Hunter Douglas has a better and more knowledgeable salesperson. He told me that my (10' tall wide windows) could be done with one shade! He also understood my need for automation and told me that I should look at Z-Wave and Fibaro. It also helped that his estimate was $1000 USD under Somfy.

So Hunter Douglas it was.

Installation

There was a little bit of coordination that needed to be done for these shades to be installed. I had to get an electrician to run me an electrical low voltage wire for the shades (Hunter Douglas provided the wire). And had to get drywall and paint to fix the wall I had to tear up to get this wire installed. After everything was completed from the contractor side, the shade installers came about a week later. I was impressed with how fast they got everything working. The Hunter Douglas salesman returned with the install crew and he setup my Hunter Douglas PowerView Hub and the PowerView remote control. We talked more about automation and he told me that many of his customers ask for a solution to follow the sun but had said that type of system would be too expensive.

Shades installed
Shade half way down

Enter Home Assistant

After researching and ordering a Raspberry Pi 3B+ I began playing around with Home Assistant. It is one of the most popular things to install on a Raspberry Pi. I finally joined the Home Assistant family in October 2018 (release 0.79.3). At that time Home Assistant didn't support Somfy integration like it does now. And when I first was starting out, like most things I didn't really know what I was doing. I had already setup my Shades using IFTTT (If This Then That) and since I was already familiar with it I decided to leave it and learn other features of Home Assistant.

Note: Hunter Douglas has supported a native Home Assistant integration for a while but the "cover" category did not exist at the time. But since I was using IFTTT I didn't really care so I just added an IFTTT integration and I was done. My only issue with this is that I didn't know what position the shades were in. But I was able to call the scenes that I had setup in the Hunter Douglas app.

Node-Red - enter automations!

Okay, with a very plain install of Home Assistant and my IFTTT integration I could send the shades where ever I wanted (provided that I had that scene in the app). I then began dreaming for the solution on what puzzled the salesman and what 'all' f these other customers had wanted... Shades that could follow the sun. Home Assistant at the time did not support automations like it does now and I needed to find a better solution. Enter Node-Red I had found The Hook Up and Dr Zzzs mentioning it and the installation was pretty straight forward.

I needed to get a basic Wikipedia astrology degree (kidding) but I did need some basic understanding of what azimuth and elevation were regarding the sun and my positioning to the condo. I decided it would be best if I could take some numbers down and lower them above those numbers when the sun became annoying.

Getting the Azimuth and Elevation with a Get Entites Node in Node-Red
Building the test flow so I could see where the sun was at a given moment

After I had documented the azimuth and the elevation for a few days. I also noted the shade value according to the Hunter Douglas Hub API (I'll talk more about why later). But I was ready to start implementing this node.

After several iterations I was finally ready to call it 'done'... and the next day it was overcast. Sigh... My shades spent all day going up and down for no reason, so back to square one. I started searching for solutions to this problem and the community had some great ones. First, use a light sensor (even Philips Hue motion can capture it) and place it on top of the shades. If the value is high, then activate the shades. Second, check the cloud cover and if it's over a certain percentage then don't manipulate the shades. Again, all this was new to me so I preferred to use an API to get the cloud coverage and not have to deal with another sensor and more batteries. Both have their pros and cons but I chose the API method.  

Page 1 of smart shade flow
Page 2 of smart shade flow

I use OpenWeather API to get the current cloud cover value. I also check if the shades are already set in their correct position to prevent a lot up and down of the shades if the weather changes. If the shades are set to move but the cloud cover is set greater than or equal to 75% then this flow will open the shades. The more natural light the better.

So there is a lot going on here as you can see and the nodes to the right that you can't see are just setting the shade height using the Hunter Douglas API,, you won't really need that but my main function node I will dive into as it's the brains of the operation.

var elevation = msg.payload[0].attributes.elevation;
var azimuth = msg.payload[0].attributes.azimuth;

var beginningLeftSideAzimuth = 169
var leftSideOfFirstHotel = 243.0
var rightSideOfSecondHotel = 258
var leftSideOfSecondHotel = 272
var rightSideOfSecondHotel = 283
var noSunPast = 290.1

if (elevation <= 0.75) {
    // sunset raise the blinds  
    return [msg, null, null, null, null, null]
} else if (azimuth > beginningLeftSideAzimuth && azimuth < leftSideOfFirstHotel) {
    //node.warn("regular sun")
    if (elevation <= 73.5 && elevation > 62) {
        return [null, msg, null, null, null, null]
    }
    else if (elevation <= 62 && elevation > 58) {
        return [null, null, msg, null, null, null]
    }
    else if (elevation <= 50 && elevation > 18.25) {
        return [null, null, null, null, null, msg]
    }
    else if (elevation <= 18.25 && elevation > 10.5)
    {
        return [null, null, null, msg, null, null]   
    }
    else {
        return [msg, null, null, null, null, null]    
    }
} else if (azimuth >= rightSideOfFirstHotel && azimuth < leftSideOfSecondHotel) {
    //node.warn("right side of firstHotel")
    if (elevation > 65) {
        return [null, msg, null, null, null, null]
    } else if (elevation < 65 && elevation >= 37) {
        return [null, null, msg, null, null, null]
    } else {
        return [null, null, null, null, msg, null]
    }
} else if (azimuth >= leftSideOfSecondHotel && azimuth < rightSideOfSecondHotel) {
    //node.warn("behind the secondHotel")
    // Sun was too high at 41 for other blind to be needed
    if (elevation > 33) {
        return [null, null, msg, null, null, null]
    } else if (elevation <= 33 && elevation > 10.4) {
        // Above building both blinds needed
        return [null, null, null, null, msg, null]
    } else {
        // below building no blinds needed
        return [msg, null, null, null, null, null]   
    }
} else if (azimuth >= leftSideOfFirstHotel && azimuth <= rightSideOfFirstHotel) {
    //node.warn("sun could be behind hotel")
    if (elevation >= 63) {
        return [null, msg, null, null, null, null]
    }
    else {
        return [msg, null, null, null, null, null]
    }
} else if (azimuth >= rightSideOfHotel && azimuth < noSunPast) {
    //node.warn("no more sun")
    // Right of the Sheraton does not need kitchen blind
    return [null, null, null, msg, null, null]
} else {
    //node.warn("no applicable if statements")
    // if all else fails raise the blinds
    return [msg, null, null, null, null, null]
}

You could have more than 6 outputs, and you can keep building if statements til the cows come home, but I have found that 6 is sufficient for my needs.

Boom! Done! I now have the smartest shades in all of the land. I am just waiting for customers to knock down my door. Time to improve the UI...

Location of Shades in Home Assistant

My only problem with calling the Hunter Douglas scenes via Node-Red was that I didn't know where they were. Like are they closed? Open? Middle? This bothered me and I wanted to come up with a solution in Home Assistant.

I had something like this in my head but nothing really came up in Lovelace (which was brand new at the time) and after intense searching nothing seemed to come up. So I decided to make my own custom card (the one you see above). I call it the Shade Status Card and it's purpose is to be very simple and give me the status of where the shades are located.

How does it work?

Well after some more intense searching I found a couple of useful documents
Hunter Douglas Quick Start Guide
Hunter Douglas PowerView Hub API Documentation
With the second one telling me there was a ReST API! And as a familiar developer I put the methods into PostMan and got to testing and investigating!

Quickly I found that I could query the status of the shades and get an integer value back between 0 and 65535. With 0 being closed and 65535 being Open! Alright we are getting some where. With some spare fabric at the top and bottom values I knew I could make a quick shade sensor template to tell me where the shades were located using the ReST API.

After my sensors were created I added two buttons to the card that would stop the automations and send the shades all the way up or all the way down. And viola the custom card was created.

Done, time to retire!

All was well, until... IFTTT wanted to charge

Since the beginning installation of my shades and Home Assistant I was using the IFTTT integration. IFTTT was my first home automation platform. But then bad news struck... IFTTT set to begin a new pay model where you had to pay $9.99 USD per month. I was devastated, at the time I had over 80 triggers setup that Home Assistant was calling and their new limit was 3. I was using my Fanimation Fans (here's how I fixed that) I was using my shades and a couple of other random automations. So now I needed to come up with a fix and fast!

This news still saddens me to this day. IFTTT was my starting point, it was my lighthouse at the beginning of a long journey. I just wonder how many other people this will stymie into getting into the smart home world. I was hoping for some sort of grandfather program or something but no. I just don't understand (well I do it's about money) IFTTT gets paid by the companies to be compatible and now they want to start charging the customers too. This video sums it up perfectly for me. But since more companies are leaving IFTTT I just hope that people will find other solutions. If you are like me and you want a solution to control YOUR data and not have to pay companies per month then I suggest looking at Home Assistant or openHAB. I would rather use my time and pay the initial cost of a device, but after that don't charge me! Another reason that I write this blog is to demonstrate all the things that you can do without Alexa, Google Home or Siri.

Back to the Hunter Douglas ReST API

Luckily the IFTTT news came after I had over two years into Home Assistant and more years as a developer. I had some knowledge of the Hunter Douglas API due to the custom shade-status-card I wrote discussed above. And now maybe I could recreate my scenes without needing the Hunter Douglas app at all! Using the API documentation.

Forming up the JSON request to send to the next API call
The API call to move the shade (where it will move is based on the previous picture)

Sun Resources

ELI5: Azimuth and Elevation
Example values throughout the year, given your address, this helped me identify both the extreme Azimuths (winter and summer) and what values I needed to plan on.

Conclusion

This is going to be one of my longest posts, but I did want to detail my process and how all the pieces came into the puzzle. It started with IFTTT and grew into calling the API directly for more control of the app. Looking back now, I could use the cover integration in Home Assistant, but I am happy with where it is now for my needs. I am also very happy with my Hunter Douglas shades. I had one issue where the motor had died after about a year and a half of use, but Hunter Douglas replaced it under warranty free of charge. With the lower cost, documented ReST API, and no service to pay for this was a complete success. If you are looking for the smartest shades, I believe I have them. As always, I'm open to feedback or questions that you may have. When I was beginning this journey I dreamed of a post like this to challenge me to see what is possible. I hope this post does that for you.

Question

What shade automations have you written? Does this motivate you to get motorized shades and make them as smart as possible?