Could "Last Activity" be exposed to rule machine

Could "Last Activity" be exposed as a "Custom Attribute" or even as a hub variable (assigned via device attributes).

I would like to use it in rule machine.

I know there is an app, but I want to use it in rule machine so I can trigger http requests to my PI.

1 Like

How are you planning to use this data, specifically? I'm asking because it's device metadata only and does not generate events, so it could not be used as a trigger, but there are would likely be ways to do what you want.

Using Maker API to do something on the same hub as Maker API itself is almost always the weirdest possible way you can do whatever it is you're doing, though it might work -- but in any case, we really need the answer to the above about how the data is to be used, as this doesn't do anything differently than mentioned there (e.g., it still could not trigger a rule).

2 Likes

That is a local variable named lastActivity though right? Its not the one in the Devices list that gets updated by zigbee activity. Correct?

But that does give me an idea. Most of these devices are reporting a temperature or something. I could try that.

Thanks!

1 Like

Devices disappear and I want to alarm when they do . There is a github added function, but I would like to just access what seems to be a simple variable from within rule machines.

I have a periodic procedure that checks batteries, and gives me a voice prompt when they go dead. But often these devices go away before they can report their batteries are low.

I want to get rule machine to sense a missing device and issue a http get.

1 Like

What do you mean by this?

My question was more about how: with a periodic check? That's probably the best you can do, as the value of this data changing does not generate an event on the hub, so it cannot be used to "trigger" an automation directly in that sense. But it would be good to know that before pursing any particular option.

The app I meant was this one:

release-device-activity-check-get-notifications-for-inactive-devices

Yes, I would be fine with a periodic check. In fact, my battery check currently works that way. It checks the batteries of all my devices at a particular time of day and gives an audible alarm.

1 Like

If you join the "owners" group, you'll be able to post links (and images): Hub owners - Hubitat

But I know what you are referring to, as I wrote that app. :slight_smile:

If you have any interest in (sort of) writing custom apps, it may be easiest to simply modify it to send an HTTP call do your device directly instead of sending the notification. Alternatively, an option like the ability to "push" a virtual button device or similar would make a usable trigger in Rule Machine. Neither of these features exist in the app right now, and you could also write a simple one to meet your specific needs, but since RM cannot access these values directly, I'd say that's probably the best option. Or at least that's what I'd do!

1 Like

Very cool. I didnt know you wrote it. I will look into coding it as I do some coding from time to time. Maybe I will generalize it to be an app that publishes "inaccessible data" to hub variables so anyone can get to anything.

The other thought I had was using a virtual notifier. I looked and I did not see what looked like a generic virtual notifier. That seems like a great app to have. Where the virtual notifier could be a connector to http or other functions.

1 Like

I've got one of those, too. :slight_smile:

App: Hubitat/apps/NotificationProxy/NotificationProxyApp.groovy at master · RMoRobert/Hubitat · GitHub

Driver: Hubitat/drivers/NotificationProxy.groovy at master · RMoRobert/Hubitat · GitHub

You could probably get by with just the driver for you use case and modify it to send an HTTP call when deviceNotification() is called, then use that device in my app (or whatever) instead of a "real" notification device.

(The intent with my app and driver together was to use one "proxy" notification device like this to send that notification to one or more "real" devices, useful without needing to select them all in every app individually or switch out the devices easily if you change for whatever reason -- but it's pretty simple and could be easily modified or the driver used alone.)

1 Like

Thanks! I just need it to do something simple like press a switch. I will play with it.

Thanks for all your help.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.