Unfortunately I can not find any documentation about the Notifications in the subject and variables did used.
Is it possible to use subject and variable in the Notifications?
Furthermore, I have to update my Notifications Rules after changes in the Items Files, Rules Files or after a reboot, that they work again.
I use one of the last snapshots with openhabian.
Does anyone know this problem?
rule "nukiHaustuer_status,1,2,3"
when
Item nukiHaustuer_action received command
then
if (nukiHaustuer_action.state == 1){
sendCommand (nukiHaustuer_status,2)
Thread::sleep(8000)
sendCommand (nukiHaustuer_status,3)
Thread::sleep(10000)
sendCommand (nukiHaustuer_action,0)
}
if (nukiHaustuer_action.state == 2){
sendCommand (nukiHaustuer_status,4)
Thread::sleep(5000)
sendCommand (nukiHaustuer_status,1)
Thread::sleep(10000)
sendCommand (nukiHaustuer_action,0)
}
if (nukiHaustuer_action.state == 3){
sendCommand (nukiHaustuer_status,5)
Thread::sleep(8000)
sendCommand (nukiHaustuer_status,3)
Thread::sleep(6000)
sendCommand (nukiHaustuer_action,0)
}
end
rule "FensterOffen,ON,OFF"
when
Item gFenster received update
then
if (gFenster.state == OPEN){
sendCommand (FensterOffen, ON)
sendCommand(FensterAlert,"Fenster offen")
}
if(gFenster.state == CLOSED){
sendCommand(FensterOffen, OFF)
sendCommand(FensterAlert,"Fenster geschlossen")
sendCommand(FensterAlertActiveHaustuer, OFF)
sendCommand(FensterAlertActiveRegen, OFF)
}
end
rule "FensterAlertActiveHaustuer, ON"
when
Item nukiHaustuer_status received update or
Item FensterOffen received update
then
if (FensterOffen.state == ON && nukiHaustuer_status.state == 1 ) {
sendCommand (FensterAlertActiveHaustuer, ON)
}
if (nukiHaustuer_status.state == 3 ) {
sendCommand (FensterAlertActiveHaustuer, OFF)
}
end
rule "FensterAlertActiveRegen,ON,OFF"
when
Item FensterOffen received update or
Item RainH received update
then
if (gFensterRegen.state == OPEN && RainH.state > 0) {
sendCommand (FensterAlertActiveRegen, ON)
}
if (RainH.state == 0 || gFensterRegen.state == CLOSED ) {
sendCommand (FensterAlertActiveRegen, OFF)
}
end
rule "FensterAlertActiveHaustuer, ON"
when
Item FensterAlertActiveHaustuer changed from OFF to ON
then
sendNotification("myOpenHAB User", "HaustĂĽr ist zugesperrt und " + gFenster.members.filter(s | s.state == OPEN).size + " Fenster offen")
end
rule "FensterAlertActiveRegen, ON"
when
Item FensterAlertActiveRegen changed from OFF to ON
then
sendNotification("myOpenHAB User", "Regenwarnung und " + gFensterRegen.members.filter(s | s.state == OPEN).size + " Fenster offen")
end
For working, I only “change” (it´s more update no changes) the RULES files after any changes in ITEMS files or Sitemap files.
Well yes, if you change the name of an item or add new items of course you need to change the rules to use the new names. They do not automatically synchronize with each other.
Or do you mean that when you make a change to an items file you must touch the rules file it wise everything stops working.
If so, I’m what easy for it stop working?
What errors do you see in the logs?
How do you know the rule stops working?
Yes I meant any change in any ITEMS files or in the Sitemap.
I was already aware of the fact that changes to items that directly affecting RULES, the RULES would no longer work for them.
I notice this to the relevant rules, which I posted, that if the front door (HaustĂĽr) is locked and a window (Fenster) is open, no notifications come.
To fix this, I update the affected RULES without any changes by Designer or Notepad++.
Are you using persistence? When you change a .items file all your Items get reset to uninitialized (i.e. NULL). If you use persistence with restoreOnStartup then your Items will be initialized to their most recently saved value.
The problem is probably because your alert rules only trigger when the Item changes from OFF to ON but when you change a .items file without restoreOnStartup the next time FensterAlertActiveHaustuer changes it will be changing from NULL to ON so the rule doesn’t trigger.
Thanks for the hint.
No, I do not use persistence.
But I’ve found my thought mistake.
The hint with “uninitialized (i.e. NULL)” opened my eyes.
I changed the RULES, so I did not need three ITEMS status changes until all the ITEMS have the appropriate status. By all the nesting rules, it would have required three different changes until the notification is activated.
The rules also work after changes in the ITEM files. However, the status of some ITEMS is correctly first uninitialized (i.e., NULL).