I am migrating a SmartThings custom application that automatically set SHM to Armed (away), Armed (home), and Disarmed. I would like for this application to do the same in Hubitat.
Is there an API call to set the HSM state? If so could you please provide examples of each state?
Hubitat⢠Safety Monitor (HSM) uses Hubitat Location Events to communicate with other apps.
It reports its state using an event named âhsmStatusâ, and custom monitoring rule arming/disarming with âhsmRulesâ. It reports alert events with an event named âhsmAlertâ. Apps can set the arm/disarm state of HSM with an event named âhsmSetArmâ. These events and their values are summarized below.
hsmStatus
armedAway intrusion alerts for Away are armed
armingAway intrusion Away arming pending exit delay
armedHome intrusion alerts for Home are armed
armingHome intrusion Home arming pending exit delay
armedNight intrusion alerts for Night are armed
armingNight intrusion Night arming pending exit delay
disarmed intrusion alerts are disarmed
allDisarmed intrusion, smoke, water and custom alerts are disarmed
hsmRules
armedRule descriptionText = name of HSM Monitoring Rule armed
disarmedRule descriptionText = name of HSM Monitoring Rule disarmed
hsmAlert
intrusion intrusion away alert
intrusion-home intrusion home alert
intrusion-night intrusion night alert
smoke smoke alert
water water alert
rule descriptionText = name of HSM Monitoring Rule alert
cancel alerts cancelled
arming failed to arm due to open contact
hsmSetArm
armAway arm intrusion alerts for Away
armHome arm intrusion alerts for Home
armNight arm intrusion alerts for Night
disarm disarm intrusion alerts
armRules arm all HSM Monitoring Rules alerts
disarmRules disarm all HSM Monitoring Rules alerts
disarmAll disarm all alerts and all HSM Monitoring Rules alerts
armAll arm smoke, water and all HSM Monitoring Rules alerts
cancelAlerts stop all in progress alerts
Examples:
For app to subscribe to HSM status:
subscribe(location, âhsmStatusâ, statusHandler)
For app to subscribe to HSM alerts:
subscribe(location, âhsmAlertsâ, alertHandler)
For app to arm HSM:
sendLocationEvent(name: âhsmSetArmâ, value: âarmAwayâ)
Handler example for HSM alerts:
def alertHandler(evt) {
log.info âHSM Alert: $evt.valueâ + (evt.value == âruleâ ? â, $evt.descriptionTextâ : ââ)
// only has descriptionText for rule alert
}
Note: For armingAway, the number of seconds of exit delay is in the event data map as "seconds".
@bravenel Thank you very much for this. One followup question, how can I get the latest value for hsmStatus? In ST I used location.currentState() but that is throwing an error in Hubitat: No signature of method: com.hubitat.hub.domain.Location.currentState() is applicable for argument types: (java.lang.String) values: [hsmStatus]
My code is: location.currentState("hsmStatus")?.value