SmartThings Community

Yale Smartphone Alarm System integration


(Daniel McDougall) #21

Just in case anyone is wondering, or stumbles across the page and then wonders.
I am still looking at this although the drive behind me doing it has dropped massively because it currently does everything I want it to do.

I can see the state of my open close door contacts and I can get the alarm to arm and disarm within the smartthings ecosystem. e.g I go out and the alarm turns itself on, I come home and it disarms as im pulling up on the drive.

now if and when I get other types of sensors i’ll probably look again but for now im not rushing.

just fyi


I started using your base Arm, Home, Disarm code today which works great. You allude above to having done even more integration. Are you able to share your additional code? Thanks

(Daniel McDougall) #23


the only other integration I did was to get the state of the Door window contact sensors to show in Smartthings.

That allowed you to use them with IFTTT or routines.

Thing is there is a delay and the way I got around that delay isn’t really publishable.
I can provide you with that code if you want,

I also changed some of the icons to better match Yales app and generally touched some stuff up.


If you could that would be great thanks. It is the door contact I am interested in.


My software knowledge is limited, but am I correct in understanding that you were able to log into your alarm system’s webpage access through the Smartthings device type handler, then use that login token to pull statuses and arm and disarm your system? Can this theoretically be repurposed to any alarm system’s web login?

(Daniel McDougall) #26

Yes that’s pretty much right.
In this case there is no token it’s literally just the cookie.

I actually took something that a guy had wrote for a honey well system and repurposed it for yale.

(Daniel McDougall) #27
*  Version 0.1 -  
preferences {

input("userName", "text", title: "Username", description: "Your username for Yale Home System")
input("password", "password", title: "Password", description: "Your Password for Yale Home System")

input("zonenumber", type: "number", title: "Row Number - Put 0 in here and open a window/door, refresh and see if the status changes", description: "Sensor ID")
metadata {
definition (name: "Yale Alarm Open Close Sensor", namespace: "Tapion1ives", author: "Tapion1ives") {
capability "Contact Sensor"
capability "Sensor"
capability "Refresh"

attribute "status", "string"

// UI tile definitions
tiles {
	standardTile("contact", "", width: 2, height: 2) {
		state "open", label:'${name}', icon:"", backgroundColor:"#ffa81e"
        state "closed", label: '${name}', icon: "", backgroundColor: "#79b821"
		state "Failed", label: '${name}', icon: "", backgroundColor: "#e5e500"
	standardTile("refresh", "device.status", inactiveLabel: false, decoration: "flat") {
		state "default", label:'', action:"refresh.refresh", icon:"st.secondary.refresh"

	main "contact"
	details ("contact", "refresh", "bypass")

// Zone status Information is below
// '' – Closed
// device_status.dc_open – Open

// Login Function. Returns SessionID for rest of the functions
def login(token) {
log.debug "Executed login"
def paramsLogin = [
	uri: "",
	body: [id:settings.userName , password: settings.password]
httpPost(paramsLogin) { responseLogin ->
	token = responseLogin.headers?.'Set-Cookie'?.split(";")?.getAt(0)
return token
} // Returns cookie as token		

// Logout Function. Called after every mutational command. Ensures the current user is always logged Out.
def logout(token) {
//log.debug "During logout - ${token}"
def paramsLogout = [
	uri: "",
	headers: ['Cookie' : "${token}"]
httpPost(paramsLogout) { responseLogout ->
	log.debug "Smart Things has successfully logged out"

 // Gets Panel Metadata. Takes token & location ID as an argument
Map panelMetaData(token) {

def tczones

def getPanelMetaDataAndFullStatus = [
	uri: "",
	body: [id:settings.userName , password: settings.password],
	headers: ['Cookie' : "${token}"]

httpPost(getPanelMetaDataAndFullStatus) {	response -> 

    tczones =

return [tczones: tczones]
} //Should return Sesor and description Information

def refresh() {		   
def token = login(token)
def zname =
def zonenumber = settings.zonenumber as int
def metaData = panelMetaData(token) // Gets Information
log.debug "Doing zone refresh"
if (metaData.tczones.contains("system.permission_denied")) {
	log.debug "Zone ${metaData.tczones} is Fault"
    sendEvent(name: "contact", value:"Failed", displayed: "true", description: "Refresh: Zone is Faulted", linkText: "Zone  ${zname} faulted", isStateChange: "true")
 } else if (metaData.tczones[zonenumber].status1.contains('device_status.dc_open')) {
	log.debug "Zone ${metaData.tczones[zonenumber].status1} is OPEN"
    sendEvent(name: "contact", value:"open", displayed: "true", description: "Refresh: Zone is Open", linkText: "Zone ${metaData.tczones[zonenumber].status1} - ${zname}", isStateChange: "true")
 } else if (metaData.tczones[zonenumber].status1.contains('')) {
	log.debug "Zone ${metaData.tczones[zonenumber].status1} is OK"
   sendEvent(name: "contact", value:"closed", displayed: "true", description: "Refresh: Zone is closed", linkText: "Zone ${metaData.tczones[zonenumber].status1} - ${zname}", isStateChange: "true")
sendEvent(name: "refresh", value: "true", displayed: "true", description: "Refresh Successful") 

// parse events into attributes
def parse(String description) {
log.debug "Parsing '${description}'"

(Daniel McDougall) #28

I haven’t checked through the above I just haven’t had time
but that’s what I was using and I was using some kind of auto refresh smart app.

i’ll try and be more active on here if anyone has any questions

thought better to have something put on here rather than nothing.

(Daniel McDougall) #29

So an interesting thing just happened today. I noticed that my rear sensors stopped chiming when I opened the doors and windows. I ran a walk test and I still got no response. I moved my box slightly further away from my smart things. Like a foot maybe and it all started working again. Now in just bought a few more bulbs and smart plugs recently so I’m guessing there is some form of interference. Just FYI as it appears to be only when they are sat on one another

(Clive) #30

Hi - I have just come across this thread, as I am looking to replace my old (X10) Comfort Alarm system I have had for many years. I was looking at Yale, but realised they were not integrated with ST and wondered if someone had tried this. I have only had ST for about 2 months, but had some fun making it work with Alexa; IFTTT and LWRF.

It sounds like you have made some good progress and would be interested in an update from you (or anyone else that has gone down this route).

Any further problems encountered, or views on whether this is a good solution?

(Oli) #31

Hi - thank you for your efforts in creating this Yale alarm device handler. I’m new to ST and not really very experienced with coding. I’ve managed to get the sensors and the alarm switch devices working. Have you managed to find a way to get the sensors to frequently refresh themselves automatically?

Ideally I want to be able check if any sensors are open without having to refresh each one individually and also if the alarm is triggered, to switch on my hue lights.

Is this achievable do you think? Saw that you mentioned a Service Manager but no idea how to go about that!

Many thanks

(Daniel McDougall) #32

So the sensors refreshing there is a smart app that works but its quite delayed and not great. Tbh id give up on the sensor idea.

Changing lights when the alarm sets off i sorted with an ifttt
You get an email with specific wording so you can set it to trigger. Also could do it from your phone with sms.

(Alex Godbehere) #33

Hi All.

I’ve not yet invested in the SmartThings ecosystem, but I do have the Yale Alarm. I’m currently working on an OpenHAB binding (with a view of being able to shout commands at my Google Home) for the system, but I’ve ran into a problem with the login authentication.

I’ve managed to successfully log in using the URL, but I’m not getting a cookie back. By using chrome to intercept the website requests, I do have a PHPSESSID being thrown around, however it looks to be sent with the initial request rather than returned as a response. When I look at the Set-Cookie response, it just contains language definitions.

Am I missing something?

(Daniel McDougall) #34

so from memory this isnt something i really got around myself.
i took the cookie from the header as i login and use that on each subsequent request along with the username and password in the body in order to fake a persistent session.
i dont know why it works but it does.

im not a developer im a data analyst so my day job is mainly sql this is my first experience with this language.

(Alex Godbehere) #35

Thanks for the update. Any chance you could share your latest code?

(Daniel McDougall) #36

its above here. its not changed since i first didt it

(Alex Godbehere) #37

When you call:

responseLogin ->
token = responseLogin.headers?.‘Set-Cookie’?.split(";")?.getAt(0)

I presume you are splitting the cookie with ‘;’, however my Set-Cookie parameter is just

Set-Cookie: language=en-US; path=/.

Do you have a token in there?

(Daniel McDougall) #38

yes but you only capture it at one particular point

(Alex Godbehere) #39

Where is that point?

(Daniel McDougall) #40