
Alle anderen Lampen haben "ON" oder "OFF", der Dimmer "0" oder "100".
Sobald ich den Dimmer aus der Gruppe der Anwesendheitssimulation entferne, läuft diese wieder.
Jetzt muss ich mal gucken, wie ich dem Dimmer "ON"/"OFF" sende

Viele Grüße
Code: Alles auswählen
...filter[i|i instanceof DimmerItem].filter[...]
Somit werde ich morgen mal den 2. Weg probieren.Script execution of rule with UID 'ki-7' failed: 'getStateAs' is not a member of 'org.openhab.core.persistence.HistoricItem'; line 187, column 49, length 50 in ki
Wenn ich das wie folgt umsetzeudo1toni hat geschrieben: ↑3. Okt 2023 22:23Code: Alles auswählen
...filter[i|i instanceof DimmerItem].filter[...]
Code: Alles auswählen
gLights_auto.members.filter[ f | f.state instanceof SwitchItem != f.historicState(past,"jdbc").state ].forEach[ m |
logInfo("presence","Restore {} to historic state!",m.name)
val actions = getActions("pushover", "pushover:pushover-account:account")
val oldValue = m.historicState(past,"jdbc").state
m.sendCommand(oldValue.toString)
logInfo("presence","Restore {} to historic state: {}",m.name, oldValue)
Code: Alles auswählen
class java.lang.String cannot be cast to class java.lang.Integer
Sehr gerne, die folgende Zeile habe ich noch neu angepasst
Code: Alles auswählen
gLights_auto.members.filter[ f | f instanceof SwitchItem && f.state != f.historicState(past,"jdbc").state ].forEach[ m |
Code: Alles auswählen
rule "Presence Simulator"
when
Time cron "0 */1 * * * ?"
then
if(Absence.state != ON) // Hauptschalter aus?
return; // dann Abbruch
logInfo("Presence","START RULE")
val past = now.minusDays(7) // jetzt vor sieben Tagen
logInfo("Presence","Datum: {}", past)
val oldValue = Lampe_OG_Schlafz_Decke.historicState(past,"jdbc").state
logInfo("Presence","oldValue: {}", oldValue)
gLights_auto.members.filter[ f | f instanceof SwitchItem && f.state != f.historicState(past,"jdbc").state ].forEach[ m |
logInfo("presence","Restore {} to historic state!",m.name)
val actions = getActions("pushover", "pushover:pushover-account:account")
val oldValue = m.historicState(past,"jdbc").state
m.sendCommand(oldValue.toString)
logInfo("presence","Restore {} to historic state: {}",m.name, oldValue)
actions.sendMessageToDevice("J", "Restore " + m.name + " to historic state: " + oldValue.toString, "Presence Simulation")
]
end
Jedoch wird weiterhin ein Fehler angezeigt, wenn nichts geschaltet wird18:19:00.574 [INFO ] [rg.openhab.core.model.script.Presence] - START RULE
18:19:00.575 [INFO ] [rg.openhab.core.model.script.Presence] - Datum: 2023-09-27T18:19:00.575511666+02:00[Europe/Berlin]
18:19:00.582 [INFO ] [rg.openhab.core.model.script.presence] - Restore Lampe_EG_Deko_Wand to historic state!
18:19:00.584 [INFO ] [openhab.event.ItemCommandEvent ] - Item 'Lampe_EG_Deko_Wand' received command OFF
18:19:00.584 [INFO ] [rg.openhab.core.model.script.presence] - Restore Lampe_EG_Deko_Wand to historic state: OFF
18:19:00.587 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item 'Lampe_EG_Deko_Wand' predicted to become OFF
18:19:00.589 [INFO ] [openhab.event.ItemStateUpdatedEvent ] - Item 'Lampe_EG_Deko_Wand' updated to OFF
18:19:00.590 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Lampe_EG_Deko_Wand' changed from ON to OFF
18:19:00.591 [INFO ] [openhab.event.GroupStateUpdatedEvent ] - Group 'Lampen' updated to ON through Lampe_EG_Deko_Wand
18:19:00.661 [INFO ] [openhab.event.ItemStateUpdatedEvent ] - Item 'Lampe_EG_Deko_Wand' updated to OFF
18:19:00.662 [INFO ] [openhab.event.GroupStateUpdatedEvent ] - Group 'Lampen' updated to ON through Lampe_EG_Deko_Wand
18:19:00.708 [INFO ] [rg.openhab.core.model.script.presence] - Restore Lampe_EG_Deko_Decke to historic state!
18:19:00.710 [INFO ] [openhab.event.ItemCommandEvent ] - Item 'Lampe_EG_Deko_Decke' received command OFF
18:19:00.711 [INFO ] [rg.openhab.core.model.script.presence] - Restore Lampe_EG_Deko_Decke to historic state: OFF
18:19:00.714 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item 'Lampe_EG_Deko_Decke' predicted to become OFF
18:19:00.715 [INFO ] [openhab.event.ItemStateUpdatedEvent ] - Item 'Lampe_EG_Deko_Decke' updated to OFF
18:19:00.716 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Lampe_EG_Deko_Decke' changed from ON to OFF
18:19:00.717 [INFO ] [openhab.event.GroupStateUpdatedEvent ] - Group 'Lampen' updated to ON through Lampe_EG_Deko_Decke
18:19:00.780 [INFO ] [openhab.event.ItemStateUpdatedEvent ] - Item 'Lampe_EG_Deko_Decke' updated to OFF
18:19:00.781 [INFO ] [openhab.event.GroupStateUpdatedEvent ] - Group 'Lampen' updated to ON through Lampe_EG_Deko_Decke
18:19:00.801 [INFO ] [openhab.event.ItemStateUpdatedEvent ] - Item 'Lampe_EG_Deko_Decke' updated to OFF
18:19:00.801 [INFO ] [openhab.event.GroupStateUpdatedEvent ] - Group 'Lampen' updated to ON through Lampe_EG_Deko_Decke
Seltsam für mich.18:20:00.574 [INFO ] [rg.openhab.core.model.script.Presence] - START RULE
18:20:00.576 [INFO ] [rg.openhab.core.model.script.Presence] - Datum: 2023-09-27T18:20:00.575863283+02:00[Europe/Berlin]
18:20:00.585 [ERROR] [.internal.handler.ScriptActionHandler] - Script execution of rule with UID 'ki-7' failed: class java.lang.String cannot be cast to class java.lang.Integer (java.lang.String and java.lang.Integer are in module java.base of loader 'bootstrap') in ki
Nachtrag: Das hatte ich schon so weit verstanden