Automatic blinds / sunscreen control based on sun platform

@paddy0174 @basbrus I completely agree :+1:.

2 Likes

I still have problems with the rear window, and as you can see in the picture, the window is completely full of sun, but the window was only set to 34% open

the azimuth is 225* over openstreetmaps. Have you perhaps a idea?

the template code is correct in this format?

because when i edit the automation in yaml he escapes the ".

default_template: "{% if now().strftime('%H%M') <= \"18:30\" %} 100 {% else %} 0 {% endif %}"

If you want more shade then you have to set the distance from the cover to shaded area lower (distance). Also check the picture in the original post.

1 Like

Yes that should probably work, be aware that the default gets reset to 100 at midnight with this condition. What would result in opening the covers just after midnight when the sun has changed position.

1 Like

ah, okay, thanks for the info, Iā€™ll turn off the automation in the evening, but just for the sake of correctness, i should define from XXX to XXX, right?

something like this?

{% set state = states('sensor.time') %}
{% if '08:00' > state < '18:00' %}
100
{% else %}
0
{% endif %}

here is my automation, perhaps someone find it useful

alias: Sonnenschutz - Zeitplan 08:00 | 18:00  + Manuelles eingreifen
description: ""
trigger:
  - platform: time
    at: "08:00:00"
    id: trigger_morning
    enabled: true
  - platform: time
    at: "18:00:00"
    id: trigger_evening
    enabled: true
  - platform: state
    entity_id:
      - cover.rollade_wohnzimmer
    attribute: current_position
    id: trigger_cover_wohnzimmer
  - platform: state
    entity_id:
      - cover.shellyswitch25_3c6105e367cc
    attribute: current_position
    id: trigger_cover_schlafzimmer
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: trigger_morning
        sequence:
          - service: automation.turn_on
            data: {}
            target:
              entity_id: automation.sonnenschutz_wohnzimmer_automatisch
          - service: automation.turn_on
            data: {}
            target:
              entity_id: automation.sonnenschutz_schlafzimmer_automatisch
    alias: ausgelƶst durch 08:00
    enabled: true
  - choose:
      - conditions:
          - condition: trigger
            id: trigger_evening
        sequence:
          - service: automation.turn_off
            data:
              stop_actions: true
            target:
              entity_id: automation.sonnenschutz_wohnzimmer_automatisch
          - service: automation.turn_off
            data:
              stop_actions: true
            target:
              entity_id: automation.sonnenschutz_schlafzimmer_automatisch
    alias: ausgelƶst durch 18:00
    enabled: true
  - choose:
      - conditions:
          - condition: and
            conditions:
              - condition: and
                conditions:
                  - condition: template
                    value_template: "{{ trigger.to_state.context.user_id is defined  }}"
                  - condition: template
                    value_template: "{{ trigger.to_state.context.id != none }}"
                  - condition: template
                    value_template: "{{ trigger.to_state.context.parent_id == none }}"
                  - condition: template
                    value_template: "{{ trigger.to_state.context.user_id != none }}"
              - condition: trigger
                id: trigger_cover_wohnzimmer
        sequence:
          - service: automation.turn_off
            data:
              stop_actions: true
            target:
              entity_id: automation.sonnenschutz_wohnzimmer_automatisch
    alias: Wenn Rollade Wohnzimmer durch Mensch ausgelƶst
  - choose:
      - conditions:
          - condition: and
            conditions:
              - condition: and
                conditions:
                  - condition: template
                    value_template: "{{ trigger.to_state.context.user_id is defined  }}"
                  - condition: template
                    value_template: "{{ trigger.to_state.context.id != none }}"
                  - condition: template
                    value_template: "{{ trigger.to_state.context.parent_id == none }}"
                  - condition: template
                    value_template: "{{ trigger.to_state.context.user_id != none }}"
              - condition: trigger
                id: trigger_cover_schlafzimmer
        sequence:
          - service: automation.turn_off
            data:
              stop_actions: true
            target:
              entity_id: automation.sonnenschutz_schlafzimmer_automatisch
    alias: Wenn Rollade Schlafzimmer durch Mensch ausgelƶst
mode: single

Still looking for the best option to deactivate the cover automation when my wife is walking out on the terrace.
Pretty sure in most cases she will forget to activate automation again.

Is there any window contact switch which is good for hassio? Maybe tasmota flashable?

Perhaps a mmwave sensor from aqara? They are very accurate and allow zoning. Otherwise I have very good experiences with the aqara doorsensor.

1 Like

Thanks! will check that.
Edit:
The aqara doorsensor looks amazing. Do I just need a Sonoff ZBBridge Pro and Iā€™m ready to go? Or is there a better solution?

Today I changed the ā€œtime-outā€ variable to my windows of one direction of 15min to 12, 13, 14 and last 15min (W,N,E,S).
Reason was, that the covers did not all work. Sometimes 1 of X covers did not move.
I am not sure if the reason is KNX (all of my covers are on a MDT shutter actor) - the connection from HA to KNX bus.
Now itā€™s working flawless.

I personally use Zigbee For Home assistant (ZHA) with a sonoff zigbee 3.0 usb dongle plus. But there are many options, both for dongle/hub and platform (many people run Zigbee2MQTT instead of ZHA). The majority of my house runs on zigbee. Lights, doorsensors, temp/humidity etc. Itā€™s an entirely new rabbit holeā€¦

No, you donā€™t want a Bridge, that is exactly what everyone is trying to avoid. :rofl: What you need is a simple Zigbee dongle. There are numerous variants out there, what you take is depending on your personal choice and how long you want to work with this dongle.

See here for an extensive list:

I personally use the dongle from Slaesh (under recommended), but if I had to buy one now, Iā€™d probably go with the HomeAssistant dongle (most likely) or the Sonoff 3.0 (find them here)

And Iā€™d advise to take a look at the offers you get in the LIDL online shop (sounds like youā€™re from Germany). They do have door contact sensors as well. They are a little bit cheaper, but bigger, compared to the Aqaras.

But, and that would be my last, but most important advice: from now on, before you buy a Zigbee device, check if it is compatible with Zigbee2MQTT. If so, youā€™re good to go. If not, look for something different. :slight_smile:

The list for the supported devices is here:

1 Like

yeah Iā€™m german. thanks a lot for your advices! :slight_smile:

I donā€™t want to ā€œspamā€ this thread, sorry, so just one last post with another recommendation. :blush:

I use a lot of different brands and devices in my home, but lately Iā€™ve got stuck a few times in the LIDL online shop. :crazy_face: My most liked device from there is the Zigbee multiple socket outlet. :smiley:

Itā€™s simple, works as a repeater in the network and you can switch each socket on and off seperately. :slight_smile: I use these eg for my media devices, to really switch them off. My Sony TV needs 3.8W in stand-by, thatā€™s not tolerable. :rofl:

If you want to go deeper, please just open a new thread, as we canā€™t high jack this one. :slight_smile:

Hi
I wanted to make limitations in this BP to NOT operate when this is not needed.
First issue - weather. Only if sunny or partly cloudy (so far this was only weather here) + temperature inside.
Second I tried to use sunrise and sunset, but then on early morning when automation started, it is opening shutters and wakes me up.

So I tried to use condition:

alias: Falo Cover Height
description: ""
use_blueprint:
  path: basbruss/cover_height_sun.yaml
  input:
    azimuth: 99
    default_height: 100
    minimum_position: 40
    degrees: 50
    change_threshold: 5
    time_out: 0
    action_condition:
      - condition: and
        conditions:
          - condition: numeric_state
            entity_id: sensor.faloprinter_si7021_temperature
            above: 22
          - condition: or
            conditions:
              - condition: state
                entity_id: weather.home
                state: partlycloudy
              - condition: state
                entity_id: weather.home
                state: sunny
      - condition: device
        device_id: d4265e3683f4a67dc1dd159e2c9e2192
        domain: cover
        entity_id: cover.faloshutter_cover_1
        type: is_open
    max_height: 1.2
    cover_entity:
      entity_id: cover.faloshutter_cover_1

But those conditions doesnā€™t workā€¦ DId I do something wrong? Or BP have some issue?

Yeah I noticed that too. I have just released a new blueprint which splits the extra conditions and actions.
you can find it here: GitHub - langestefan/auto-sun-blind: Automatically control your sun blinds via home assistant based on the position of the sun.

Apparently conditions within a certain sequence do not stop the full automationā€¦

Awesome, thank you!
And if I would like to have 3 conditions or more?

Aha, I just found typo in your code:
Line 268
conditio: !input condition

Shouldnā€™t be condition?

1 Like

Thatā€™s true, just fixed the typo in the repo :smile:
Yeah you can build as many conditions as you want in the input field

1 Like

Hey guys,
first of all a big thank you for this awesome blueprint and the ingenious jinja macro. Itā€™s trigonometry at its best :smiley:
If someone is wondering how to implement a simple ā€œmanual overrideā€ that deactivates the automation, hereā€™s my fairly easy idea that has been working quite well for me.
(1) Create a boolean helper called something like ā€œauto blind manual overrideā€.
(2) Now hereā€™s the main idea: when you blinds move, but the auto-blind-automation wasnā€™t triggered recently, then probably somebody has manually adjusted the blinds, no matter if through HA or through a physical button. So you need an automation that switches the boolean helper (action) if your blinds move (trigger), but only when the move of blinds is not associated with the auto-height automation (condition). Hereā€™s my automation:

alias: "[Blinds] Manual override"
description: ""
trigger:
  - platform: template
    value_template: "{{is_state('binary_sensor.rollo_links_running','on')}}"
    enabled: true
condition:
  - condition: template
    value_template: >-
      {{as_timestamp(now()) -
      as_timestamp(state_attr('automation.blinds_auto_height_when_at_home','last_triggered'))
      > 3 }}
action:
  - service: input_boolean.turn_on
    data: {}
    target:
      entity_id: input_boolean.auto_blind_manual_override

Of course the trigger can be realised without the template but through a device change instead or whatever you prefer. The condition basically just calculates the time difference between now and when the auto-height automation was last triggered, and if thatā€™s > 3 seconds it would mean that probably something else than the auto-height blueprint triggered the move of blinds. Youā€™d have to test how low you can set it so itā€™s still working, I wanted to make sure my blueprint doesnā€™t trigger the boolean false-positively. Leaves a slight chance of course you just adjusted the blinds after the automation fired, which wouldnā€™t trigger the automation, but hey.
(3) Add the boolean as a condition to your auto-height-automation. I just added a condition in YAML before the use blueprint line:

condition:
  - condition: template
    value_template: "{{states('input_boolean.auto_blind_manual_override') == 'off'}}"
use_blueprint:
  path: basbruss/cover_height_sun.yaml
...

Ah, and of course the boolean can be reset through anything you wantā€¦ a button, at midnight, ā€¦, which would then allow the auto-height-automation again.

1 Like

I noticed a strange behavior when the BP moves the shutter to 100% open, and then it is triggered again, and the value is then 100% again, the BP triggers a command to the shutter, and this happens all the time, that means my roller shutter motor keeps making noises, so it would make sense to check whether the value to be set is a change from the previous one and if 100% open then donā€™t do anything.

you have a typo

{{as_timestamp(now()) -
      as_timestamp(state_attr('automation.blinds_auto_height_when_at_home','last_triggered'))
      > 3 }}

you forgot the }} at the end

1 Like