DSC Alarms Server


(Dave N) #1

Being a bit of a newb on more modern programming languages (Java, XML etc.) could someone clarify or fill in the blanks for the install docs (https://github.com/oehokie/SmartDSC) on the NodeJS DSC alarm implementation?

Lines like “Then see NAP-Demo (may need some tweaking). npm install works, otherwise just reference the code” elude me as this is Linux lingo and I’m in the dreaded Windows environment. Googled NodeJS and downloaded and installed this code but not sure how it fits onto the overall installation or how “just referencing the code” will get me in business.

Cheers!


(Isriam) #2

i’m working with a couple developers here on this site to put together documentation for the best implementation of the dsc alarm and smartthings.

i want the ability to view zones, and arm/disarm. once i get it working (some say they have it working) i’ll post some documentation for it.

i too have gone through what you are, and its rather annoying these isn’t just one location to find information on how to add your devices. we almost need a wiki.


(Dave N) #3

Thanks a lot. Glad someone is taking the bull by the horns. I looked at the easier method @sanity but I want to arm/disarm. I was scratching my head on the NodeJS thing, wasn’t sure if I installed that from the .org site and then still needed to make Alarm Server work as well and whether they had to talk to each other.


(Kent) #4

yeah most of the docs are assuming you know Python/Node and Groovy/Smartthings, lots of Unix/Linux experience is also assumed. I don’t have a Windows machine to test on and make decent docs for either so I can only guess.

I mentioned it before but I need to do a complete rewrite of the backend stuff to support UPNP which would make all this alot easier and would allow for a more secure way to arm/disarm.

I need to get on that. :smile:


(Dave N) #5

Just like Alex and his awesome interface there is the potential for a PayPal button if you find the time. I know I’m certainly willing to compensate both of you for your volunteer efforts :slight_smile:


(Isriam) #6

i have the arm/disarm working with @ethomasii alarmserver but i’m trying to figure out the rest api smartapp endpoints from this page Tutorial: Creating a REST SmartApp Endpoint

i think if i can get the url’s of my devices, then alarmserver can directly tell my contact sensors if they are opened or closed. i have no idea how to deal with the php code because when i click it, its blank. i try to run from a test server, and it just brings up my ST login screen, doesn’t seem like its the correct php code. @sanity :smile:

ethomasii config.cfg uses the following lines to do a callback to the ST device you create. So you can just use generic contact sensors, and create oauth and have alarmserver tell it that its open/closed based on the url.

Zone Open - when a zone is “open” ie, motion sensed or door open.

zoneopen1=https://graph.api.smartthings.com/api/smartapps/installations/…
zoneopen2=https://graph.api.smartthings.com/api/smartapps/installations/…

Zone Close - when a zone is “closed” ie, motion stopped or door closed.

zoneopen1=https://graph.api.smartthings.com/api/smartapps/installations/…
zoneopen2=https://graph.api.smartthings.com/api/smartapps/installations/…


(Kent) #7

You don’t need that PHP code at all, follow my RESTAPISetup.md setup doc that is in my Smartthings-dsc repo.


(Isriam) #8

But with your alarmserver I can’t arm the system. With ethomasii I can’t monitor zones lol. Don’t we have a happy medium somewhere?


(Ethomasii) #9

As @sanity mentioned, you can follow his steps to get the URL. At the very end, you will see the example URL you need to use, and it is a “smartapp” URL. This does not mean you actually need a smartapp to control the devices.

And I really am not sure what you are talking about, not being able to monitor zones. Every single door/motion sensor i have on my DSC alarm is integrated into my smartthings. I have 6 zones (2 motion/4 doors) plus arm/disarm/stay and I also monitor the siren. I just do not utilize a central smartapp to control them… my great room motion detector connected to my DSC alarm shows up as a motion sensor in SmartThings and i can do anything I want to with it that I would do with a native SmartThings motion sensor.


(Ethomasii) #10

This is my .cfg file… i have removed the guids that may make you control my home :smile:

zone1=Garage Door
zone2=Front Door
zone3=Kitchen Door
zone4=Basement Door
zone5=Great Room
zone6=Basement
zone7=Alarm
zone8=Alarm

Pretty names for the user ids that arm/disarm alarm.

user1=MyUser1
user2=MyUser2
user3=MyUser3

zoneopen1=https://graph.api.smartthings.com/api/smartapps/installations//contactsensors//open?access_token=
zoneopen2=https://graph.api.smartthings.com/api/smartapps/installations//contactsensors//open?access_token=
zoneopen3=https://graph.api.smartthings.com/api/smartapps/installations//contactsensors//open?access_token=
zoneopen4=https://graph.api.smartthings.com/api/smartapps/installations//contactsensors//open?access_token=
zoneopen5=https://graph.api.smartthings.com/api/smartapps/installations//motionsensors//open?access_token=
zoneopen6=https://graph.api.smartthings.com/api/smartapps/installations//motionsensors//open?access_token=

zoneclose1=https://graph.api.smartthings.com/api/smartapps/installations//contactsensors//open?access_token=
zoneclose2=https://graph.api.smartthings.com/api/smartapps/installations//contactsensors//open?access_token=
zoneclose3=https://graph.api.smartthings.com/api/smartapps/installations//contactsensors//open?access_token=
zoneclose4=https://graph.api.smartthings.com/api/smartapps/installations//contactsensors//open?access_token=
zoneclose5=https://graph.api.smartthings.com/api/smartapps/installations//motionsensors//open?access_token=
zoneclose6=https://graph.api.smartthings.com/api/smartapps/installations//motionsensors//open?access_token=

alarmstay=https://graph.api.smartthings.com/api/smartapps/installations//switches//arm?access_token=
alarmaway=https://graph.api.smartthings.com/api/smartapps/installations//switches//arm?access_token=

alarmoff1=https://graph.api.smartthings.com/api/smartapps/installations//switches//disarm?access_token=
alarmoff2=https://graph.api.smartthings.com/api/smartapps/installations//switches//disarm?access_token=

alarmsirenon=https://graph.api.smartthings.com/api/smartapps/installations//switches//on?access_token=
alarmsirenoff=https://graph.api.smartthings.com/api/smartapps/installations//switches//off?access_token=


(Isriam) #11

ok that is very helpful there @ethomasii. i have my arm/disarm working with calls to/from but i do have a smartapp. can you post your smartapp also, since it will contain the device information to pass control, and maybe a contact sensor for me?

i’ved tried a few generic contact sensors but cannot make them respond to open/closed in the url. id love to see what your smartapp looks like and the contact/motion sensors. sorry i’m needing so much help but there is a steep learning curve for me since i’m not a coder :slight_smile:


(Isriam) #12

oh also, i noticed your config says use arm/disarm and stay/disarm however arm was an invalid command, i believe your device-type used alarm instead of arm. i renamed all of them to away and stay, and disarm and disarm2. maybe i have some outdated code from your github.

java.lang.IllegalArgumentException: Command ‘open’ is not supported. Supported commands: [] @ line 144


(Ethomasii) #13

which device type are you getting the open command not supported?


(Ethomasii) #14

I did make my own devicetypes, but it was not necessary… for example, here my code for a door:

metadata {
// Automatically generated. Make future change here.
definition (name: “DSC Door”, author: "ethomasii@gmail.com") {
capability "Contact Sensor"
capability “Sensor”

	command "open"
	command "closed"
}

simulator {
	status "open": "zone report :: type: 19 value: 0031"
	status "closed": "zone report :: type: 19 value: 0030"
}

tiles {
	standardTile("contact", "device.contact", width: 2, height: 2) {
		state("open", label:'Open', action: "contact.open", icon:"st.contact.contact.open", backgroundColor:"#53a7c0")
		state("closed", label:'Closed', action: "contact.closed", icon:"st.contact.contact.closed", backgroundColor:"#ffffff")
	}
	
	main "contact"
	details(["contact"])
}

}

def parse(String description) {
}

def open() {
log.debug “Door open detected”
// motionCmd(1)
sendEvent(name: “contact”, value: “open”)

}

def closed() {
log.debug “Door closed detected”
// motionCmd(0)
sendEvent(name: “contact”, value: “closed”)
}


(Isriam) #15

tried a few. contactSensor, sensor…let me show you my device-type.

metadata {
// Automatically generated. Make future change here.
definition (name: “Open/Closed Sensor”, namespace: “smartthings”, author: “SmartThings”) {
capability "Contact Sensor"
capability “Sensor”

	fingerprint profileId: "0104", deviceId: "0402", inClusters: "0000,0001,0003,0009,0500", outClusters: "0000"
}

// simulator metadata
simulator {
	// status messages
	status "open":   "zone report :: type: 19 value: 0031"
	status "closed": "zone report :: type: 19 value: 0030"
}

// UI tile definitions
tiles {
	standardTile("contact", "device.contact", width: 2, height: 2) {
		state "open", label: '${name}', icon: "st.contact.contact.open", backgroundColor: "#ffa81e"
		state "closed", label: '${name}', icon: "st.contact.contact.closed", backgroundColor: "#79b821"
	}

	main "contact"
	details "contact"
}

}

// Parse incoming device messages to generate events
def parse(String description) {
def name = null
def value = description
if (zigbee.isZoneType19(description)) {
name = "contact"
value = zigbee.translateStatusZoneType19(description) ? “open” : “closed”
}

def result = createEvent(name: name, value: value)
log.debug "Parse returned ${result?.descriptionText}"
return result

}


(Isriam) #16

that did it! your custom door worked for open/close!


(Isriam) #17

Ethomasii can you explain how you got your siren and other dsc items to work? Did you enable more code I might be missing?

Thanks


(Ethomasii) #18

Same code that you have… what do you have left that is not working? I can send you what i have for motion sensors and the siren.

Here is siren:

/**

  • SmartAlert Siren

  • Author: SmartThings

  • Date: 2013-03-05
    */
    metadata {
    // Automatically generated. Make future change here.
    definition (name: “DSC Siren”, namespace: “ethomasii”, author: “Eric Thomas”) {
    capability "Alarm"
    capability “Switch”
    }

    simulator {
    }

    tiles {
    valueTile(“alarm”, “device.alarm”, width: 2, height: 2) {
    state “off”, label:‘off’, icon:“st.alarm.alarm.alarm”, backgroundColor:"#ffffff"
    state “siren”, label:‘siren!’, icon:“st.alarm.alarm.alarm”, backgroundColor:"#e86d13"
    }
    main "alarm"
    details([“alarm”])
    }
    }

def on() {
sendEvent(name: “alarm”, value: “siren”)
}

def off() {
sendEvent(name: “alarm”, value: “off”)
}

def siren() {
sendEvent(name: “alarm”, value: “siren”)
}


(Ethomasii) #19

BTW, the Siren is one way only… I do not enable turning it on/off. Smartthings is just notified whenever the siren goes off. It has a special 3 digit code for that in the code, so when it sounds, it is triggered in alarmserver and then smartthings is notified of it.

I use the siren to send me a push notification when it is going off… that way I am ensured I will be alerted if it is going off :smile:


(Ethomasii) #20

Here is my code for the motion sensor. Remember to setup the motion sensor capability and you should be good to go:

/**

metadata {
// Automatically generated. Make future change here.
definition (name: “DSC Motion”, author: "ethomasii@gmail.com", oauth: true) {
capability “Motion Sensor”

	command "active"
	command "inactive"
}

simulator {
	status "active": "zone report :: type: 19 value: 0031"
	status "inactive": "zone report :: type: 19 value: 0030"
}

tiles {
	standardTile("motion", "device.motion", width: 2, height: 2) {
		state("active", label:'motion', action: "motion.active", icon:"st.motion.motion.active", backgroundColor:"#53a7c0")
		state("inactive", label:'no motion', action: "motion.inactive", icon:"st.motion.motion.inactive", backgroundColor:"#ffffff")
	}
	
	main "motion"
	details(["motion"])
}

}

def parse(String description) {
}

def active() {
log.debug “Motion detected”
// motionCmd(1)
sendEvent(name: “motion”, value: “active”)

}

def inactive() {
log.debug “No motion detected”
// motionCmd(0)
sendEvent(name: “motion”, value: “inactive”)
}