Custom Component - Adaptive Cover

Adaptive Cover for Home Assistant

logo

Almost a year ago @langestefan posted this helpful community post to create a template sensor that automatically controls your blinds or sunscreen based on the position of the sun in the sky. You can find the post here.

I’ve created a blueprint for it, but it is very limited. So now I have built this awesome integration that can control your blinds whether they are vertically aligned, horizontally oriented, or even on an angle, or can tilt.

The Integration

The primary goal of the integration is to preserve visual comfort by reducing glare from direct sunlight. Additionally, it aims to reduce energy consumption by climate control.

A smart home should not only be able to control your blinds based on inputs like the position of the sun but should also help with the indoor climate by being energy efficient and controlling the temperature inside. Therefore, I added a climate mode that can adjust the position based on personal preferences, weather conditions, inside/outdoor temperatures, and presence. The algorithm is based on a scientific paper that studies the perfect position for adjustable tilted blinds.

Here’s a flow chart showing the decisions to produce the position state based on the inputs and selected mode(s):

Entities

The integration provides entities dynamically based on the modes and/or variables that are configured.

These entities are always available:

Entities Default Description
sensor.{type}_cover_position_{name} Reflects the current state determined by predefined settings and factors such as sun position, weather, and temperature
sensor.{type}_control_method_{name} intermediate Indicates the active control strategy based on weather conditions. Options include winter, summer, and intermediate
sensor.{type}_start_sun_{name} Shows the starting time when the sun enters the window’s view, with an interval of every 5 minutes…
sensor.{type}_end_sun_{name} Indicates the ending time when the sun exits the window’s view, with an interval of every 5 minutes.
binary_sensor.{type}_manual_override_{name} off Indicates if manual override is engaged for any blinds.
binary_sensor.{type}_sun_infront_{name} off Indicates whether the sun is in front of the window within the designated field of view.
switch.{type}_toggle_control_{name} on Activates the adaptive control feature. When enabled, blinds adjust based on calculated position, unless manually overridden.
switch.{type}_manual_override_{name} on Enables detection of manual overrides. A cover is marked if its position differs from the calculated one, resetting to adaptive control after a set duration.
button.{type}_reset_manual_override_{name} on Resets manual override tags for all covers; if switch.{type}_toggle_control_{name} is on, it also restores blinds to their correct positions.

When climate mode is setup you will also get these entities:

Entities Default Description
switch.{type}_climate_mode_{name} on Enables climate mode strategy; otherwise, defaults to the standard strategy.
switch.{type}_outside_temperature_{name} on Switches between inside and outside temperatures as the basis for determining the climate control strategy.

Installation

HACS (Recommended)

Add GitHub - basbruss/adaptive-cover: An Adaptive Cover component for HomeAsisstant to control covers based on the sun's position as custom repository to HACS. Search and download Adaptive Cover within HACS.

Restart Home-Assistant and add the integration.

Manual

Download the adaptive_cover folder from the github. Add the folder to config/custom_components/.

Restart Home-Assistant and add the integration.

Graphs

Features Planned

  • Manual override controls part of v1.10

  • Time to revert back to adaptive control part of v1.10

  • Reset button part of v1.10

  • Wait until next manual/none adaptive change

  • Algorithm to control radiation and/or illumination

latest release

7 Likes

I think it’s absolutely great that we are continuing to develop in terms of covers, blinds and roller shutters.
For a long time, there were hardly any useful solutions in HA.
And there are many countries where cover control is one of the most sought-after functions.

Whether FHEM, NodeRed or HomeAssistant-YAML, blind control was always my first automation.

Thank you very much for the integration.

1 Like

This is very cool! Thanks for seeting this up!
Some more ideas :slight_smile:

  • Connect with the workday integration to change behaviour for (home office) rooms on weekends
  • Sunset position could be optional. Probably this is often defined by other automations.

Great work!

If not already covered by this, I’d like to set illumination thresholds for the cover to close/open.

Hello @basbrus,

It’s a great discover for me. I’ve search for this when i’ve switch to HA. So thanks for that.

I’ve few question to better understand how to configure it.

  • If i don’t want to work with glare reducing but only close cover to block all sun, i can configure “Shaded area” to minimum value. That’s right ?
  • Do you automatically add 180° to the azimuth of the window to have full “sun in the window” scope? Is it the 90° on left and right parameters ?
  • “Default position” is the cover position when it’s not calculated ? That’s right ?
  • “Presence Entity” need to be a device_class presence ? Or a boolean ? What do you expect ? I want to use my alarm to specify presence. I’ve already a boolean but in lock device_class.
  • Which attribute of sun.sun do you use for define sunset ? Same question for sunrise that seems to be in beta/dev
  • Manual override controls seems to be already in beta. That’s right ?

To describe what I was doing before switching to HA, it was :

I use an outdoor lux sensor to be as faithful a s possible to the opening and closing of the covers at sunrise or sunset.
In fact, on cloudy days, the lux values are more representative and avoid opening or closing the covers too early or too late.

So if lux levels are :

  • Equal to or lower than a set value when the previous value was higher, I’m in sunset mode and so I close the shutters.
  • Equal to or greater than a set value when the previous value was lower, I’m in sunrise mode and so I open the shutters.

But I continue to use sunrise or sunset times in case of problems with my outdoor lux sensor (status unknown).

  • When sunrise (based on my lux sensor or time as explain before) i open covers but only if i’m here (based on my alarm status) or when i wake up (alarm no more in night status)
  • When it’s hot outside, I close the cover to block out the sun (adaptive). But when it’s very hot outside, I close the cover completely to keep the heat out.
  • During day, if cover is manually move, automation is disabled and after a duration (setting) automation is re-enabled.
  • At sunset (based on my lux sensor or time as explain before) i can close my covers.

I think with your amazing integration, i’m already able to do 90% of my old automation. Only lack is the lux sensor and i don’t know if that make sens for you to integer this feature.

Thank you

1 Like

Hi,

That is theoretical possible, but it’s better in that case to disable the adaptive control and set the position by an automation yourself. As this integration priorities available daylight without glare over full warming up protection when present.

No, the integration adds the degrees independently for the left and right side from the field of view options. The could have a maximum of 180 degrees (90 left + 90 right)

Correct :rocket:

It supports all types of device classes from these domains ["device_tracker", "zone", "binary_sensor", "input_boolean"]. Where the positive value, e.q. true or on is considered as presence.

None, it uses the astral python package, which is actually the same as HA core uses.

Light control is definitely something to look into but via lux or irradiance sensors. Maybe a third mode that takes minimum light levels over glare reducing although implementation can differ between types of blinds.

It’s not beta anymore Release v1.1.0 ⛅ · basbruss/adaptive-cover · GitHub

Hi

The main goal of the integration is to reduce glare from direct sunlight on a predefined (working) area.
Next to that it provides a climate mode which tries to help with energy efficiency as second goal. It will always prefer glare reduction over anything else. With no presence there is no need to reduce glare, so it switches to be as energy efficient as possible for the indoor climate.

I understand that personal preferences can sometimes differ then from what the integration provides. The integration only tries to guide you to the best possible position while maintaining as much possible natural day light.

Therefore the integration aims to give to best position based on the variables, users’ preferences IMHO can be better automated by a personal automation that toggles the adaptive control switch we other positions than the calculated ones are preferred.

For the points it’s probably best to automate the toggle control switch and take over control with the automation itself. :wink:

Thank you.
It’s very clear. I will make some tests on your integration and identify which process will be the better for me.

Thank you

Hi
First thank you for your integration, it looks very interesting
However I have 2 questions regarding some entities created :
What’s the use of the switch.xxxx_outside_temperature_xxx?
And what is the control method sensor for? How does it changes?

Both are covered in the documentation.


  • winter indicates the temperature is below the minimum comfort temperature
  • summer indicates the temperature is above the maximum comfort temperature
    If switch.{type}_outside_temperature_{name} is on it will use the outside temperature or weather entity to compare with the set comfort temperature thresholds.

Wow. This is very very cool. Thank you!

Why is the “Adjust the height of the awning from the ground” a must have when I have a cover? Or ignore the Integration this?