To @UkSub , as promised, here is a group of three RM rules I use to manage and get notifications of when my memory starts to approach a critically low value. The three rules consist of: Rule #1 Hub memory low-reboot and notify; Rule #2 Hub Rebooted Notification; and Rule #3 Hub Rebooted - Update Mode States.
Rule #1 tells me when the memory is low and will automatically reboot my hub and notify me when this is done. The rationale for the 12 minute delay is that sometimes your hub may temporarily dip below the threshold level you set and you really only want the hub to auto reboot if it stays below a certain level for a certain period of time. The 2 minute warning allows you a short amount of time to abort the auto reboot if you wish.
Rule #2 sends me another notification to let me know if the hub has actually successfully rebooted based on the uptime that has elapsed since the last reboot, just so I know if I am at a remote location that the hub actually did successfully start up again.
Rule #3 makes sure that my hub is set to the correct Mode when it is restarted based on the time of day. If your Mode setting is triggered by a certain time, your Mode setting may be incorrect until the next time that particular time occurs again depending upon when your hub reboots (say after a power failure depending upon how long it takes for the power to be restored). This is not critical when a “low memory” reboot is automatically performed, but I just included this for your reference to be complete.
As mentioned in my previous response to your question, the device “- Hub Information -“ is the device set up with @thebearmay ’s Hub Information Driver. The various attributes such as “freeMemory” and “uptime” can be referenced via a device you set up using the Hub Information Driver and can be used as Required Expressions and Trigger Events as well as Conditions within your rules.
I have also set up a device using the Hubitat Hub Controller driver to initiate an automatic reboot of my hub upon hitting the low memory threshold. I believe you can also just use the Hub Information Driver device as well as there is a [Reboot] button on devices set up with that driver as well.
Here are screen shots of the three rules:
Rule #1
Rule #2
Rule #3
Note: While my Rule #1 triggers an automatic reboot of the hub as well as notifying me of the low memory condition causing the automatic reboot, to answer your question about a simple rule to notify of the low memory condition, you can edit my rule to get rid of the automatic reboot by eliminating the “reboot() on - Hub Controller - action line.
Hope you find these sample RM rules helpful to give you some ideas of at least one way to approach this.
I am sure that there may be more elegant ways of accomplishing this but this has been working well for me for a number of years now and has been rock solid. I also like to avoid combining too many functions in one rule as it sometimes makes troubleshooting much more difficult when something goes wrong (at least in my experience). By separating the functions into various (more simple) rules, I have found it is easier (at least for me) to track down a problem when and if they occur. Of course, YMMV. Anyway, hope this is helpful to someone.
BTW, I use local variables so that I can easily change the various parameters (such as my low memory threshold, uptime, etc) when I am experimenting with my RM rules to determine the optimum values to use. It is much easier to click on the local variable to change it than to go into the rule and have to edit values in each condition within the rule. This way I can easily see what values work the best for each condition in the rule and can easily change them.