Objective

Iโ€™ve talked about shading with blinds before right here, but getting them sorted for our bedroom needed some special tweaks. We love waking up to natural light, but not when the sun blasts in three hours too early. Since our bedroom faces east, and it starts getting bright around 5 AM in the summer, itโ€™s been a bit of a struggle, especially when we usually get up at eight.

Ideally, the blinds should open a few minutes before we get up. However, as we don’t always get up at the same time, I have used the set alarms from both phones as a trigger, and the blinds should be raised 15 minutes before the alarms. But since we each have our own alarm set, it was necessary to deal with situations where the alarms are too close together in time (two unnecessary actions) and where they are too far apart (the person who has the alarm set later will be able to sleep in a bright room for up to a few hours). Details are in the section Automation Logic

Hardware and Integration with Home Assistant

Itโ€™s pretty much the same deal as with our other blinds, which I covered over here.

Automation Logic

The logic is written in AppDaemon, which allows you to run Python code and interact with Home Assistant.

The app checks the alarms set on both phones early in the morning:

  • If there are no alarms set, the blinds are raised at 9:00.
  • If only one alarm is set, the blinds open fully 15 minutes before the alarm is set.
  • If both alarms are set:
    • If they are less than 30 minutes apart, the blinds are raised 15 minutes before the earlier alarm and the later alarm is ignored.
    • If the interval is greater, the blinds are partially opened (tilt only - enough to let light through) 15 minutes before the first alarm. 15 minutes after the alarm, they are closed back to avoid disturbing the sleeper. Again, 15 minutes before the second alarm, the blinds are fully opened and remain so throughout the day.

In the evening, the regime is as follows:

  • At 22:00, the blinds are lowered but remain in the horizontal position. There are two reasons for this, the room feels more open and allows better ventilation with the window open in summer.
  • At 4:00 the blinds close completely in anticipation of morning light.