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 !
i n the meantime i adapted the code from Automatic blinds / sunscreen control based on sun platform - #106 by naschine
here is my automation from the Blueprint
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
and here is my second automation to control if a human has activated a cover and a time based trigger
alias: Sonnenschutz - Zeitplan 08:00 | 18:30 + Manuelles eingreifen
description: ""
trigger:
- platform: time
at: "08:00:00"
id: trigger_morning
enabled: true
- platform: time
at: "18:30: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
- platform: state
entity_id:
- cover.rolladen_kinderzimmer
attribute: current_position
id: trigger_cover_kinderzimmer
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: trigger_morning
sequence:
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.sonnenschutz_rollade_schlafzimmer
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.sonnenschutz_rolladen_wohnzimmer
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.sonnenschutz_rollade_kinderzimmer
alias: ausgelöst durch 08:00
enabled: true
- choose:
- conditions:
- condition: trigger
id: trigger_evening
sequence:
- service: input_boolean.turn_off
data: {}
target:
entity_id: input_boolean.sonnenschutz_rollade_schlafzimmer
- service: input_boolean.turn_off
data: {}
target:
entity_id: input_boolean.sonnenschutz_rolladen_wohnzimmer
- service: input_boolean.turn_off
data: {}
target:
entity_id: input_boolean.sonnenschutz_rollade_kinderzimmer
alias: ausgelöst durch 18:30
enabled: true
- choose:
- conditions:
- condition: and
conditions:
- condition: trigger
id: trigger_cover_wohnzimmer
- condition: template
value_template: >-
{{as_timestamp(now()) -
as_timestamp(state_attr('automation.sonnenschutz_wohnzimmer_automatisch','last_triggered'))
> 3 }}
sequence:
- service: input_boolean.turn_off
data: {}
target:
entity_id: input_boolean.sonnenschutz_rolladen_wohnzimmer
alias: Wenn Rollade Wohnzimmer durch Mensch ausgelöst
- choose:
- conditions:
- condition: and
conditions:
- condition: trigger
id: trigger_cover_schlafzimmer
- condition: template
value_template: >-
{{as_timestamp(now()) -
as_timestamp(state_attr('automation.sonnenschutz_schlafzimmer_automatisch','last_triggered'))
> 3 }}
sequence:
- service: input_boolean.turn_off
data: {}
target:
entity_id: input_boolean.sonnenschutz_rollade_schlafzimmer
alias: Wenn Rollade Schlafzimmer durch Mensch ausgelöst
- choose:
- conditions:
- condition: and
conditions:
- condition: trigger
id: trigger_cover_kinderzimmer
- condition: template
value_template: >-
{{as_timestamp(now()) -
as_timestamp(state_attr('automation.sonnenschutz_rollade_kinderzimmer','last_triggered'))
> 3 }}
sequence:
- service: input_boolean.turn_off
data: {}
target:
entity_id:
- input_boolean.sonnenschutz_rollade_kinderzimmer
alias: Wenn Rollade KinderZimmer durch Mensch ausgelöst
mode: single```
Cant get it to run. Even made a fresh import with .3 and .5… It always says Executed: 27. Juni 2023 um 11:39:16 Result: params: domain: cover service: set_cover_position service_data: position: 100 entity_id: - cover.hmip_broll_001118a98bc30d_esszimmer target: entity_id: - cover.hmip_broll_001118a98bc30d_esszimmer running_script: false limit: 10
Wont move. also the lines 280 and 300 have th %- as describes before.