Hello everyone
I started to setup my blinds rules but I’m currently stucked with one key feature.
Is there something like a timeout for rules?
Here is my current setup and the detailed problem:
First I have a rule which uses astro items to locate the position of the sun:
astro.items
Number Azimuth "Azimuth [%d]" { channel="astro:sun:home:position#azimuth" }
Number Elevation "Elevation [%d]" { channel="astro:sun:home:position#elevation" }
And then a rule which updates 4 “proxy”-variables about the postion:
import math
val house_east = 67
val house_south = 157
val house_west = 247
val house_north = 337
rule sun_position
when
Item Azimuth received update
then
val azimuth = Math::round((Azimuth.state as DecimalType).intValue)
val elevation = Math::round((Elevation.state as DecimalType).intValue)
//logInfo("sendInfo","Sonne steht bei " + azimuth + " und " + elevation + ".")
// größer 337° und kleiner 360° oder größer 0° und kleiner 157° --> Sonne aus Richtung Osten
if (((azimuth > house_north && azimuth < 360 ) || (azimuth > 0 && azimuth < house_south)) && elevation > 10) {
logInfo("sendInfo","Sonne auf Ostseite.")
Sun_On_Eastside.sendCommand(ON)
}
// größer 67° und kleiner 247° --> Sonne aus Richtung Süden
if (azimuth > house_east && azimuth < house_west && elevation > 10) {
logInfo("sendInfo","Sonne auf Südseite.")
Sun_On_Southside.sendCommand(ON)
}
// größer 157° und kleiner als 360° --> Sonne aus Richtung Westen
if (azimuth > house_south && azimuth < 360 && elevation > 10) {
logInfo("sendInfo","Sonne auf Westseite.")
Sun_On_Westside.sendCommand(ON)
}
// größer 157° --> keine Sonne aus Richtung Osten
if (azimuth > house_south && elevation > 10) {
logInfo("sendInfo","keine Sonne aus Richtung Osten.")
Sun_On_Eastside.sendCommand(OFF)
}
// größer 247° --> keine Sonne aus Richtung Süden
if (azimuth > house_west && elevation > 10) {
logInfo("sendInfo","keine Sonne aus Richtung Süden.")
Sun_On_Southside.sendCommand(OFF)
}
// größer 337° --> keine Sonne aus Richtung Westen
if (azimuth > house_north && elevation > 10) {
logInfo("sendInfo","keine Sonne aus Richtung Westen.")
Sun_On_Westside.sendCommand(OFF)
}
end
And then a rule which uses these “Sun_On_*side” variables to roll down the blinds:
rule "close if sun hits window westside"
when
Item Sun_On_Westside received update
then
// ( cloud_percentage < 50 ) &&
// ( sensor == CLOSED ) &&
// ( setting not changed in <timespan> ) &&
if ( Sun_On_Westside.state == ON ) {
logInfo("sendLogInfo","Fenster Westseite schließen.")
eg_az_roll_level_4.sendCommand('80')
}
end
Now every time the azimuth variable is updated, the Sun_ON_*side is updated, and that triggers the rule to close the window. Which is basicly what it should do, but if a the blind is raised manually, after the next azimuth update, the blinds go down again. But that’s good because all the other condition (cloud_percentage, close_sensor, Sun_on_*side) can change and therefore should be able to trigger the rule anytime. But that’s also not that good, if you go out on the terrace and the blinds close behind you ;-).
What I would like to use, is some sort of timeout mechanism, something like “if button_for_blinds is used, then don’t use rule for 60 minutes, no matter the other changes”.
Does anybody know, how I could achieve this?
Many thanks in advance