Automating Roller Shutters: Following the sun with time constraints

Automating Roller Shutters: Following the sun with time constraints

Welcome to another exciting tutorial of my?Tips & Tricks?newsletter on?Home Assistant.

As a home automation enthusiast, I'm always on the lookout for new ways to make my life easier as well as smarter and I'm excited to share my latest ideas with you.

So, if you're ready to take your home automation game to the next level, read on and don't forget to let me know your thoughts in the comments.

Your feedback will help me ensure that I'm providing the right content for you.

Thanks for being a valued reader! ??

In my house I have all the roller shutters controlled by Home Assistant so that I can get them automatically open / close at a specific times or close them when sun sets.

This is super convenient and makes my life easier of course but, since the days are longer and the sun sets later and later, let all the roller shutters get automatically closed at sun sets could be a little bit late especially for some rooms of my house.

In order to manage this situation, I've modified my current automation in charge to close the roller shutters at sun sets so that now, it will close them when the sun goes down but not later then 8.30 PM.

Do you want to know how to do it? Keep reading this tutorial!

Hardware configuration

  • Aeotec Z-Stick Gen5+. It's a Z-Wave gateway to build up and manage your Z-Wave network
  • Aeotec Nano Shutter. It's a Z-Wave device that integrates with motors (garage doors, shutters, gates and so on) allowing you to control them wirelessly

Software configuration

Procedure

First of all you have to configure an input datetime helper (time only) used as time trigger for the new automation in charge to close the roller shutters.

This is the one I've configured:

No alt text provided for this image

The second step is take the benefits from the sun integration mentioned above to get the next time sun will set:

No alt text provided for this image

Please consider the time highlighted above is reported in UTC ISO-8601 format.

The third step is to create an automation in charge to store the time above in the

input_datetime.timesunset helper:

alias: RollerShutter - Set sunset helper with the sun set time of the current day
description: RollerShutter - Set sunset helper with the sun set time of the current day
trigger:
? - platform: time
? ? at: "12:00:00"
condition: []
action:
? - if:
? ? ? - condition: template
? ? ? ? value_template: >-
? ? ? ? ? {{state_attr('sun.sun', 'next_setting')| as_timestamp |
? ? ? ? ? timestamp_custom('%H:%M:%S') > '20:30:00' }}
? ? then:
? ? ? - service: input_datetime.set_datetime
? ? ? ? data:
? ? ? ? ? time: "20:30:00"
? ? ? ? target:
? ? ? ? ? entity_id: input_datetime.timesunset
? ? else:
? ? ? - service: input_datetime.set_datetime
? ? ? ? data:
? ? ? ? ? time: >-
? ? ? ? ? ? {{state_attr('sun.sun', 'next_setting')| as_timestamp |
? ? ? ? ? ? timestamp_custom('%H:%M:%S') }}
? ? ? ? target:
? ? ? ? ? entity_id: input_datetime.timesunset
mode: single        

Some specifics about the code above

This automation is triggered to run everyday at 12:00:00

If the next sun set time provided by the sun integration is before 08:30PM, then the time stored in the input.datetime helper will be the same provided by the sun integration.

If the next sun set time provided by the sun integration is after 08:30PM, then the time stored in the input.datetime helper will be set to 08:30PM.

The fourth and last step to do is modify the current automation to close the roller shutters used till now:

alias: Kids room - Closing roller shutter for night
description: Kids room - Closing roller shutter for night
trigger:
? - platform: sun
    event: sunset
condition: []
action:
? - service: cover.close_cover
? ? data: {}
? ? entity_id: cover.nano_shutter_v_3_2
mode: single
        

So that it will be as follows:

alias: Kids room - Closing roller shutter for night
description: Kids room - Closing roller shutter for night
trigger:
? - platform: time
? ? at: input_datetime.timesunset
condition: []
action:
? - service: cover.close_cover
? ? data: {}
? ? entity_id: cover.nano_shutter_v_3_2
mode: single        

I'm available for any feedback so, feel free to contact me or share your thoughts in the comments section below.

Your feedbacks will be very appreciated!

I do hope this new article has been helpful, I encourage you to?subscribe?to my newsletter about?Home Assistant?so that you will be the first to know about my new tutorials!

Thanks for reading and stay powered up!

要查看或添加评论,请登录

Emiliano Guerzoni的更多文章

社区洞察

其他会员也浏览了