Hi, i would like to automate my shutters. I have used simple triggers, based on input from my weather station. During stable weather this will work fine ( I assume, made this yesterday ). I will make a triggert that closes the shutters when it is going to rain or there is wind or it is cloudy. How do I avoid the situation that the shutters go up/down multiple times? For example when it the solar radiation flips multiple times a day from sunny weather to cloudy weather to sunny weather et cetera. I thought a counter would help, but I have to implement this. The trigger stops when the shutters are used for 5 times a day. Looking forward to your thoughts how to solve this use case! Thanks.
I implemented an condition where the cover is opened when the light variation is more than 50 lux. So it closes when the offset value has reached (input.number.drempel zonnig) and closes when it has 50 lux less than the offset value (for 5 minutes). And of cours it will open/close in timeframe, sundown and based on the rainsensor. See my implementation below:
alias: Zonwering automaat
description: ''
trigger:
- platform: state
entity_id: sun.sun
- platform: time
at: '09:00'
- platform: time
at: '18:00'
- platform: state
entity_id: sensor.pir_motion_sensor_with_temperature_sensor_illuminance_3
for:
minutes: 5
- platform: state
entity_id: sensor.rain
condition: []
action:
- choose:
- conditions:
- condition: time
after: '07:30'
before: '20:00'
- condition: state
entity_id: sun.sun
state: above_horizon
sequence:
- choose:
- conditions:
- condition: template
value_template: >-
{{
(states("sensor.pir_motion_sensor_with_temperature_sensor_illuminance_3")
| int ) > (states("input_number.drempel_zonnig") | int *
20 ) }}
- condition: state
entity_id: sensor.rain
state: 'False'
sequence:
- condition: state
entity_id: cover.screen_links
state: open
- service: switch.turn_on
target:
entity_id:
- switch.screen_links
- switch.screen_rechts
data: {}
default:
- condition: state
entity_id: cover.screen_links
state: dicht
- condition: template
value_template: >-
{{
(states("sensor.pir_motion_sensor_with_temperature_sensor_illuminance_3")
| int ) < (states("input_number.drempel_zonnig") | int * 20 ) - 50 }}
- service: switch.turn_off
target:
entity_id:
- switch.screen_links
- switch.screen_rechts
data: {}
default:
- condition: state
entity_id: cover.screen_links
state: dicht
- service: switch.turn_off
target:
entity_id:
- switch.screen_links
- switch.screen_rechts
data: {}
mode: single
Conceptually, it’s called hysteresis: it acts like a kind of memory to prevent reacting to changes that are too sudden by introducing lag. Temperature control systems typically uses this.
To prevent to many actions, its wise to implement delays (but not always )
So wind and rain will require immediate action when they occur, but after they clear the lux value should be able to close the shutters, just wait 10 minutes before doing that. Same for opening when the lux value drops, just wait a few minutes. That should account for days when you have cloudy weather and such.
There’s several things you need to take into account:
I see you use a PIR: A lot of PIR’s do not update luminance when there is no movement, make sure yours does or use a separate sensor.
Make sure the pir is not in the shade of your shutters / inside, as it is next to impossible to account for how much darker it will be with the shutters closed.
Using a hysteresis is great, but if the lux is read outside, 50 lux is way too little hysteresis. For sunshades I use way bigger hysteresis: Direct sunlight can be well over 30.000 lux, and for opening you’d probably want a value below 10.000 lux, though values may vary depending on the position of your sensor.
As suggested above, delays are your friend for light variations too, as hou do not want a short burst of light to lower directly, and neither do you want a short cloudyness to open them up.
Wind or rain should open them a.s.a.p. and also use a delay before they allow a new attempt to close in case of e.g. an awning.