-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from konnected-io/rename-smartapp
rename smartapp to simply 'Konnected Security'
- Loading branch information
Showing
7 changed files
with
57 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
FIRMWARE_PATH=${PWD}/../nodemcu-firmware | ||
IMAGE_NAME=konnected-security-2-0-beta1 | ||
|
||
cp firmware/1.5.4.1/app/include/* $FIRMWARE_PATH/app/include/ | ||
docker run -e "INTEGER_ONLY=1" \ | ||
-e "IMAGE_NAME=${IMAGE_NAME}" \ | ||
--rm -ti -v $FIRMWARE_PATH:/opt/nodemcu-firmware marcelstoer/nodemcu-build | ||
|
||
cp ${FIRMWARE_PATH}/bin/nodemcu_integer_${IMAGE_NAME}.bin firmware/${IMAGE_NAME}.bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
IMAGE_NAME=konnected-security-2-0-beta1 | ||
PORT=/dev/cu.wchusbserial1410 | ||
|
||
esptool.py --port=${PORT} write_flash --flash_mode dio 0x00000 firmware/${IMAGE_NAME}.bin | ||
cd source-code && nodemcu-uploader --port=${PORT} upload * --verify=raw |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/** | ||
* Konnected Alarm | ||
* Konnected Security (Connect) | ||
* | ||
* Copyright 2017 konnected.io | ||
* | ||
|
@@ -14,7 +14,7 @@ | |
* | ||
*/ | ||
definition( | ||
name: "Konnected Alarm", | ||
name: "Konnected Security (Connect)", | ||
namespace: "konnected-io", | ||
author: "konnected.io", | ||
description: "Convert your wired home alarm system into a SmartThings smart alarm", | ||
|
@@ -24,6 +24,7 @@ definition( | |
iconX3Url: "https://raw.githubusercontent.com/konnected-io/SmartThings/master/images/icons/[email protected]", | ||
singleInstance: true | ||
) | ||
|
||
mappings { | ||
path("/device/:mac/:id/:deviceState") { action: [ PUT: "childDeviceStateUpdate"] } | ||
path("/ping") { action: [ GET: "devicePing"] } | ||
|
@@ -36,18 +37,18 @@ preferences { | |
} | ||
|
||
def installed() { | ||
log.info "installed(): Installing Konnected Alarm SmartApp" | ||
log.info "installed(): Installing Konnected Security SmartApp" | ||
initialize() | ||
runEvery3Hours(discoverySearch) | ||
} | ||
|
||
def updated() { | ||
log.info "updated(): Updating Konnected Alarm SmartApp" | ||
log.info "updated(): Updating Konnected Security SmartApp" | ||
initialize() | ||
} | ||
|
||
def uninstalled() { | ||
log.info "uninstall(): Uninstalling Konnected Alarm SmartApp" | ||
log.info "uninstall(): Uninstalling Konnected Security SmartApp" | ||
revokeAccessToken() | ||
|
||
// Uninstall SmartApp, tell device that access is revoked and remove all the settings | ||
|
@@ -109,7 +110,7 @@ def pageWelcome() { | |
configuredAlarmPanels.each { | ||
href( | ||
name: "device_" + it.mac, | ||
title: "AlarmPanel_" + it.mac[-6..-1], | ||
title: "konnected-" + it.mac[-6..-1], | ||
description: "Tap to view device status", | ||
required: false, | ||
image: "https://raw.githubusercontent.com/konnected-io/SmartThings/master/images/icons/Device.png", | ||
|
@@ -136,15 +137,24 @@ def pageDiscovery() { | |
discoveryVerification() | ||
def alarmPanels = pageDiscoveryGetAlarmPanels() | ||
section("Please wait while we discover your device") { | ||
input(name: "selectedAlarmPanels", type: "enum", title: "Select Alarm Panel (${alarmPanels.size() ?: 0} found)", required: true, multiple: true, options: alarmPanels, defaultValue: settings.selectedAlarmPanels, submitOnChange: true) | ||
input( | ||
name: "selectedAlarmPanels", | ||
type: "enum", | ||
title: "Select devices (${alarmPanels.size() ?: 0} found)", | ||
required: true, | ||
multiple: true, | ||
options: alarmPanels, | ||
defaultValue: settings.selectedAlarmPanels, | ||
submitOnChange: true | ||
) | ||
} | ||
} | ||
} | ||
|
||
Map pageDiscoveryGetAlarmPanels() { | ||
def alarmPanels = [:] | ||
def verifiedAlarmPanels = getDevices().findAll{ it.value.verified == true } | ||
verifiedAlarmPanels.each { alarmPanels["${it.value.mac}"] = it.value.name ?: "AlarmPanel_${it.value.mac[-6..-1]}" } | ||
verifiedAlarmPanels.each { alarmPanels["${it.value.mac}"] = it.value.name ?: "konnected-${it.value.mac[-6..-1]}" } | ||
return alarmPanels | ||
} | ||
|
||
|
@@ -208,12 +218,12 @@ private Map pageConfigurationGetDeviceType(Integer i) { | |
return deviceTypes | ||
} | ||
|
||
//Retrieve selected device | ||
// Retrieve selected device | ||
def getConfiguredDevices() { | ||
getDevices().findAll { settings.selectedAlarmPanels.contains(it.value.mac) }.collect { it.value } | ||
} | ||
|
||
//Retrieve devices saved in state | ||
// Retrieve devices saved in state | ||
def getDevices() { | ||
if (!state.devices) { state.devices = [:] } | ||
return state.devices | ||
|
@@ -223,11 +233,17 @@ def getDeviceIpAndPort(device) { | |
"${convertHexToIP(device.networkAddress)}:${convertHexToInt(device.deviceAddress)}" | ||
} | ||
|
||
//Device Discovery : Device Type | ||
def discoveryDeviceType() { return "urn:schemas-konnected-io:device:AlarmPanel:1" } | ||
//Device Discovery : Send M-Search to multicast | ||
def discoverySearch() { sendHubCommand(new physicalgraph.device.HubAction("lan discovery ${discoveryDeviceType()}", physicalgraph.device.Protocol.LAN)) } | ||
//Device Discovery : Subscribe to SSDP events | ||
// Device Discovery : Device Type | ||
def discoveryDeviceType() { | ||
return "urn:schemas-konnected-io:device:Security:1" | ||
} | ||
|
||
// Device Discovery : Send M-Search to multicast | ||
def discoverySearch() { | ||
sendHubCommand(new physicalgraph.device.HubAction("lan discovery ${discoveryDeviceType()}", physicalgraph.device.Protocol.LAN)) | ||
} | ||
|
||
// Device Discovery : Subscribe to SSDP events | ||
def discoverySubscription(force=false) { | ||
if (force) { | ||
unsubscribe() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
local me = { | ||
name = "AlarmPanel", | ||
hwVersion = "0.1", | ||
swVersion = "0.1" | ||
name = "Security", | ||
hwVersion = "2.0.beta1", | ||
swVersion = "2.0.beta1" | ||
} | ||
return me |