Horizontal Blinds Automation


As I realized how powerful Home Assistant is I thought of ways I could use it to increase my home’s utility and energy efficiency and thought of my blinds. The rear of our home faces roughly southwest and we’re on a hill so we get full afternoon sun so I figured I could automate the blinds to open in the morning and close once the sun got to a certain position based on the sun component in Home Assistant.

This component is easy to configure you just go to your home in Google Maps and center your home roughly in the middle of the window and then copy the location in the URL bar: https://www.google.com/maps/@38.8974691,-77.0363911,18z
Everything after the @ symbol are the GPS coordinates of that location.

All you have to do to configure Home Assistant to know where you live is add these to your configuration.yaml file

  latitude: 38.8974691
  longitude: -77.0363911

and then one more line to enable the sun component


After you save your configuration file, restart Home Assistant and go to your dashboard. If everything went as planned you should now see the sun icon on your dashboard. Its status will change as the sun moves through the sky. You can use the sun’s events to automate things to happen near certain events related to the sun like sunset or sunrise.

I want to configure my blinds to open in the morning and close when it’s afternoon and the sun is at an angle where it will cast sunlight into my room. I could make my automation do this based on time but the sun’s track through the sky changes as the seasons change and something that worked in the winter may not perform optimally in the summer. Luckily the sun component track’s the angle of the sun above the horizon which I can use to approximate when the sun would be beaming through my windows.

Automations are made up of 3 parts:

  1. Trigger
  2. Conditions
  3. Action

The trigger is the part of the automation that tells Home Assistant that it needs to do something. The condition places conditions that must be met in order to run the action. The action can be anything that Home Assistant is configured to do. In my case I will need two automations: one for opening the blinds, one for closing the blinds. In the open blinds automation I want them to open 45 minutes after sunrise so that will be my trigger. I don’t have any conditions as I always want this to happen. The action would be to tell Home Assistant to open the blinds. Putting all of that together gives us


alias: Blinds open after sunrise
  platform: sun
  event: sunrise
  offset: '00:45:00'
  service: cover.open_cover_tilt
  entity_id: cover.living_room_0

And to close them:

alias: Blinds close in afternoon
  platform: numeric_state
  entity_id: sun.sun
  value_template: '{{state.attributes.elevation}}'
  below: 57
  service: cover.close_cover_tilt
  entity_id: cover.living_room_0

Next we’ll go over the hardware