Skip to content

Commit

Permalink
rename smartapp to simply 'Konnected Security'
Browse files Browse the repository at this point in the history
  • Loading branch information
heythisisnate committed Jul 10, 2017
1 parent f1f0b90 commit 7e4bc92
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 23 deletions.
6 changes: 3 additions & 3 deletions firmware/1.5.4.1/app/include/user_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ extern void luaL_assertfail(const char *file, int line, const char *message);
#define LUA_PROCESS_LINE_SIG 2
#define LUA_OPTIMIZE_DEBUG 3

#define ENDUSER_SETUP_AP_SSID "AlarmPanel"
#define ENDUSER_SETUP_AP_SSID "konnected-security"

/*
* A valid hostname only contains alphanumeric and hyphen(-) characters, with no hyphens at first or last char
Expand All @@ -107,8 +107,8 @@ extern void luaL_assertfail(const char *file, int line, const char *message);
* if WIFI_STA_HOSTNAME_APPEND_MAC defined: Hostname MUST be 26 chars or less, since last 3 octets of MAC address will be appended
* if defined hostname is invalid: hostname will default to NODE-xxxxxx (xxxxxx being last 3 octets of MAC address)
*/
#define WIFI_STA_HOSTNAME "AlarmPanel"
//#define WIFI_STA_HOSTNAME_APPEND_MAC
#define WIFI_STA_HOSTNAME "konnected-security-"
#define WIFI_STA_HOSTNAME_APPEND_MAC

//#define WIFI_SMART_ENABLE

Expand Down
4 changes: 2 additions & 2 deletions firmware/1.5.4.1/app/include/user_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#define NODE_VERSION_REVISION 4U
#define NODE_VERSION_INTERNAL 1U

#define NODE_VERSION "NodeMCU 1.5.4.1\r\nAlarmPanel 0.1\r\n"
#define NODE_VERSION "NodeMCU 1.5.4.1\r\nKonnected Security 2.0.beta1\r\n"
#ifndef BUILD_DATE
#define BUILD_DATE "20170628"
#define BUILD_DATE "20170708"
#endif

extern char SDK_VERSION[];
Expand Down
Binary file added firmware/konnected-security-2-0-beta1.bin
Binary file not shown.
11 changes: 11 additions & 0 deletions scripts/build-firmware
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
7 changes: 7 additions & 0 deletions scripts/flash
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Konnected Alarm
* Konnected Security (Connect)
*
* Copyright 2017 konnected.io
*
Expand All @@ -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",
Expand All @@ -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"] }
Expand All @@ -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
Expand Down Expand Up @@ -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",
Expand All @@ -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
}

Expand Down Expand Up @@ -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
Expand All @@ -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()
Expand Down
6 changes: 3 additions & 3 deletions source-code/device.lua
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

0 comments on commit 7e4bc92

Please sign in to comment.