Attribute Metadata in RM

Would it be possible to do conditional checks based on device attribute metadata? Like:

IF (Garage Motion inactive AND Garage Motion[change_timestamp] <= now - 15m)
IF (Garage Lights off AND Garage Lights[change_type] == physical)

That info is available in a custom app if I go dig through the event log, it would be wonderful to bubble it up into attributes we can interact with in RM.

Just looked for the same thing, having come from a Fibaro HC2 which had time stamps for attributes it allowed things like

If alarm set and upstairs motion trigged after downstairs motion then
House Sleeping
Else
House Empty
End If

Iā€™m sure there are other ways to do this sort of thing, but this did seem quite easy

Bump, Any chance the device object model can be extended so that each attribute has a last-modified timestamp as well?

While you'll have to wait to hear from staff, my guess is that significant changes to the device model are unlikely. But you can already do what you want with Rule Machine. The trick to these kind of "in the last X minutes" things is to use a delayed action...something like:

Rule 1

Trigger: Motion changed

Actions:

Cancel Delayed Actions
Set Private Boolean False: Rule 2
Delay 0:15:00 (cancelable)
Set Private Boolean True: Rule 2

Then in Rule 2, check the state of Private Boolean (e.g., "IF (Private Boolean is False)..." for "if motion attribute value changed in last 15 minutes").

RM also has for a "Physical Switch" trigger, which you can probably use in a similar fashion, setting PB or another variable depending on type (and checking its value to see what the last type was). Alternatively, maybe you could just do all your actions in a rule with that trigger instead of trying to mash them together with another (presumably they are different actions or you wouldn't care for this distinction in the first place?).

Of course, another alternative is a custom app. If you're comfortable writing those, and it sounds like you might be, then perhaps that's even easier. My opinion is that we are unlikely to see changes in the device model, slightly less likely but not impossible to see some sort of refinements in RM that might allow "in the last X"-type things to be done more easily (but note that they are already possible), and so I'd personally try the options that we know work today instead of waiting it out. :slight_smile:

The above are just general examples; if you have a specific automation in mind, perhaps someone can suggest a more targeted approach that may be cleaner than my general two-rule solution.

I do things like that where I really need it. I've thought about creating a custom app to track this generically but the current APIs make it rather awkward to store that much data.

My goal is to write more idempotent rules instead of event based rules. Many of my automations around lights/locks/etc can be easily expressed:

IF DrivewayMotion changed to active in the last 5 minutes then ...

Though really an event log would be more useful. Even if it was't available in RM having it on the raw Device object would be handy. Best I can do now is look at the event log for a device and try to match up that data with the attributes but it is sort of awkward.