Setting up automatic shading using automations and scenes - Feedback for my approach

I’m currently trying to setup automatic shading in Home Assistant. I have a basic setup running, but there are still some open questions. I thought I share my setup, to get some feedback or new ideas on how to improve.
Disclaimer: I’m not sure this is complete overkill or overthinking, but let me know what you think. Also sorry for my bad English, it is not my mother tongue.
In the end, there will be a chapter, summarizing all my open questions. But let’s start.

What should it do?

  • Adjust the blinds for individual rooms
  • Start and end the automatic shading depending on time, outside weather or temperature in the individual room
  • Stop automatic shading, when it is not needed anymore
  • Stop automatic shading in a specific room, if a family member does not want the shades to be down
  • Stop automatic shading for the house, if a family member does not want the shades to be down
  • Do not shade if a storm is approaching

Automatically turn on and off automatic shading for the house

  • I created a switch (Helper) to enable automatic shading for the house: Switch_automatic_shading
  • I created switches (Helper) to enable automatic shading for each room (the system is allowed to shade this room): Switch_shading_room_name
  • I created switches (Helper) to have a state setting for automatic shading for each room (is the room shaded or not): Switch_shading_state_room_name

Automation to turn on automatic shading:

  • Trigger: if it is ‘7:00’ OR if the ‘Sun rises’ OR if ‘Storm_protection’ switches to off
  • Condition: AND-condition for the following - Switch_automatic_shading is off, Storm_protection is off, it is between 07:00 and 20:00
  • Action: Turn on Switch_automatic_shading and all Switches Switch_shading_room_name

Automatically turn off automatic shading for the house

  • Trigger: if it is ‘20:00’ or if the ‘Sun set’ or if ‘Storm_protection’ switches to on
  • Condition: Switch_automatic_shading is on
  • Action: Turn off Switch_automatic_shading and all Switch_shading_room_name

Automatically turn on and off automatic shading for a room

  • For each room I created a scene to set the tilt angle of all blinds in the room: Scene_shading_room_name
  • Input Helper: max_temperature_outside (if this is reached, the room should be shaded)
  • Input Helper: min_temperature_outside (if this is reached, the room should not be shaded)
  • Input Helper: max_temperature_room (if this is reached, the room should be shaded)
  • InputHelper: min_temperature_room (if this is reached, the room should not be shaded)
  • I created a template Sensor for the sun’s azimuth in degrees

Automation to turn on automatic shading in a room (I created an automation for each room):

  • Trigger: The sun’s azimuth changes state (I wanted to trigger this with what ended up under condition, but I could not get it to work)
  • Condition: Now it gets complicated – AND (all the following conditions must be met):
    • Switch Switch_automatic_shading is on
    • Switch Switch_shading_room_name if on
    • Switch Switch_shading_state_room_name if off
    • OR: it is between 08:00 and 20:00 weekdays OR it is between 10:00 and 20:00 weekdays (these timeframes are different for each room, because teenager sleep till noon :wink:)
    • The sun’s azimuth is between a room specific min and max value
    • OR: the room temperature is above max_temperature_room OR the predicted outside temperature for the day is above max_temperature_outside
  • Action: Activate Scene_shading_room_name and set state of Switch_shading_state_room_name to on

Automatically turn off automatic shading in a room (I created an automation for each room):

  • Trigger: The sun’s azimuth changes state
  • Condition: AND (all the following conditions must be met):
    • Switch Switch_automatic_shading is on
    • Switch Storm_protection is off
    • Switch Switch_shading_room_name if on
    • Switch Switch_shading_state_room_name if on
    • OR: the room temperature is below min_temperature_room OR the predicted outside temperature for the day outside temperature is below min_temperature_outside
  • Action: Open shades in this room and set state of Switch_shading_state_room_name to off

Automation to turn off automatic shading in a room manually (I created an automation for each room):

  • Trigger: Switch_shading_state_room_name to off
  • Condition: AND (all the following conditions must be met):
    • Switch Switch_automatic_shading is on
    • Switch Storm_protection is off
  • Action: Open shades in this room and set state of Switch_shading_state_room_name to off

Automation to turn off automatic shading for the house manually(not implemented jet):

  • Trigger: Switch_automatic_shading to off or storm_protection to on
  • Condition:
  • Action: Open all shades, set state of Switch_shading_state_room_name to off, set state of Switch_shading_room_name to off

Questions and issues

  • Number of automations: These are quite a few (room specific) automations I had to setup. I have the feeling this could be solved much easier with a script and a parameter for the room (but I have no idea on how to ‘code’ scripts on this level :blush:).
  • Time frames for each room: The same applies to the individual timeframes for shading each room. In the end 3 different time frames are relevent (normal_people_weekdays, normal_people_weekends, teenager_weekends) - but I consider this a minor inconvenience.
  • Scenes: Is there a way to manually adjust the parameter of the Scenes? As for now, I set the tilt angle via the physical switch, and it is not the same for each room (and that drives me nuts). I tried setting this up via automations, instead of scenes, but this did not work reliably for some reason (sometimes it tilted, sometimes not).
  • Sun’s Azimut: This is a struggle, as the min and max value changes during the year. As for now, I just use values for mid of June as a basis, but it is not optimal. Is there a way to generate dynamic values depending on the date (maybe an online service, a plugin, or better a way to do this locally?)
  • Weather conditions: I tried adding conditions like the weather must be ‘sunny’, but this did not work reliably. Weather conditions change to rapidly in the Swiss mountains and I struggle with conditions like ‘partly cloudy’ (sometimes this is sunny). Also, often the weather plugin does not provide this information reliably.

Final words

This is the longest Post I have ever written, and I hope it makes sense. Please be gentle with the feedback, I’m still learning :blush:. And the setup I described works for the 15 window blinds with the limitation mentioned above.

What do you think?