How to access HSM events in Rule Machine and save them to a file?

Hi everyone,
I’m trying to use Rule Machine to log changes in the status of the Hubitat Safety Monitor (HSM) and their related details into a file, similar to the logs that appear in the system, like these:

app:32024-12-24 21:55:15.828 info Armed Night  
app:32024-12-24 21:51:27.007 warn Alert Intrusion-Night canceled  
app:32024-12-24 21:51:26.979 info All Disarmed  
app:32024-12-24 21:49:54.925 warn Alert Intrusion-Night Sensore Balcone Giardino 2 open  
app:32024-12-24 21:48:34.606 info Armed Night  

I’ve been able to monitor HSM state changes (e.g., Armed Night, All Disarmed) using the HSM Status trigger, but I’m not sure how to access the specific details, such as:

  • The reason for the alert (Sensore Balcone Giardino 2 open).
  • Log messages like Alert Intrusion-Night canceled.

Additionally, I’d like to save these details into a local file on Hubitat using Rule Machine’s "Append to file" action or another similar method.

My main questions are:

  1. Is it possible to access these detailed logs (alerts and messages) directly in Rule Machine?
  2. If yes, how can I configure them to save to a file?
  3. If it’s not possible in Rule Machine, is there an alternative method to do this (without using an external Maker API)?

Thank you in advance for any suggestions or configuration examples!

Not the logs themselves, but the same information is available to a rule. You would have to decide how to format the text.

A rule can trigger from an HSM Alert. After that happens, %text% contains the name of the device and its state (e.g. Front Door open) that caused the HSM alert. You just have to piece together what you want to write for each line of the file. You can use a String variable to build up the line of text if needed, or you could put all of it directly into Append File action:

2 Likes

Thanks