The rule below is supposed to send a notification and announce, via Echo devices, when the bathroom window is open. The rule should only run if the outside temperature is below 10ºC and only run after 10 minutes, and every 10 minutes after that. In the majority of cases the rule runs regardless of the outside temperature and runs after a random amount of time - always less than 10 minutes - as soon as 2 minutes and every 1-2 minutes afterwards. There are no errors/warnings in the logs. It just seems that openhab forgot how to tell time and is ignoring the temperature. Disabling/enabling the rule clears this problem for a while, but it always comes back. I tried setting the log level of the Javascript Scripting binding to debug, but nothing unusual appeared in the logs. This has been going on for a few months now. I’m out of ideas.
configuration: {}
triggers:
- id: "1"
configuration:
itemName: Bathroom_Windows
state: OPEN
type: core.ItemStateChangeTrigger
conditions:
- inputs: {}
id: "3"
configuration:
itemName: PresenceSwitch
state: ON
operator: =
type: core.ItemStateCondition
- id: "4"
configuration:
itemName: BackYard_TemperatureSensor
operator: <
state: 10ºC
type: core.ItemStateCondition
actions:
- inputs: {}
id: "2"
configuration:
type: application/javascript;version=ECMAScript-2021
script: >
items.getItem("WON").sendCommand("ON")
var NoticeInterval = setInterval(()=> {
if(items.getItem("WON").state == "ON") {
if(items.getItem("ChetPresence").state == "ON") {
items.getItem("Echo_Living_Room_TTS").sendCommand("Entschuldigung Sie bitte. Das Badfenster ist noch auf, kann jemand es zumachen, bitte?")
items.getItem("Echo_Office_TTS").sendCommand("The Bathroom Window is still open. Can someone close it please.")
actions.NotificationAction.sendNotification("kchest@gmail.com", "Hey Chet, the Bathroom Window is still open. Can you close it please.")
}
if(items.getItem("KatPresence").state == "ON") {
actions.NotificationAction.sendNotification("kathrin@skorpil.org", "Hey Kathrin, the Bathroom Window is still open. Can you close it please.")
}
}
else clearInterval(NoticeInterval);}, 1000*60*10)
type: script.ScriptAction
- Platform information:
- Hardware: Gigabyte Brix MiniPC model GB-BXI7-5775R/MBHM87P-00 BIOS F2. 8GB RAM, 228GB HDD.
- OS: Ubuntu 22.04.01LTS
- Java Runtime Environment: OpenJDK 64-Bit Server VM Zulu17.50+19-CA (build 17.0.11+9-LTS, mixed mode, sharing)
- openHAB version: 4.1.2