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
That shouldn’t be possible. If the value hasn’t changed the last_updated
property of the template should remain the same and the automation won’t trigger. Can you check the automation traces to see if and what exactly happened?
i look at the logbook entries,
Rollade Wohnzimmer wurde geöffnet ausgelöst durch Automatisierung Sonnenschutz - Wohnzimmer Automatisch ausgelöst durch Zustand von Sun
10:43:19 - Vor 34 Minuten
Rollade Wohnzimmer wird geöffnet ausgelöst durch Automatisierung Sonnenschutz - Wohnzimmer Automatisch ausgelöst durch Zustand von Sun
10:43:16 - Vor 34 Minuten
Rollade Wohnzimmer wurde geöffnet ausgelöst durch Automatisierung Sonnenschutz - Wohnzimmer Automatisch ausgelöst durch Zustand von Sun
10:35:19 - Vor 42 Minuten
Rollade Wohnzimmer wird geöffnet ausgelöst durch Automatisierung Sonnenschutz - Wohnzimmer Automatisch ausgelöst durch Zustand von Sun
10:35:16 - Vor 42 Minuten
Rollade Wohnzimmer wurde geöffnet ausgelöst durch Automatisierung Sonnenschutz - Wohnzimmer Automatisch ausgelöst durch Zustand von Sun
10:27:18 - Vor 1 Stunde
Rollade Wohnzimmer wird geöffnet ausgelöst durch Automatisierung Sonnenschutz - Wohnzimmer Automatisch ausgelöst durch Zustand von Sun
10:27:16 - Vor 1 Stunde
Rollade Wohnzimmer wurde geöffnet ausgelöst durch Automatisierung Sonnenschutz - Wohnzimmer Automatisch ausgelöst durch Zustand von Sun
10:19:18 - Vor 1 Stunde
Rollade Wohnzimmer wird geöffnet ausgelöst durch Automatisierung Sonnenschutz - Wohnzimmer Automatisch ausgelöst durch Zustand von Sun
10:19:16 - Vor 1 Stunde
Rollade Wohnzimmer wurde geöffnet ausgelöst durch Automatisierung Sonnenschutz - Wohnzimmer Automatisch ausgelöst durch Zustand von Sun
10:11:19 - Vor 1 Stunde
Rollade Wohnzimmer wird geöffnet ausgelöst durch Automatisierung Sonnenschutz - Wohnzimmer Automatisch ausgelöst durch Zustand von Sun
10:11:16 - Vor 1 Stunde
and here is the BP automation
If you set the minimum percentage change higher than 0 this should not happen.
Another weird thing is that it seems to trigger twice 3 seconds apart each time. While there are usually minutes between a position change of the sun
Hi and thanks for the awesome blueprint!
If I’m not mistaken, the first condition always evaluates to true when the default_height is equal to cover_height. Because of logical or
and this condition → cover_height in [default_height, default_template]
So if you take the blueprint and let the default_height stay at 100, and your covers are already at 100 and the automation triggers because of the sun’s state change and calculates 100 as well, and the second condition also evaluates to true because enough time has passed, your cover will get a new position which is the same as it already is.
So essentially as long as default_height == cover_height
it will only check if enough time has passed and wont take into account the minimum percentage to change.
That’s why my covers click every 10 minutes with no change to the position.
Thank you,
I guess you are correct, I will update the template when I find some time with an additional check to see if the default height is not already the current position
The new condition will be:
value_template: >
{%set position = state_attr(cover_entity.entity_id,'current_position')%}
{{ ((position | float - cover_height | float) | abs > change_threshold)
or (cover_height in [default_height, default_template] and position not in [default_height, default_template])}}
With the added condition that the current position should not already be the default.
is the template in the new BP? or must i add it manually?
my blueprint / Automation looks now so
alias: Sonnenschutz - Wohnzimmer Automatisch
description: ""
condition:
- condition: and
conditions:
- condition: template
value_template: >
{%set position =
state_attr(cover_entity.entity_id,'current_position')%} {{ ((position
| float - cover_height | float) | abs > change_threshold) or
(cover_height in [default_height, default_template] and position not
in [default_height, default_template])}}
- condition: template
value_template: "{{states('input_boolean.sonnenschutz_rolladen_wohnzimmer') == 'on'}}"
use_blueprint:
path: basbruss/cover_height_sun.yaml
input:
cover_entity:
entity_id: cover.rollade_wohnzimmer
max_height: 1.5
change_threshold: 1
action_condition:
- service: notify.mobile_app_iphone_von_marc_2
data:
title: Smarthome
message: |
Automatische Rolladen Steuerung - Wohnzimmer ({{cover_height}}%)
enabled: false
time_out: 5
condition_on: true
azimuth: 45
default_template: |-
{% set zeit = states('sensor.time') %}
{% if '08:00' <= zeit <= '18:30' %}100{% else %}0{% endif %}
default_height: 100
Hello,
Any updates for tilted, not vertical, sunscreens?
I would love to use it but I have roof blinds with a tilt of about 35°
Thanks for the blueprint it looks great!
Hello, unfortunately I have not had the time to work out the math yet. In the meantime you could try using the blueprint anyway, but just keep in mind that the shadow is calculated as if the blind was vertical. So it’s not optimal, but it will work.
Yeah, the updated blueprints can be found on the repo for this project.
The GitHub Repo includes the newly updated blueprints.
It also features a custom template macro that you can add as custom repo within HACS if you use HACS in experimental mode.
And maybe it will be added soon to HACS as default and should be found in the HACS store.
PR to add it to HACS default is still under review from HACS
I realy love this BP and the automation works great!!
Is there a possibilty to check if i have manually adjusted the Blinds to a lower position it will stay this way until the sun moves which needs the blinds to go lower? For example sometimes i like to lower the blinds in the bedrom for some privacy but want them to adjust with the sun. But the automation forces them to go upwards, if they are lower then the calculated hight.
After 1.05 my blinds don’t move anymore. Anyone else with this problem? Back to 1.03, everything’s fine again
You could change the condition to something like this:
value_template: >
{%- set position = state_attr(cover_entity.entity_id,'current_position') -%}
{{ (((position | float - cover_height | float) | abs > change_threshold) and (cover_height < position))
or (cover_height in [default_height, default_template] and position not in [default_height, default_template])}}
Don’t know if you have to pipe a data type to cover_height
and position
there, but you get the idea
Edit: Just to clear things up, this way the blinds will only ever go down and never up automatically.
Sounds Great, but still a beginner here… Where do I put this code? This is my yaml. from the automation
alias: Cover Height_Buero_Automatik
description: ""
use_blueprint:
path: langestefan/auto_sun_blind.yaml
input:
cover_entity:
entity_id: cover.hmip_broll_2_00369f29974cf9_buero
azimuth: 280
distance: 0.1
default_height: 100
minimum_position: 24
condition_mode: or
condition:
- condition: state
entity_id: input_boolean.automatikmodus_verschattung_buro
state: "on"
Didnt saw your edit. I would only want the blinds to stay down if i adjust them manually but lower if they need to. Undestandable?
That would be great
That’s not something easily achievable, since there are many things to consider.
Have a look at @htpc2308 post: Automatic blinds / sunscreen control based on sun platform - #88 by htpc2308 to get an idea how to distinguish who triggered manually (eg. was it the automation, via UI or via physical switch?). The combination of different context attributes tells you were it did come from. But to distinguish the source is in itself is a rabbit hole to go down
And then there’s this post from @dario2 → Automatic blinds / sunscreen control based on sun platform - #88 by htpc2308
Which also outlines a way to get an outside control mechanism into the automation (a boolean which can be toggled). In his automation he uses the assumption, that if the cover was moved more than 3 seconds ago from the last time the automation ran, it was likely a manual input and toggles the boolean helper.
My little code snippet was a direct edit in the blueprint’s code. It would make the automation only lower the blinds automatically, a one-direction-automation so to say ^^
Thank you very much, Ill take a dive into that !