Hubitat Safety Monitor API

I think it's implemented. It would be location.hsmStatus. I believe it was in the most recent release.

1 Like

That worked. Thanks!

1 Like

@bravenel
I added this command to a method but when trying to save changes I get the following:

Invalid variable name. Must start with a letter but was: “hsmSetArm” . At [579:29] @ line 579, column 29.

Please advise.

When trying to save the app?

Yup

If you copied/pasted there's something weird going on with the quotes. Try replacing manually.

2 Likes

This works just fine, and the comment about quotes is no doubt your problem.

definition(
		name: "test app",
		namespace: "hubitat",
		author: "Bruce Ravenel",
		description: "test app",
		category: "Convenience",
		iconUrl: "",
		iconX2Url: ""
)

preferences {
    section {
    }
}

def installed() {
    initialize()
}

def updated() {
    initialize()
}

def initialize() {
	sendLocationEvent(name: "hsmSetArm", value: "blahblah")
}
1 Like

Indeed it was the problem. This is the 3rd time these quotations have got me. You'd think I would have learned by now. Thank you sir.

1 Like

Yes, something detestable about Discourse, for sure!

So it saved fine but does not appear to be changing the HSM armed state.

Strike that @bravenel
It appears that you cannot switch between armAway and armHome. If I disarm first and then set to one of the armed modes it works. Wasn't aware that there were limits on what mode could switch to another.

Ah, that's a bug. Just tried, and got unexpected response.

The bug is trivial to fix. But it won't be in the release coming out today. Next one after that.

When I subscribe:
subscribe(location, “hsmStatus”, statusHandler)

I'm getting:
Invalid variable name. Must start with a letter but was: “hsmStatus” . At [219:25] @ line 219, column 25.

Check your double quotes (as mentioned for the exact same error a few posts above :slight_smile: )

should be

subscribe(location, "hsmStatus", statusHandler)

Oh, thanks. Man I gotta keep an eye on that. Copy and paste from this form always results in that.

2 Likes

Please note a correction to the API shown above. There are two separate intrusion alert values for hsmAlert. "intrusion" means an intrusion alert when armed-away, and "intrusion-home" means an intrusion when armed-home.

@bravenel it would be very nice to have an "armed night" mode, which is commonly available in other security systems :wink:

HSM has “Armed-Home”, is that what you are referring to? That is what I use for night time.

home and night would be two different modes, with more sensors active and night but still less than away