Hi Carsten,steinigel hat geschrieben: ↑21. Apr 2020 19:26 Hallo,
ich habe den Code aus dem Beispiel verwendet, leider löst die Regel nicht aus.
Alle Jalousien sind der Gruppe gBlind zugeordnet.
Weiss jemand Rat?
Danke für Eure Hilfe.
Carsten
Code: Alles auswählen
rule "Jalousienautomatik" var String timeLast = 'xxxx-xx-xx' if (Rolloautomatik_start_last.state == NULL) { if (log) logInfo('rules', logPrefix + 'Erstmalige Ausführung am System, Belegung mit Initialwert') } else { timeLast = Rolloautomatik_start_last.state.toString().substring(0,10) } var String timeNow = now.toString().substring(0,10) if (Rolloautomatik.state == ON) { if (timeNow != timeLast) { if (Azimuth.state > Integer::parseInt(Rolloautomatik_azimuth_start.state.toString())) { if ((Temperature.state as number).floatValue > (Rolloautomatik_temp_min.state as number)) { if (Clouds.state <= Integer::parseInt(Rolloautomatik_wolken_max.state.toString())) { if (Elevation.state > Integer::parseInt(Rolloautomatik_elevation_ende.state.toString())) { // Rollos runterfahren if (log) logInfo('rules', logPrefix + 'Rollos werden abgefahren') gBlind.members.forEach[i| if (i.state <= Integer::parseInt(Rolloautomatik_zielwert.state.toString())) { if (log) logInfo('rules', logPrefix + 'Fahre Rolladen auf ' + Rolloautomatik_zielwert.state.toString() + '%: ' + i.name) i.sendCommand(Integer::parseInt(Rolloautomatik_zielwert.state.toString())) } else { if (log) logInfo('rules', logPrefix + 'Rolladen ist bereits weiter geschlossen (' + i.state.toString() + '%) als er geschlossen werden sollte und wird daher ignoriert') } ] // Letzte Ausführung mit entsprechendem Zeitstempel belegen sendBroadcastNotification("Verschattung aktiv") //Pushnachricht Rolloautomatik_start_last.postUpdate(now.toString()) } else { if (log) logInfo('rules', logPrefix + 'Elevation für wieder abfahren (' + Rolloautomatik_elevation_ende.state.toString() + ') ist groesser als aktuelle (' + Elevation.state.toString() + ')') } } else { if (log) logInfo('rules', logPrefix + 'Mindestbewoelkung (' + Rolloautomatik_wolken_max.state.toString() + ') wurde unterschritten (' + Clouds.state.toString() + ')') } } else { if (log) logInfo('rules', logPrefix + 'Mindest-Temperatur (' + Rolloautomatik_temp_min.state.toString() + ') wurde nicht erreicht durch aktuelle Temperatur (' + Temperature.state.toString() + ')') } } else { if (log) logInfo('rules', logPrefix + 'Azimuth (' + Azimuth.state.toString() + ') hat noch nicht Schwellwert (rolloautomatik_azimuth_start.state.toString()) erreicht') } } else { if (log) logInfo('rules', logPrefix + 'Automatik heute bereits einmal gelaufen, wird daher ignoriert') } } else { if (log) logInfo('rules', logPrefix + 'Beende, da Automatik generell nicht aktiv') } end rule "Rollo wieder öffnen" when Item Elevation changed then val String logPrefix = 'Rolloautomatik (Rollo hoch) - ' if (log) logInfo('rules', logPrefix + 'Regel wurde gestartet') var String timeLastEnde = 'xxxx-xx-xx' if (Rolloautomatik_ende_last.state == NULL) { if (log) logInfo('rules', logPrefix + 'Erstmalige Ausführung am System, Belegung mit Initialwert') } else { timeLastEnde = Rolloautomatik_ende_last.state.toString().substring(0,10) } var String timeLastStart = 'yyyy-yy-yy' if (Rolloautomatik_start_last.state == NULL) { if (log) logInfo('rules', logPrefix + 'Erstmalige Ausführung am System, Belegung mit Initialwert') } else { timeLastStart = Rolloautomatik_start_last.state.toString().substring(0,10) } var String timeNow = now.toString().substring(0,10) if (Rolloautomatik_oeffnen.state == ON) { if (Elevation.state <= Integer::parseInt(Rolloautomatik_elevation_ende.state.toString())) { if (timeLastStart == timeNow) { if (timeLastEnde != timeNow) { // Rollos wieder hoch if (log) logInfo('rules', logPrefix + 'Rollos werden hinaufgefahren') gBlind.members.forEach[i| if((Rolloautomatik_zielwert.state as Number).intValue <= (i.state as Number).intValue +5 && (Rolloautomatik_zielwert.state as Number).intValue >= (i.state as Number).intValue -5) { if (log) logInfo('rules', logPrefix + 'Fahre Rolladen auf 0%: ' + i.name) i.sendCommand(0) } else { if (log) logInfo('rules', logPrefix + 'Fahre Rolladen nicht auf 0%, da dieser zwischenzeitlich manuell verändert wurde: ' + i.name) } ] // Letzte Ausführung mit entsprechendem Zeitstempel belegen sendBroadcastNotification("Verschattung beendet") //Pushnachricht Rolloautomatik_ende_last.postUpdate(now.toString()) } else { if (log) logInfo('rules', logPrefix + 'Beende, da heute bereits ein automatisches Wiederhochfahren stattfand') } } else { if (log) logInfo('rules', logPrefix + 'Beende, da heute noch keine Ausführung stattfand. Demzufolge kann auch kein automatisches Öffnen gewollt sein') } } else { if (log) logInfo('rules', logPrefix + 'Beende, da Elevation (' + Elevation.state.toString() + ') nicht kleiner der eingestellten Elevation (' + Rolloautomatik_elevation_ende.state.toString()+ ') war') } } else { if (log) logInfo('rules', logPrefix + 'Beende, da Automatik generell nicht aktiv') } end
in der Tat fehlt der Triggerteil gleich zu Anfang....
hier mal meine aktuelle Rule die letzten Sommer schon einwandfrei funktioniert hat und jetzt wieder aktiv ist.
(Ja das logging ist etwas viel, aber ich setze im Normalbetrieb das Logging sowie so immer auf "WARN")
Code: Alles auswählen
var boolean log = true
rule "Rollos Sued abfahren"
when Item Azimuth changed
then
val String logPrefix = 'Rolloautomatik (Rollo Sued ab) - '
if (log) logInfo('rules', logPrefix + 'Regel wurde gestartet')
var String timeLast = 'xxxx-xx-xx'
if (Rolloautomatik_Sued_start_last.state == NULL) {
if (log) logInfo('rules', logPrefix + 'Erstmalige Ausführung am System, Belegung mit Initialwert')
} else {
timeLast = Rolloautomatik_Sued_start_last.state.toString().substring(0,10)
}
var String timeNow = now.toString().substring(0,10)
if (Rolloautomatik_Sued.state == ON) {
if (timeNow != timeLast) {
if (Azimuth.state > Integer::parseInt(Rolloautomatik_Sued_azimuth_start.state.toString())) {
if (AussenTemp.state > Integer::parseInt(Rolloautomatik_Sued_temp_min.state.toString())) {
//if ((LocalWeatherAndForecast_Current_Cloudiness.averageSince(now.minusMinutes(60)).intValue <= (Integer::parseInt(Rolloautomatik_Sued_wolken_max.state.toString())))) { if (Elevation.state > Integer::parseInt(Rolloautomatik_Sued_elevation_ende.state.toString())) { //Bewerte Durchschnitt der aktuellen Bewölkung der letzten 60min
//if (LocalWeatherAndForecast_Current_Cloudiness.state <= Integer::parseInt(Rolloautomatik_Sued_wolken_max.state.toString())) { if (Elevation.state > Integer::parseInt(Rolloautomatik_Sued_elevation_ende.state.toString())) { //Bewerte nur Aktuelle Bewölkung
if (Cloudiness_current_forecast3h_avg.state <= Integer::parseInt(Rolloautomatik_wolken_max.state.toString())) { if (Elevation.state > Integer::parseInt(Rolloautomatik_elevation_ende.state.toString())) { //Bewerte Durchschnitt der Bewölkung Aktuell und Vorhersage 3h
// Rollos runterfahren
if (log) logInfo('rules', logPrefix + 'Rollos werden abgefahren')
gruppeRolladen_Sued.members.forEach[i|
if (i.state <= Integer::parseInt(Rolloautomatik_Sued_zielwert.state.toString())) {
if (log) logInfo('rules', logPrefix + 'Fahre Rolladen auf ' + Rolloautomatik_Sued_zielwert.state.toString() + '%: ' + i.name)
i.sendCommand(Integer::parseInt(Rolloautomatik_Sued_zielwert.state.toString()))
} else {
if (log) logInfo('rules', logPrefix + 'Rolladen ist bereits weiter geschlossen (' + i.state.toString() + '%) als er geschlossen werden sollte und wird daher ignoriert')
}
]
// Letzte Ausführung mit entsprechendem Zeitstempel belegen
sendBroadcastNotification("Verschattung Südseite aktiv um " + now.toString("HH:mm") + " Uhr") //Pushnachricht
Rolloautomatik_Sued_start_last.postUpdate(now.toString())
} else {
if (log) logInfo('rules', logPrefix + 'Elevation für wieder abfahren (' + Rolloautomatik_Sued_elevation_ende.state.toString() + ') ist groesser als aktuelle (' + Elevation.state.toString() + ')')
}
} else {
if (log) logInfo('rules', logPrefix + 'Mindestbewoelkung (' + Rolloautomatik_Sued_wolken_max.state.toString() + ') wurde unterschritten (' + LocalWeatherAndForecast_Current_Cloudiness.state.toString() + ')')
}
} else {
if (log) logInfo('rules', logPrefix + 'Mindest-Temperatur (' + Rolloautomatik_Sued_temp_min.state.toString() + ') wurde nicht erreicht durch aktuelle Temperatur (' + AussenTemp.state.toString() + ')')
}
} else {
if (log) logInfo('rules', logPrefix + 'Azimuth (' + Azimuth.state.toString() + ') hat noch nicht Schwellwert (Rolloautomatik_Sued_azimuth_start.state.toString()) erreicht')
}
} else {
if (log) logInfo('rules', logPrefix + 'Automatik heute bereits einmal gelaufen, wird daher ignoriert')
}
} else {
if (log) logInfo('rules', logPrefix + 'Beende, da Automatik generell nicht aktiv')
}
end
rule "Rollo Sued wieder öffnen"
when Item Elevation changed
then
val String logPrefix = 'Rolloautomatik (Rollo Sued hoch) - '
if (log) logInfo('rules', logPrefix + 'Regel wurde gestartet')
var String timeLastEnde = 'xxxx-xx-xx'
if (Rolloautomatik_Sued_ende_last.state == NULL) {
if (log) logInfo('rules', logPrefix + 'Erstmalige Ausführung am System, Belegung mit Initialwert')
} else {
timeLastEnde = Rolloautomatik_Sued_ende_last.state.toString().substring(0,10)
}
var String timeLastStart = 'yyyy-yy-yy'
if (Rolloautomatik_Sued_start_last.state == NULL) {
if (log) logInfo('rules', logPrefix + 'Erstmalige Ausführung am System, Belegung mit Initialwert')
} else {
timeLastStart = Rolloautomatik_Sued_start_last.state.toString().substring(0,10)
}
var String timeNow = now.toString().substring(0,10)
if (Rolloautomatik_Sued_oeffnen.state == ON) {
if (Elevation.state <= Integer::parseInt(Rolloautomatik_Sued_elevation_ende.state.toString())) {
if (timeLastStart == timeNow) {
if (timeLastEnde != timeNow) {
// Rollos wieder hoch
if (log) logInfo('rules', logPrefix + 'Rollos werden hinaufgefahren')
gruppeRolladen_Sued.members.forEach[i|
if((Rolloautomatik_Sued_zielwert.state as Number).intValue <= (i.state as Number).intValue +5 && (Rolloautomatik_Sued_zielwert.state as Number).intValue >= (i.state as Number).intValue -5) {
if (log) logInfo('rules', logPrefix + 'Fahre Rolladen auf 0%: ' + i.name)
i.sendCommand(0)
} else {
if (log) logInfo('rules', logPrefix + 'Fahre Rolladen nicht auf 0%, da dieser zwischenzeitlich manuell verändert wurde: ' + i.name)
}
]
// Letzte Ausführung mit entsprechendem Zeitstempel belegen
sendBroadcastNotification("Verschattung Süd beendet um " + now.toString("HH:mm") + " Uhr") //Pushnachricht
Rolloautomatik_Sued_ende_last.postUpdate(now.toString())
} else {
if (log) logInfo('rules', logPrefix + 'Beende, da heute bereits ein automatisches Wiederhochfahren stattfand')
}
} else {
if (log) logInfo('rules', logPrefix + 'Beende, da heute noch keine Ausführung stattfand. Demzufolge kann auch kein automatisches Öffnen gewollt sein')
}
} else {
if (log) logInfo('rules', logPrefix + 'Beende, da Elevation (' + Elevation.state.toString() + ') nicht kleiner der eingestellten Elevation (' + Rolloautomatik_Sued_elevation_ende.state.toString()+ ') war')
}
} else {
if (log) logInfo('rules', logPrefix + 'Beende, da Automatik generell nicht aktiv')
}
end