Dear all,
I have some rules for controlling my roller shutter.
There is a file for roller shutter scenes (rollo_szenen.rules). These scene rules trigger the control of the rollershutter (rollo_basikansteuerung.rules). Finally the real command is send to rollo_shelly.rules.
Why so complicated:
The rollo_shelly.rules deal with the low level hardware control (incl. converting numbers properly from 0 to 100 instead of 100 to 0 etc.)
As once a while the command is ignored by the shelly, the rollo_basikansteuerung.rules takes care if the command has been sent and repeats the command if needed.
The rollo_szenen.rules itself takes care of the defined roller shutter positions I want to have, e.g. for sleeping, waking up etc. These scenes are used within other rules then as well.
The rollo_shelly.rules file seems to work properly. While implementing, I figured out some very weird behavior and therefore reduced the rollo_basikansteuerung.rules a lot to identify the reason. But I am struggling.
Attached the code I am currently using
rollo_basikansteuerung.rules
rule "Control Rollo Kueche Neu"
when
Item ControlRolloKueche received command
then
logInfo("Control Rollo","Kueche, Zielwert: "+ ControlRolloKueche.state.toString +", Istwert: "+ Shelly_Kuecherollo_Steuerung.state.toString)
Shelly_Kuecherollo_Positionsansteuerung.sendCommand(ControlRolloKueche.state as Number)
end
rollo_szenen.rules
rule "Rollos Szene"
when
Item Rollo_Szene received command
then
logInfo("Rollo Szene", "Rollo Szene start ...")
switch (Rollo_Szene.state.toString) {
case "Sonnenaufgang" : {
//
// Normaler Modus - nur Schlafzimmer runterfahren
//
if (Klimamodus.state == 1) {
logInfo("Rollo Szene", "Sonnenaufgang, Klimamodus "+Klimamodus.state.toString)
ControlRolloSchlafzimmer.sendCommand(95)
ControlRolloKinderzimmer.sendCommand(0)
ControlRolloKueche.sendCommand(0)
ControlRolloWohnzimmer_links.sendCommand(0)
ControlRolloWohnzimmer_rechts.sendCommand(0)
}
//
// Hitzemodus
//
if (Klimamodus.state == 2) {
logInfo("Rollo Szene", "Sonnenaufgang, Klimamodus "+Klimamodus.state.toString)
ControlRolloSchlafzimmer.sendCommand(95)
ControlRolloKinderzimmer.sendCommand(95)
ControlRolloKueche.sendCommand(0)
ControlRolloWohnzimmer_links.sendCommand(0)
ControlRolloWohnzimmer_rechts.sendCommand(0)
}
//
// Kältemodus
//
if (Klimamodus.state == 3) {
logInfo("Rollo Szene", "Sonnenaufgang, Klimamodus "+Klimamodus.state.toString)
//ControlRolloSchlafzimmer.sendCommand(0)
ControlRolloKinderzimmer.sendCommand(0)
ControlRolloKueche.sendCommand(0)
ControlRolloWohnzimmer_links.sendCommand(0)
ControlRolloWohnzimmer_rechts.sendCommand(0)
}
}
case "Aufstehen" : {
//
// Kälte Modus
//
if (Klimamodus.state == 3) {
logInfo("Rollo Szene", "Aufstehen, Klimamodus "+Klimamodus.state.toString)
//ControlRolloSchlafzimmer.sendCommand(0)
//ControlRolloKinderzimmer.sendCommand(0)
ControlRolloKueche.sendCommand(0)
//ControlRolloWohnzimmer_links.sendCommand(0)
//ControlRolloWohnzimmer_rechts.sendCommand(0)
}
}
case "Ab ins Bett" : {
//
// Kälte Modus
//
if (Klimamodus.state == 3) {
logInfo("Rollo Szene", "Ab ins Bett, Klimamodus "+Klimamodus.state.toString)
ControlRolloSchlafzimmer.sendCommand(0)
ControlRolloKinderzimmer.sendCommand(0)
ControlRolloKueche.sendCommand(100)
ControlRolloWohnzimmer_links.sendCommand(100)
ControlRolloWohnzimmer_rechts.sendCommand(0)
}
}
case "Schlafen" :{
//
// Kälte Modus
//
if (Klimamodus.state == 3) {
logInfo("Rollo Szene", "Schlafen, Klimamodus "+Klimamodus.state.toString)
ControlRolloSchlafzimmer.sendCommand(95)
ControlRolloKinderzimmer.sendCommand(100)
ControlRolloKueche.sendCommand(100)
ControlRolloWohnzimmer_links.sendCommand(100)
ControlRolloWohnzimmer_rechts.sendCommand(100)
}
}
case "Mittag" : {
//
// Normaler Modus
//
if (Klimamodus.state == 1) {
logInfo("Rollo Szene", "Mittag, Klimamodus "+Klimamodus.state.toString)
ControlRolloSchlafzimmer.sendCommand(0)
ControlRolloKinderzimmer.sendCommand(0)
ControlRolloKueche.sendCommand(0)
ControlRolloWohnzimmer_links.sendCommand(0)
ControlRolloWohnzimmer_rechts.sendCommand(0)
}
//
// Kälte Modus
//
if (Klimamodus.state == 3) {
logInfo("Rollo Szene", "12 Uhr, Klimamodus "+Klimamodus.state.toString)
ControlRolloSchlafzimmer.sendCommand(0)
ControlRolloKinderzimmer.sendCommand(0)
ControlRolloKueche.sendCommand(0)
ControlRolloWohnzimmer_links.sendCommand(0)
ControlRolloWohnzimmer_rechts.sendCommand(0)
}
}
case "Sonnenuntergang": {
//
// Kälte Modus
//
if (Klimamodus.state == 3) {
logInfo("Rollo Szene", "Sonnenuntergang, Klimamodus "+Klimamodus.state.toString)
ControlRolloSchlafzimmer.sendCommand(95)
ControlRolloKinderzimmer.sendCommand(100)
}
}
case "Nacht" : {
//
// Kälte Modus
//
if (Klimamodus.state == 3) {
logInfo("Rollo Szene", "Nacht, Klimamodus "+Klimamodus.state.toString)
//ControlRolloKinderzimmer.sendCommand(100)
ControlRolloKueche.sendCommand(100)
//ControlRolloWohnzimmer_links.sendCommand(100)
//ControlRolloWohnzimmer_rechts.sendCommand(100)
}
}
case "Unterwegs" :{
//
// Kälte Modus
//
if (Klimamodus.state == 3) {
logInfo("Rollo Szene", "Unterwegs, Klimamodus "+Klimamodus.state.toString)
ControlRolloSchlafzimmer.sendCommand(0)
ControlRolloKinderzimmer.sendCommand(0)
ControlRolloKueche.sendCommand(0)
ControlRolloWohnzimmer_links.sendCommand(0)
ControlRolloWohnzimmer_rechts.sendCommand(0)
}
}
case "Zuhause" :{
//
// Kälte Modus
//
if (Klimamodus.state == 3) {
logInfo("Rollo Szene", "Zuhause, Klimamodus "+Klimamodus.state.toString)
ControlRolloSchlafzimmer.sendCommand(95)
ControlRolloKinderzimmer.sendCommand(100)
ControlRolloKueche.sendCommand(0)
ControlRolloWohnzimmer_links.sendCommand(0)
ControlRolloWohnzimmer_rechts.sendCommand(0)
}
}
case "Kino" :{
logInfo("Rollo Szene", "Kino")
ControlRolloKueche.sendCommand(50)
ControlRolloWohnzimmer_links.sendCommand(100)
ControlRolloWohnzimmer_rechts.sendCommand(50)
}
}
logInfo("Rollo Szene", "Rollo Szene beendet ...")
end
For debug reasons I manually select either “Nacht” or “Aufstehen” to check whats happening. Kitchen (Kueche) should be either 0 (Aufstehen) or 100 (Nacht). Quite simple for testing.
When changing scenes manually forth and back from Nacht to Aufstehen and vice versa after a while the log shows that the wrong “Zielwert” (target value) is used. As said: Night should have “Zielwert” 100, “Aufstehen” 0. The last log shows that after a while it takes the wrong value and I have no idea why. Log file is attached.
I am using openhabian 2.4 on my raspberry 3B+.
log.log (12.3 KB)
Thank you a lot!
Best
Matthias