I’m just getting used to OH3. I’ve got a group “windows” that contains motion sensors and I want to get a notification if a window is open for more than 10 minutes.
triggers:
- id: "1"
configuration:
itemName: windows
state: ALARM
type: core.ItemStateUpdateTrigger
conditions: []
actions:
- inputs: {}
id: "2"
configuration:
type: application/vnd.openhab.dsl.rule
script: >-
var telegramAction = getActions("telegram",
"telegram:telegramBot:xxx")
telegramAction.sendTelegram("Windows Open!")
type: script.ScriptAction```
Somehow it doesn't trigger. I guess because of the status "Err" in the windows group.
Why is this, isn't the state of the group similar to the state of all contained items?
(closed = motion, open = alarm for these motion sensors).
Followup question: I thought about how I would do the 10 minutes part. A way I can think of is create a dummy item with an expiration timer (metadata in OH3) of 10 minutes and send a message if it receive a command after 10 mins OR if windows.state updates to MOTION (all are closed) just update the state of the dummy item without a command, not triggering the msg.
Does this sound right?
“Err” in your display means the UI has a problem showing the state - not that there’s anything wrong with the state. For example, you asked for a decimal format display, but the actual state is string,or something like.
For your rule, you might be more interested in “Member of” style triggering anyway.
I’ve changed it to member of state change, and it works. With OH2 I just had a check on windows.state and it worked.
This seemed easier for the second part: How would I now check if all Windows are closed (in state MOTION)? So I can cancel the alarm if one is updated?
Edit, I just realized the Group definition (textfiles) in my old config is:
Group:String:AND("MOTION", "ALARM") windows "Open Windows [(%d)]" <contact> (all)
You seem to be defining your Group Item from a file, so to change it you would edit the file contents.
What I meant is: Is there a way to define this aggregation in the UI as well?
Right, I must have confused it. I’d like to have the state AND the count of open windows. Which doesn’t seem to be possible according to: Items | openHAB
There is only an example for switches with both.
As well? No. Instead of …
If you define your Item from file, edit the the file.
If you create your Item in UI, edit in UI.
However
There is a UI bug that does not currently offer all possible aggregation types for all Group types.