Hi there,
If have complex sets of rules that repeat for each Room.
Probably I am making things way to complex
I asked myself If there is an easier way to do things, especially for repeating tasks…
As an Example, If have Posted one Rule that manages the shading for 3 of my Rooms oriented to the south. This is only one Floor of 3.
My problem is if I want to change something for all rooms its a lot of effort. Mistakes are often made.
The comments an texts are a mixture of Geman and English. But I think it is obvious what I mean by complex if you look at my example. I put every floor in a Single rule as they all are triggert by azimuth change and i dont want so many rules to be triggert at the same time…
For a start it would help to somehow reuse the code for one shade for the others and just pass it the variables.
Feel free to criticise /help me or use my stuff.
// Allgemeine Variablen
// -----------------------------------------------------------------------------------
var HeatingTolerance = 1 // Toleranz(Hysterese) für Entscheidung Beschattung/Heizung Notwendig (in°C)
var SolarLightmax = 25500 // 2550 Is a good value for Summer maybe winter is different?
// -----------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------
// Zimmer1
// -----------------------------------------------------------------------------------
// Anpassbare Variablen
var DG_Zimmer1_EL_Start = 6 // Sonnenhöhe ab der Beschattung nötig wird
var DG_Zimmer1_AZ_Start = 70 // Azimuth (Sonnenstand) ab der Beschattung nötig wird
var DG_Zimmer1_AZ_End = 230 // Azimuth (Sonnenstand) ab der keine Beschattung mehr nötig ist
// Nicht anpassabare variablen
var DG_Zimmer1_SettempMinusTol = 0
var DG_Zimmer1_SettempPlusTol = 0
// -----------------------------------------------------------------------------------
// Zimmer2
// -----------------------------------------------------------------------------------
// Anpassbare Variablen
var DG_Zimmer2_EL_Start = 6 // Sonnenhöhe ab der Beschattung nötig wird
var DG_Zimmer2_AZ_Start = 70 // Azimuth (Sonnenstand) ab der Beschattung nötig wird
var DG_Zimmer2_AZ_End = 230 // Azimuth (Sonnenstand) ab der keine Beschattung mehr nötig ist
// Nicht anpassabare variablen
var DG_Zimmer2_SettempMinusTol = 0
var DG_Zimmer2_SettempPlusTol = 0
// -----------------------------------------------------------------------------------
// Schlafzimmer Dachfenster
// -----------------------------------------------------------------------------------
// Anpassbare Variablen
var DG_SLZ_DF_EL_Start = 6 // Sonnenhöhe ab der Beschattung nötig wird
var DG_SLZ_DF_AZ_Start = 70 // Azimuth (Sonnenstand) ab der Beschattung nötig wird
var DG_SLZ_DF_AZ_End = 260 // Azimuth (Sonnenstand) ab der keine Beschattung mehr nötig ist
// Nicht anpassabare variablen
var DG_Slz_SettempMinusTol = 0
var DG_Slz_SettempPlusTol = 0
// -----------------------------------------------------------------------------------
// Schlafzimmer Westfenster
// -----------------------------------------------------------------------------------
// Anpassbare Variablen
var DG_SLZ_WF_EL_Start = 6 // Sonnenhöhe ab der Beschattung nötig wird
var DG_SLZ_WF_AZ_Start = 212 // Azimuth (Sonnenstand) ab der Beschattung nötig wird
var DG_SLZ_WF_AZ_End = 260 // Azimuth (Sonnenstand) ab der keine Beschattung mehr nötig ist
rule "DG_HeatingOrCooling"
when
// For the user (convinience only)
Item DG_Zimmer1_Beschattungsautomatik changed or
Item DG_Zimmer2_Beschattungsautomatik changed or
Item DG_Slz_Beschattungsautomatik changed or
Item DG_Slz_SetTemp changed or
Item DG_Zimmer1_SetTemp changed or
Item DG_Zimmer2_SetTemp changed or
// Actual Trigger
Item Azimuth changed
then
// Calculate Tolarances for all rooms
DG_Slz_SettempMinusTol = DG_Slz_SetTemp.state as Number - HeatingTolerance
DG_Slz_SettempPlusTol = DG_Slz_SetTemp.state as Number + HeatingTolerance
DG_Zimmer1_SettempMinusTol = DG_Zimmer1_SetTemp.state as Number - HeatingTolerance
DG_Zimmer1_SettempPlusTol = DG_Zimmer1_SetTemp.state as Number + HeatingTolerance
DG_Zimmer2_SettempMinusTol = DG_Zimmer2_SetTemp.state as Number - HeatingTolerance
DG_Zimmer2_SettempPlusTol = DG_Zimmer2_SetTemp.state as Number + HeatingTolerance
// -----------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------
// Logik für Heizen und Kühlen durch Rafstor an Zimmer 1
// -----------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------
//Here is determined if Solar Heating through the Windows would be a good idea
// -----------------------------------------------------------------------------------
if ((((IW_ForecastTodayMaxTemperature.state as QuantityType<Number>).toBigDecimal ) < DG_Zimmer1_SettempMinusTol) && // Today's top temperature will be lower than the set Temp of the Thermostat
((DG_Zimmer1_ActTemp.state as Number ) < DG_Zimmer1_SetTemp.state as Number ))
{
if (((( Elevation.state as QuantityType<Number>).toBigDecimal ) > DG_Zimmer1_EL_Start) &&
((( Azimuth.state as QuantityType<Number>).toBigDecimal ) > DG_Zimmer1_AZ_Start) &&
((( Azimuth.state as QuantityType<Number>).toBigDecimal ) < DG_Zimmer1_AZ_End ))
{
if (DG_Zimmer1_BeschattungDebugMode.state == ON) { logInfo('Beschattung Zimmer1', 'Heizen durch öffnen der Verschattung macht momentan Sinn ') }
if (( (DG_Zimmer1_Blind.state > 50 ) || (DG_Zimmer1_Blind.state == DOWN || (DG_Zimmer1_Blind.state == null))) &&
(DG_Zimmer1_ShadeManuallyOperated.state != ON))
{
sendCommand(DG_Zimmer1_ShadeControl, 1) // Comand will trigger moving up of the shade in certain conditions
}
else
{
if (DG_Zimmer1_BeschattungDebugMode.state == ON) { logInfo('Beschattung Zimmer1', 'Kommando nicht gesendet weil Rolladen schon oben ist oder kürzlich von hand bewegt wurde') }
}
}
else
{
if (DG_Zimmer1_BeschattungDebugMode.state == ON) { logInfo('Beschattung Zimmer1', 'Heizen durch öffnen der Verschattung würde Sinn machen aber die Sonne steht zu tief ') }
}
}
else{
if (DG_Zimmer1_BeschattungDebugMode.state == ON) { logInfo('Beschattung Zimmer1', 'Heizen durch öffnen der Verschattung macht momentan KEINEN Sinn')}
}
// Here s determined if Closing the Blinds mit be a good ideo to not overheat the room
// -----------------------------------------------------------------------------------
if (
// First is Determined if the sun could actually shine in the window
((( Azimuth.state as QuantityType<Number>).toBigDecimal ) > DG_Zimmer1_AZ_Start) &&
((( Azimuth.state as QuantityType<Number>).toBigDecimal ) < DG_Zimmer1_AZ_End) &&
((( Elevation.state as QuantityType<Number>).toBigDecimal ) > DG_Zimmer1_EL_Start)
)
{
if (DG_Zimmer1_BeschattungDebugMode.state == ON) { logInfo('Beschattung Zimmer1', 'Beschattung könnte sinvoll sein weil sonne einfallen könnte (Sonnenstand)') }
// Second is determined if there is actually solar radiation
if ((Out_Weather_Lux2.state as Number ) > SolarLightmax)
{
if (DG_Zimmer1_BeschattungDebugMode.state == ON) { logInfo('Beschattung Zimmer1', 'Beschattung könnte sinvoll sein weil sonne Sonnenstrahlung Grenzwert übersteigt') }
// Third is determined if Temperature
if (((((IW_ForecastTodayMaxTemperature.state as QuantityType<Number>).toBigDecimal ) > DG_Zimmer1_SettempPlusTol) &&
(DG_Zimmer1_ActTemp.state as Number > DG_Zimmer1_SetTemp.state as Number ))||
(DG_Zimmer1_ActTemp.state as Number > DG_Zimmer1_SettempPlusTol ))
{
if (DG_Zimmer1_BeschattungDebugMode.state == ON) { logInfo('Beschattung Zimmer1', 'Beschattung ist sinvoll weil erwartete Aussentemperatur Solltemperatur übersteigt und Innentemperatur sollwert bereits überschreitet') }
if (((DG_Zimmer1_Blind.state < 80 ) || (DG_Zimmer1_Blind.state == UP || (DG_Zimmer1_Blind.state === null))) &&
((DG_Zimmer1_ShadeManuallyOperated.state != ON)||(DG_Zimmer1_ShadeManuallyOperated.state === null)))
{
sendCommand(DG_Zimmer1_ShadeControl, 10) // Comand will trigger moving down of the shade in certain conditions
}
else
{
if (DG_Zimmer1_BeschattungDebugMode.state == ON) { logInfo('Beschattung Zimmer1', 'Kommando nicht gesendet weil Rolladen schon unten ist oder kürzlich von hand bewegt wurde') }
}
}
else
{
if (DG_Zimmer1_BeschattungDebugMode.state == ON) { logInfo('Beschattung Zimmer1', 'Beschattung ist Nicht sinvoll weil erwartete Aussentemperatur Solltemperatur nicht übersteigt oder innentemperatur sollwert nicht übersteigt') }
}
}
else
{
if (DG_Zimmer1_BeschattungDebugMode.state == ON) { logInfo('Beschattung Zimmer1', 'Beschattung ist nicht sinvoll weil der Grenzwert für Sonneneinstrahlung nicht überschritten wird') }
}
}else
{
if (DG_Zimmer1_BeschattungDebugMode.state == ON) { logInfo('Beschattung Zimmer1', 'Beschattung ist blödsinn weil sonne nicht einfallen kann')}
}
// -----------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------
// Logik für Heizen und Kühlen durch Rafstor an Zimmer 2
// -----------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------
//Here is determined if Solar Heating through the Windows would be a good idea
// -----------------------------------------------------------------------------------
if ((((IW_ForecastTodayMaxTemperature.state as QuantityType<Number>).toBigDecimal ) < DG_Zimmer2_SettempMinusTol) && // Today's top temperature will be lower than the set Temp of the Thermostat
((DG_Zimmer2_ActTemp.state as Number ) < DG_Zimmer2_SetTemp.state as Number ))
{
if (((( Elevation.state as QuantityType<Number>).toBigDecimal ) > DG_Zimmer2_EL_Start) &&
((( Azimuth.state as QuantityType<Number>).toBigDecimal ) > DG_Zimmer2_AZ_Start) &&
((( Azimuth.state as QuantityType<Number>).toBigDecimal ) < DG_Zimmer2_AZ_End ))
{
if (DG_Zimmer2_BeschattungDebugMode.state == ON) { logInfo('Beschattung Zimmer2', 'Heizen durch öffnen der Verschattung macht momentan Sinn ') }
if (((DG_Zimmer2_Blind.state > 10 ) || (DG_Zimmer2_Blind.state == DOWN || (DG_Zimmer2_Blind.state === null))) &&
((DG_Zimmer2_ShadeManuallyOperated.state != ON)||(DG_Zimmer2_ShadeManuallyOperated.state === null)))
{
sendCommand(DG_Zimmer2_ShadeControl, 1) // Comand will trigger moving up of the shade in certain conditions
}
else
{
if (DG_Zimmer2_BeschattungDebugMode.state == ON) { logInfo('Beschattung Zimmer2', 'Kommando nicht gesendet weil Rolladen schon oben ist oder kürzlich von Hand bewegt wurde '+ DG_Zimmer2_ShadeManuallyOperated.state) }
}
}
else
{
if (DG_Zimmer2_BeschattungDebugMode.state == ON) { logInfo('Beschattung Zimmer2', 'Heizen durch öffnen der Verschattung würde Sinn machen aber die Sonne steht zu tief ') }
}
}
else{
if (DG_Zimmer2_BeschattungDebugMode.state == ON) { logInfo('Beschattung Zimmer2', 'Heizen durch öffnen der Verschattung macht momentan KEINEN Sinn')}
}
// Here s determined if Closing the Blinds mit be a good ideo to not overheat the room
// -----------------------------------------------------------------------------------
if (
// First is Determined if the sun could actually shine in the window
((( Azimuth.state as QuantityType<Number>).toBigDecimal ) > DG_Zimmer2_AZ_Start) &&
((( Azimuth.state as QuantityType<Number>).toBigDecimal ) < DG_Zimmer2_AZ_End) &&
((( Elevation.state as QuantityType<Number>).toBigDecimal ) > DG_Zimmer2_EL_Start)
)
{
if (DG_Zimmer2_BeschattungDebugMode.state == ON) { logInfo('Beschattung Zimmer2', 'Beschattung könnte sinvoll sein weil sonne einfallen könnte (Sonnenstand)') }
// Second is determined if there is actually solar radiation
if ((Out_Weather_Lux2.state as Number ) > SolarLightmax)
{
if (DG_Zimmer2_BeschattungDebugMode.state == ON) { logInfo('Beschattung Zimmer2', 'Beschattung könnte sinvoll sein weil sonne Sonnenstrahlung Grenzwert übersteigt') }
// Third is determined if Temperature
if (((((IW_ForecastTodayMaxTemperature.state as QuantityType<Number>).toBigDecimal ) > DG_Zimmer2_SettempPlusTol) &&
(DG_Zimmer2_ActTemp.state as Number > DG_Zimmer2_SetTemp.state as Number ))||
(DG_Zimmer2_ActTemp.state as Number > DG_Zimmer2_SettempPlusTol ))
{
if (DG_Zimmer2_BeschattungDebugMode.state == ON) { logInfo('Beschattung Zimmer2', 'Beschattung ist sinvoll weil erwartete Aussentemperatur Solltemperatur übersteigt und Innentemperatur sollwert bereits überschreitet') }
if ( ( (DG_Zimmer2_Blind.state < 80) || (DG_Zimmer2_Blind.state == UP || (DG_Zimmer2_Blind.state === null))) &&
(DG_Zimmer2_ShadeManuallyOperated.state != ON) )
{
sendCommand(DG_Zimmer2_ShadeControl, 10) // Comand will trigger moving down of the shade in certain conditions
}
else
{
if (DG_Zimmer2_BeschattungDebugMode.state == ON) { logInfo('Beschattung Zimmer2', 'Kommando nicht gesendet weil Rolladen schon unten ist oder kürzlich von Hand bewegt wurde '+ DG_Zimmer2_ShadeManuallyOperated.state +' Shade= ' + DG_Zimmer2_Blind.state ) }
}
}
else
{
if (DG_Zimmer2_BeschattungDebugMode.state == ON) { logInfo('Beschattung Zimmer2', 'Beschattung ist Nicht sinvoll weil erwartete Aussentemperatur Solltemperatur nicht übersteigt oder innentemperatur sollwert nicht übersteigt') }
}
}
else
{
if (DG_Zimmer2_BeschattungDebugMode.state == ON) { logInfo('Beschattung Zimmer2', 'Beschattung ist nicht sinvoll weil der Grenzwert für Sonneneinstrahlung nicht überschritten wird') }
}
}else
{
if (DG_Zimmer2_BeschattungDebugMode.state == ON) { logInfo('Beschattung Zimmer2', 'Beschattung ist blödsinn weil sonne nicht einfallen kann')}
}
// -----------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------
// Logik für Heizen und Kühlen durch Schlafzimmer Dachfenster
// -----------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------
//Here is determined if Solar Heating through the Windows would be a good idea
// -----------------------------------------------------------------------------------
if ((((IW_ForecastTodayMaxTemperature.state as QuantityType<Number>).toBigDecimal ) < DG_Slz_SettempMinusTol) && // Today's top temperature will be lower than the set Temp of the Thermostat
((DG_Slz_ActTemp.state as Number ) < DG_Slz_SettempPlusTol ))
{
if (((( Elevation.state as QuantityType<Number>).toBigDecimal ) > DG_SLZ_DF_EL_Start)&&
((( Azimuth.state as QuantityType<Number>).toBigDecimal ) > DG_Zimmer1_AZ_Start) &&
((( Azimuth.state as QuantityType<Number>).toBigDecimal ) < DG_Zimmer1_AZ_End ))
{
if ( ((DG_Slz_Dachfenster_Roll.state > 10 ) || (DG_Slz_Dachfenster_Roll.state === null)) &&
((DG_Slz_ShadeManuallyOperated.state != ON)||(DG_Slz_ShadeManuallyOperated.state === null)))
{
sendCommand(DG_Slz_ShadeControl, 1) // Comand will trigger moving down of the shade in certain conditions
}
else
{
if (DG_Slz_BeschattungDebugMode.state == ON) { logInfo('Beschattung SLZ', 'Kommando nicht gesendet weil Rolladen schon oben ist oder kürzlich von Hand bewegt wurde') }
}
if (DG_Slz_BeschattungDebugMode.state == ON) { logInfo('Beschattung Schlafzimmer', 'Heizen durch öffnen der Verschattung macht momentan Sinn ') }
}
else
{
if (DG_Slz_BeschattungDebugMode.state == ON) { logInfo('Beschattung Schlafzimmer', 'Heizen durch öffnen der Verschattung würde Sinn machen aber die Sonne steht zu tief ') }
}
}
else{
if (DG_Slz_BeschattungDebugMode.state == ON) { logInfo('Beschattung Schlafzimmer', 'Heizen durch öffnen der Verschattung macht momentan KEINEN Sinn')}
}
// Here s determined if Closing the Blinds mit be a good ideo to not overheat the room
// -----------------------------------------------------------------------------------
if (
// First is Determined if the sun could actually shine in the window
((( Azimuth.state as QuantityType<Number>).toBigDecimal ) > DG_SLZ_DF_AZ_Start) &&
((( Azimuth.state as QuantityType<Number>).toBigDecimal ) < DG_SLZ_DF_AZ_End) &&
((( Elevation.state as QuantityType<Number>).toBigDecimal ) > DG_SLZ_DF_EL_Start)
)
{
if (DG_Slz_BeschattungDebugMode.state == ON) { logInfo('Beschattung Schlafzimmer', 'Beschattung könnte sinvoll sein weil sonne einfallen könnte (Sonnenstand)') }
// Second is determined if there is actually solar radiation
if ((Out_Weather_Lux2.state as Number ) > 26000)
{
if (DG_Slz_BeschattungDebugMode.state == ON) { logInfo('Beschattung Schlafzimmer', 'Beschattung könnte sinvoll sein weil sonne Sonnenstrahlung Grenzwert übersteigt') }
// Third is determined if Temperature
if (((((IW_ForecastTodayMaxTemperature.state as QuantityType<Number>).toBigDecimal ) > DG_Slz_SettempPlusTol) &&
(DG_Slz_ActTemp.state as Number > DG_Slz_SetTemp.state as Number ))||
(DG_Slz_ActTemp.state as Number > DG_Slz_SettempPlusTol ))
{
if (DG_Slz_BeschattungDebugMode.state == ON) { logInfo('Beschattung Schlafzimmer', 'Beschattung ist sinvoll weil erwartete Aussentemperatur Solltemperatur übersteigt und Innentemperatur sollwert bereits überschreitet') }
if ( (DG_Slz_Dachfenster_Roll.state < 80 ) &&
((DG_Slz_ShadeManuallyOperated.state != ON) || (DG_Zimmer2_ShadeManuallyOperated.state === null)))
{
sendCommand(DG_Slz_ShadeControl, 10) // Comand will trigger moving down of the shade in certain conditions
}
else
{
if (DG_Slz_BeschattungDebugMode.state == ON) { logInfo('Beschattung Schlafzimmer', 'Kommando nicht gesendet weil Rolladen schon unten ist oder kürzlich von Hand bewegt wurde') }
}
}
else
{
if (DG_Slz_BeschattungDebugMode.state == ON) { logInfo('Beschattung Schlafzimmer', 'Beschattung ist Nicht sinvoll weil erwartete Aussentemperatur Solltemperatur nicht übersteigt oder innentemperatur sollwert nicht übersteigt') }
}
}
else
{
if (DG_Slz_BeschattungDebugMode.state == ON) { logInfo('Beschattung Schlafzimmer', 'Beschattung ist nicht sinvoll weil der Grenzwert für Sonneneinstrahlung nicht überschritten wird') }
}
}else
{
if (DG_Slz_BeschattungDebugMode.state == ON) { logInfo('Beschattung Schlafzimmer', 'Beschattung ist blödsinn weil sonne nicht einfallen kann')}
}
//Check weather to open the Shades because sun can not enter again
// Zimmer1
if ( (((Azimuth.state as QuantityType<Number>).toBigDecimal ) > DG_Zimmer1_AZ_End) &&
( DG_Zimmer1_ShadeControl.state == 10 ) && // was automatically moved down
(DG_Zimmer1_Beschattungsautomatik.state == ON) )
{
sendCommand(DG_Zimmer1_ShadeControl, 1) // Comand will trigger moving up of the shade in certain conditions
logInfo('Beschattung Zimmer1', 'Öffne weil sonne nicht mehr einfallen kann')
}
// Zimmer2
if ( (((Azimuth.state as QuantityType<Number>).toBigDecimal ) > DG_Zimmer2_AZ_End) &&
( DG_Zimmer2_ShadeControl.state == 10 ) && // was automatically moved down
(DG_Zimmer2_Beschattungsautomatik.state == ON) )
{
sendCommand(DG_Zimmer2_ShadeControl, 1) // Comand will trigger moving up of the shade in certain conditions
logInfo('Beschattung Zimmer2', 'Öffne weil sonne nicht mehr einfallen kann')
}
// // SLZ
// if ( (((Azimuth.state as QuantityType<Number>).toBigDecimal ) > DG_SLZ_DF_AZ_End) &&
// ( DG_Slz_ShadeControl.state == 10 ) && // was automatically moved down
// (DG_SLZ_Beschattungsautomatik.state == ON) )
// {
// sendCommand(DG_Slz_ShadeControl, 1) // Comand will trigger moving up of the shade in certain conditions
// logInfo('Beschattung Schalfzimmer Dach', 'Öffne weil sonne nicht mehr einfallen kann')
// }
end
//Rolladen Komandoausführung DG Schlafzimmer
rule "DG_AutoShade Roll Slz Command"
when
Item DG_Slz_ShadeControl received command
// Ändern und in 3 Rules aufteilen oder revieved command auf 0 setzen (post update)
then
if (DG_Slz_Beschattungsautomatik.state == ON)
{
sendCommand(DG_SLZ_ShadeSupressManualDetection, ON)
if (receivedCommand == 1)
{
sendCommand(DG_Slz_Dachfenster_Roll, UP)
}
if (receivedCommand == 10)
{
sendCommand(DG_Slz_Dachfenster_Roll, DOWN)
}
}
end
//Rolladen Komandoausführung DG Schlafzimmer
rule "DG_AutoShade Z1 Command"
when
Item DG_Zimmer1_ShadeControl received command
// Ändern und in 3 Rules aufteilen oder revieved command auf 0 setzen (post update)
then
if (DG_Zimmer1_Beschattungsautomatik.state == ON)
{
postUpdate(DG_Zimmer1_ShadeSupressManualDetection, ON)
if (receivedCommand == 1)
{
sendCommand(DG_Zimmer1_Blind, UP)
}
if (receivedCommand == 10)
{
sendCommand(DG_Zimmer1_Blind, DOWN)
}
}
end
//Rolladen Komandoausführung DG Schlafzimmer
rule "DG_AutoShade Z2 Command"
when
Item DG_Zimmer2_ShadeControl received command
// Ändern und in 3 Rules aufteilen oder revieved command auf 0 setzen (post update)
then
if (DG_Zimmer2_Beschattungsautomatik.state == ON)
{
postUpdate(DG_Zimmer2_ShadeSupressManualDetection, ON)
if (receivedCommand == 1)
{
sendCommand(DG_Zimmer2_Blind, UP)
}
if (receivedCommand == 10)
{
sendCommand(DG_Zimmer2_Blind, DOWN)
}
}
end
// ---------------------------------------------------------------------------------------------
// -------------Erkennung ob Rolladen von Hand bewegt wurde-------------------------------------
// ---------------------------------------------------------------------------------------------
rule "DetectManual Operation of Dachfenster"
when
Item DG_Slz_Dachfenster_Roll changed
then
if ((DG_Slz_Beschattungsautomatik.state == ON) &&
(DG_SLZ_ShadeSupressManualDetection.state != ON))
{
sendCommand(DG_Slz_ShadeManuallyOperated, ON)
}
end
rule "DetectManual Operation of Rafstor Zimmer1"
when
Item DG_Zimmer1_Blind changed
then
if ((DG_Zimmer1_Beschattungsautomatik.state == ON) &&
(DG_Zimmer1_ShadeSupressManualDetection.state != ON))
{
sendCommand(DG_Zimmer1_ShadeManuallyOperated, ON)
}
end
rule "DetectManual Operation of Rafstor Zimmer2"
when
Item DG_Zimmer2_Blind changed
then
if ((DG_Zimmer2_Beschattungsautomatik.state == ON) &&
(DG_Zimmer2_ShadeSupressManualDetection.state != ON))
{
sendCommand(DG_Zimmer2_ShadeManuallyOperated, ON)
}
end
//Ab Hier
// Präsensabhänige Funktionen und Manipulation der Beschattung bzw Automatik
// 1) Lammellen Öffnen wenn Raum betreten wird und Schließen wenn raum Verlassen wird nach Nachlaufzeit.
// 2) Manuelle Unterdrückung der Automatik vorzeitig beenden wenn Raum Verlassen wurde nach Nachlaufzeit
// Gesteuert über Langzeitpräsens so das eine Bewegung nur max 1mal wenn der Raum für 15 min verlassen wurde ausgeführt wird.
rule "LamellenZ1"
when
Item DG_Zimmer1_Presence_Long changed
then
if(DG_Zimmer1_Presence_Long.state == ON){
// Raum Betreten --> Lamellen auf
if ((DG_Zimmer1_Beschattungsautomatik.state == ON) &&
(DG_Zimmer1_LamelleAufAuto.state == ON) &&
((DG_Zimmer1_Blind.state > 80))&&
(DG_Zimmer1_Lamella.state >74))
{
sendCommand(DG_Zimmer1_Lamella, DG_Zimmer1_OpeningWidthOnEnter.state as Number) //
}
}
if(DG_Zimmer1_Presence_Long.state == OFF){
// Raum Verlassen --> Lamellen Zu
if ((DG_Zimmer1_Beschattungsautomatik.state == ON) &&
(DG_Zimmer1_LamelleZuAuto.state == ON) &&
((DG_Zimmer1_Blind.state > 80)))
{
sendCommand(DG_Zimmer1_Lamella, 90)
}
// Raum Verlassen --> Manuelle Unterdrückung der Automatikfunktion aus
sendCommand(DG_Zimmer1_ShdaeManuallyOperated, OFF)
}
end
rule "LamellenoeffnungZ2"
when
Item DG_Zimmer2_Presence_Long changed
then
if(DG_Zimmer2_Presence_Long.state == ON){
// Raum Betreten --> Lamellen auf
if ((DG_Zimmer2_Beschattungsautomatik.state == ON) &&
(DG_Zimmer1_LamelleAufAuto.state == ON) &&
((DG_Zimmer2_Blind.state > 80)) &&
(DG_Zimmer2_Lamella.state >74))
{
sendCommand(DG_Zimmer2_Lamella, DG_Zimmer2_OpeningWidthOnEnter.state as Number)
}
}
if(DG_Zimmer2_Presence_Long.state == OFF){
// Raum Verlassen --> Lamellen Zu
if ((DG_Zimmer2_Beschattungsautomatik.state == ON) &&
(DG_Zimmer2_LamelleZuAuto.state == ON) &&
((DG_Zimmer2_Blind.state > 80)))
{
sendCommand(DG_Zimmer2_Lamella, 90)
}
// Raum Verlassen --> Manuelle Unterdrückung der Automatikfunktion aus
sendCommand(DG_Zimmer2_ShadeManuallyOperated, OFF)
}
end