Compare commits

..

5 Commits

Author SHA1 Message Date
Jack Chi
78a509e8f5 Merge pull request #1555 from skt123/micro_smart_switch
[CHF-493] Added Health Check Implementation for Micro Smart Switch 2E.
2017-03-22 10:06:11 -07:00
Ryan Applegate
42d31f29cc Merge pull request #1820 from rappleg/FixSmartSenseMultiBackgroundColor
DVCSMP-2533 Fix backgroundColor on SmartSense Multi
2017-03-22 11:28:03 -05:00
rappleg
9b4f6974de DVCSMP-2533 Fix backgroundColor on SmartSense Multi 2017-03-22 11:21:04 -05:00
Sushant
ea5344f9c8 Merge branch 'master' into micro_smart_switch 2017-03-22 15:22:13 +05:30
sushant.k1
b5e1d652fd [CHF-493] Added Health Check Implementation for Micro Smart Switch 2E. 2017-03-22 15:17:55 +05:30
3 changed files with 13 additions and 248 deletions

View File

@@ -52,7 +52,7 @@ metadata {
tiles(scale: 2) {
multiAttributeTile(name:"contact", type: "generic", width: 6, height: 4){
tileAttribute ("device.contact", key: "PRIMARY_CONTROL") {
attributeState "open", label:'${name}', icon:"st.contact.contact.open", backgroundColor:"##e86d13"
attributeState "open", label:'${name}', icon:"st.contact.contact.open", backgroundColor:"#e86d13"
attributeState "closed", label:'${name}', icon:"st.contact.contact.closed", backgroundColor:"#00a0dc"
}
}

View File

@@ -22,10 +22,12 @@ metadata {
capability "Configuration"
capability "Sensor"
capability "Light"
capability "Health Check"
command "reset"
fingerprint inClusters: "0x25,0x32"
fingerprint mfr:"0086", prod:"0003", model:"0012", deviceJoinName: "Aeon Labs Micro Smart Switch 2E"
}
// simulator metadata
@@ -73,6 +75,8 @@ metadata {
}
def updated() {
// Device-Watch simply pings if no device events received for 32min(checkInterval)
sendEvent(name: "checkInterval", value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
try {
if (!state.MSR) {
response(zwave.manufacturerSpecificV2.manufacturerSpecificGet().format())
@@ -179,6 +183,14 @@ def poll() {
])
}
/**
* PING is used by Device-Watch in attempt to reach the Device
* */
def ping() {
log.debug "ping() called"
refresh()
}
def refresh() {
delayBetween([
zwave.switchBinaryV1.switchBinaryGet().format(),

View File

@@ -1,247 +0,0 @@
/**
* IJINI
*
* Copyright 2017 IPL_DevAccount
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
* for the specific language governing permissions and limitations under the License.
*
*/
/*definition(
name: "IJINI",
namespace: "IJINI",
author: "IPL_DevAccount",
description: "this Application will receive request that send by IJINI(Robot).",
category: "Convenience",
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png",
iconX3Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png")
preferences {
section("Title") {
// TODO: put inputs here
}
}
def installed() {
log.debug "Installed with settings: ${settings}"
initialize()
}
def updated() {
log.debug "Updated with settings: ${settings}"
unsubscribe()
initialize()
}
def initialize() {
// TODO: subscribe to attributes, devices, locations, etc.
}*/
// TODO: implement event handlers
definition(
name: "IJINI",
namespace: "IJINI",
author: "IPL_DevAccount",
description: "this Application will receive request that send by IJINI(Robot).",
category: "Convenience",
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png",
iconX3Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png")
preferences {
section("Allow Endpoint to Control These Things...") {
input "switches", "capability.switch", title: "Which Switches?", multiple: true
//input "locks", "capability.lock", title: "Which Locks?", multiple: true
input "themotion", "capability.motionSensor", title: "Which Motions?", multiple: true
}
}
mappings {
path("/switches") {
action: [
GET: "listSwitches"
]
}
path("/switches/:id") {
action: [
GET: "showSwitch"
]
}
path("/switches/:id/:command") {
action: [
GET: "updateSwitch"
]
}
path("/locks") {
action: [
GET: "listLocks"
]
}
path("/locks/:id") {
action: [
GET: "showLock"
]
}
path("/locks/:id/:command") {
action: [
GET: "updateLock"
]
}
path("/SwitchState/:id") {
action: [
GET: "SwitchState"
]
}
}
def SwitchState()
{
GetSwitchState(switches,"switch");
}
def GetSwitchState(devices, type)
{
def device = devices.find { it.id == params.id }
if (!device) {
httpError(404, "Device not found ${devices}")
}
else
{
def attributeName = (type == "motionSensor") ? "motion" : type
def s = device.currentState(attributeName)
[value: s?.value]
}
}
def installed() {
initialize()
}
def updated()
{
unsubscribe()
}
def initialize()
{
subscribe(themotion, "motion.active", motionDetectedHandler)
subscribe(themotion, "motion.inactive", motionStoppedHandler)
}
def motionDetectedHandler(evt) {
log.debug "motionDetectedHandler called: ${evt}"
httpGet(String uri, Closure closure)
}
def motionStoppedHandler(evt) {
log.debug "motionStoppedHandler called: ${evt}"
}
//switches
def listSwitches() {
switches.collect{device(it,"switch")}
}
def showSwitch() {
show(switches, "switch")
}
void updateSwitch() {
update(switches)
}
//locks
def listLocks() {
locks.collect{device(it,"lock")}
}
def showLock() {
show(locks, "lock")
}
void updateLock() {
update(locks)
}
//Motions
def listMotion() {
log.debug "listMotions is activated...."
motion.collect{device(it,"motion")}
}
def showMotion() {
show(motion, "motionSensor")
}
void updateMotion() {
update(motion)
}
def deviceHandler(evt) {
log.debug "deviceHandler"
}
private void update(devices)
{
log.debug "update, request: params: ${params}, devices: $devices.id"
//def command = request.JSON?.command
def command = params.command
//let's create a toggle option here
if (command)
{
def device = devices.find { it.id == params.id }//it, params 상에서 같은것을 찾아내서 저장...하는듯하다.
if (!device) {
httpError(404, "Device not found")
} else {
if(command == "toggle")
{
if(device.currentValue('switch') == "on")
{
device.off();
}
else
{
device.on();
}
}
else
{
device."$command"()
}
}
}
}
private show(devices, type) {
log.debug "device = ${devices},type = ${type} "
def device = devices.find { it.id == params.id }
if (!device) {
httpError(404, "Device not found")
}
else {
def attributeName = (type == "motionSensor") ? "motion" : type
def s = device.currentState(attributeName)
[id: device.id, label: device.displayName, value: s?.value, unitTime: s?.date?.time, type: type]
}
}
private device(it, type) {
log.debug "device ctrl.. ${it}, ${type}"
it ? [id: it.id, label: it.label, type: type] : null
}