Skip to content

Commit

Permalink
Merge pull request #66 from konnected-io/beta
Browse files Browse the repository at this point in the history
2.2.2
  • Loading branch information
heythisisnate authored Jul 27, 2018
2 parents 7e760c4 + a3ef330 commit 3c412db
Show file tree
Hide file tree
Showing 31 changed files with 360 additions and 98 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
*/

metadata {
definition (name: "Konnected Beep/Blink", namespace: "konnected-io", author: "konnected.io") {
definition (name: "Konnected Beep/Blink", namespace: "konnected-io", author: "konnected.io", mnmn: "SmartThings", vid: "generic-switch") {
capability "Alarm"
capability "Switch"
capability "Actuator"
capability "Momentary"
Expand All @@ -24,25 +25,37 @@ metadata {

preferences {
input name: "invertTrigger", type: "bool", title: "Low Level Trigger",
description: "Select if the attached relay uses a low-level trigger. Default is high-level trigger"
input name: "beepDuration", type: "number", title: "Pulse (ms)",
description: "Each beep or blink duration"
input name: "beepPause", type: "number", title: "Pause (ms)",
description: "Pause between beeps/blinks in milliseconds"
input name: "beepRepeat", type: "number", title: "Repeat",
description: "Times to repeat the pulse"
description: "Select if the attached device or relay uses a low-level trigger. Default is high-level trigger"

// settings for momentary beep
input name: "beepDuration", type: "number", title: "Beep Pulse (ms)",
description: "Each beep or blink duration", range: "10..*"
input name: "beepPause", type: "number", title: "Beep Pause (ms)",
description: "Pause between beeps/blinks in milliseconds", range: "10..*"
input name: "beepRepeat", type: "number", title: "Beep Repeat",
description: "Times to repeat the pulse", range: "1..*"

// settings for infinately repeating alarm
input name: "alarmDuration", type: "number", title: "Alarm Pulse (ms)",
description: "Tone duration in alarm", range: "10..*"
input name: "alarmPause", type: "number", title: "Alarm Pause (ms)",
description: "Pause between tones in alarm", range: "10..*"
}

tiles {
multiAttributeTile(name:"main", type: "generic", width: 6, height: 4, canChangeIcon: true) {
tileAttribute ("device.switch", key: "PRIMARY_CONTROL") {
attributeState "off", label: 'Beep', action: "tone.beep", backgroundColor: "#ffffff", nextState: "pushed"
attributeState "on", label: 'Beep', action: "tone.beep", backgroundColor: "#00a0dc"
attributeState "pushed", label:'pushed', action: "tone.beep", backgroundColor:"#00a0dc", nextState: "off"
}
tiles(scale: 2) {
standardTile("beep", "device.switch", width: 6, height: 4, canChangeIcon: true, decoration: "flat") {
state "off", label: 'Beep', action: "tone.beep", icon: "st.alarm.beep.beep", backgroundColor: "#ffffff", nextState: "pushed"
state "on", label: 'Beep', action: "tone.beep", icon: "st.alarm.beep.beep", backgroundColor: "#00a0dc"
state "pushed", label:'pushed', action: "tone.beep", icon: "st.alarm.beep.beep", backgroundColor:"#00a0dc", nextState: "off"
}
main "main"
details "main"
standardTile("alarm", "device.alarm", width: 2, height: 2, decoration: "flat") {
state "off", label: "Off", action: "alarm.siren", icon: "st.security.alarm.clear", nextState: "turningOn"
state "siren", label: "Alarm", action: "alarm.off", icon: "st.security.alarm.alarm", backgroundColor: "#e86d13", nextState: "turningOff"
state "turningOn", label:'Activating', icon:"st.security.alarm.alarm", action:"alarm.off", backgroundColor:"#e86d13", nextState: "turningOff"
state "turningOff", label:'Turning off', icon:"st.security.alarm.clear", action:"alarm.siren", backgroundColor:"#ffffff", nextState: "turningOn"
}
main "beep"
details "beep", "alarm"
}
}

Expand All @@ -51,12 +64,19 @@ def updated() {
}

def updatePinState(Integer state) {
sendEvent(name: "switch", value: "on", isStateChange: true, display: false)
sendEvent(name: "switch", value: "off", isStateChange: true, display: false)
if (state == -1) { // represents an infinate alarm activated
sendEvent(name: "alarm", value: "siren")
} else if (state == triggerLevel()) {
sendEvent(name: "switch", value: "on", isStateChange: true, display: false)
sendEvent(name: "switch", value: "off", isStateChange: true, display: false)
} else {
sendEvent(name: "alarm", value: "off")
}
}

def off() {
beep()
def val = invertTrigger ? 1 : 0
parent.deviceUpdateDeviceState(device.deviceNetworkId, val)
}

def on() {
Expand All @@ -68,14 +88,21 @@ def push() {
}

def beep() {
def val = invertTrigger ? 0 : 1
parent.deviceUpdateDeviceState(device.deviceNetworkId, val, [
parent.deviceUpdateDeviceState(device.deviceNetworkId, triggerLevel(), [
momentary : beepDuration ?: 250,
pause : beepPause ?: 150,
times : beepRepeat ?: 3
])
}

def siren() {
parent.deviceUpdateDeviceState(device.deviceNetworkId, triggerLevel(), [
momentary : alarmDuration ?: 55,
pause : alarmPause ?: 45,
times : -1
])
}

def triggerLevel() {
return invertTrigger ? 0 : 1
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
*/
metadata {
definition (name: "Konnected CO Sensor", namespace: "konnected-io", author: "konnected.io") {
definition (name: "Konnected CO Sensor", namespace: "konnected-io", author: "konnected.io", mnmn: "SmartThings", vid: "generic-carbon-monoxide") {
capability "Smoke Detector"
capability "Carbon Monoxide Detector"
capability "Sensor"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
*/
metadata {
definition (name: "Konnected Contact Sensor", namespace: "konnected-io", author: "konnected.io") {
definition (name: "Konnected Contact Sensor", namespace: "konnected-io", author: "konnected.io", mnmn: "SmartThings", vid: "generic-contact") {
capability "Contact Sensor"
capability "Sensor"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
*/
metadata {
definition (name: "Konnected Momentary Switch", namespace: "konnected-io", author: "konnected.io") {
definition (name: "Konnected Momentary Switch", namespace: "konnected-io", author: "konnected.io", mnmn: "SmartThings", vid: "generic-switch") {
capability "Switch"
capability "Actuator"
capability "Momentary"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
*/
metadata {
definition (name: "Konnected Motion Sensor", namespace: "konnected-io", author: "konnected.io") {
definition (name: "Konnected Motion Sensor", namespace: "konnected-io", author: "konnected.io", mnmn: "SmartThings", vid:"generic-motion") {
capability "Motion Sensor"
capability "Sensor"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,18 @@
*
*/
metadata {
definition (name: "Konnected Panic Button", namespace: "konnected-io", author: "konnected.io") {
definition (name: "Konnected Panic Button", namespace: "konnected-io", author: "konnected.io", mnmn: "SmartThings", vid: "generic-contact") {
capability "Switch"
capability "Sensor"
}

preferences {
input name: "normalState", type: "enum", title: "Normal State",
options: ["Normally Closed", "Normally Open"],
defaultValue: "Normally Closed",
description: "By default, the alarm state is triggered when the sensor circuit is open (NC). Select Normally Open (NO) when a closed circuit indicates an alarm."
}

tiles {
multiAttributeTile(name:"main", type: "generic", width: 6, height: 4, canChangeIcon: true) {
tileAttribute ("device.switch", key: "PRIMARY_CONTROL") {
Expand All @@ -30,17 +38,18 @@ metadata {
}
}

//Update state sent from parent app
def setStatus(state) {
switch(state) {
case "0" :
sendEvent(name: "switch", value: "off")
break
case "1" :
sendEvent(name: "switch", value: "on")
break
default:
sendEvent(name: "switch", value: "on")
break
}
}

def isClosed() {
normalState == "Normally Open" ? "on" : "off"
}

def isOpen() {
normalState == "Normally Open" ? "off" : "on"
}

// Update state sent from parent app
def setStatus(state) {
def stateValue = state == "1" ? isOpen() : isClosed()
sendEvent(name: "switch", value: stateValue)
log.debug "$device.label is $stateValue"
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
*/
metadata {
definition (name: "Konnected Siren/Strobe", namespace: "konnected-io", author: "konnected.io") {
definition (name: "Konnected Siren/Strobe", namespace: "konnected-io", author: "konnected.io", mnmn: "SmartThings", vid: "generic-siren") {
capability "Alarm"
capability "Switch"
capability "Actuator"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
*/
metadata {
definition (name: "Konnected Smoke Sensor", namespace: "konnected-io", author: "konnected.io") {
definition (name: "Konnected Smoke Sensor", namespace: "konnected-io", author: "konnected.io", mnmn: "SmartThings", vid: "generic-smoke") {
capability "Smoke Detector"
capability "Sensor"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
*/
metadata {
definition (name: "Konnected Switch", namespace: "konnected-io", author: "konnected.io") {
definition (name: "Konnected Switch", namespace: "konnected-io", author: "konnected.io", mnmn: "SmartThings", vid: "generic-switch") {
capability "Switch"
capability "Actuator"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

metadata {
definition (name: "Konnected Temperature & Humidity Sensor (DHT)", namespace: "konnected-io", author: "konnected.io") {
definition (name: "Konnected Temperature & Humidity Sensor (DHT)", namespace: "konnected-io", author: "konnected.io", mnmn: "SmartThings", vid: "generic-humidity") {
capability "Temperature Measurement"
capability "Relative Humidity Measurement"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/**
* Konnected Temperature Probe (DS18B20)
*
* Copyright 2018 Konnected Inc (https://konnected.io)
*
* 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.
*
*/

metadata {
definition (name: "Konnected Temperature Probe (DS18B20)", namespace: "konnected-io", author: "konnected.io", mnmn: "SmartThings", vid: "generic-humidity") {
capability "Temperature Measurement"
}

tiles {
multiAttributeTile(name:"main", type:"thermostat", width:6, height:4) {
tileAttribute("device.temperature", key: "PRIMARY_CONTROL") {
attributeState "temperature", label:'${currentValue}°F', unit: "°F", backgroundColors: [
// Celsius Color Range
[value: 0, color: "#153591"],
[value: 7, color: "#1E9CBB"],
[value: 15, color: "#90D2A7"],
[value: 23, color: "#44B621"],
[value: 29, color: "#F1D801"],
[value: 33, color: "#D04E00"],
[value: 36, color: "#BC2323"],
// Fahrenheit Color Range
[value: 40, color: "#153591"],
[value: 44, color: "#1E9CBB"],
[value: 59, color: "#90D2A7"],
[value: 74, color: "#44B621"],
[value: 84, color: "#F1D801"],
[value: 92, color: "#D04E00"],
[value: 96, color: "#BC2323"]
]
}
}
main "main"
details "main"
}
}

def updated() {
parent.updateSettingsOnDevice()
}

// Update state sent from parent app
def updateStates(states) {
def temperature = new BigDecimal(states.temp)
if (location.getTemperatureScale() == 'F') {
temperature = temperature * 9 / 5 + 32
}
sendEvent(name: "temperature", value: temperature.setScale(1, BigDecimal.ROUND_HALF_UP), unit: location.getTemperatureScale())
log.debug "Temperature: $temperature"
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
*/
metadata {
definition (name: "Konnected Water Sensor", namespace: "konnected-io", author: "konnected.io") {
definition (name: "Konnected Water Sensor", namespace: "konnected-io", author: "konnected.io", mnmn: "SmartThings", vid: "generic-leak") {
capability "Water Sensor"
capability "Sensor"
}
Expand Down
4 changes: 2 additions & 2 deletions firmware/2.2.0/app/include/user_modules.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
//#define LUA_USE_MODULES_CRON
#define LUA_USE_MODULES_CRYPTO
#define LUA_USE_MODULES_DHT
//#define LUA_USE_MODULES_DS18B20
#define LUA_USE_MODULES_DS18B20
//#define LUA_USE_MODULES_ENCODER
#define LUA_USE_MODULES_ENDUSER_SETUP // USE_DNS in dhcpserver.h needs to be enabled for this module to work.
#define LUA_USE_MODULES_FILE
Expand All @@ -50,7 +50,7 @@
//#define LUA_USE_MODULES_MQTT
#define LUA_USE_MODULES_NET
#define LUA_USE_MODULES_NODE
#define LUA_USE_MODULES_OW
//#define LUA_USE_MODULES_OW
//#define LUA_USE_MODULES_PCM
//#define LUA_USE_MODULES_PERF
//#define LUA_USE_MODULES_PWM
Expand Down
Binary file modified firmware/konnected-filesystem-0xa0000-32mb.bin
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion scripts/build-firmware
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

FIRMWARE_PATH=${PWD}/../nodemcu-firmware
IMAGE_NAME=konnected-firmware-2-2-1
IMAGE_NAME=konnected-firmware-2-2-2

cp firmware/2.2.0/app/include/* $FIRMWARE_PATH/app/include/
cp src/* $FIRMWARE_PATH/local/fs
Expand Down
2 changes: 1 addition & 1 deletion scripts/flash
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

FIRMWARE_NAME=konnected-firmware-2-2-1
FIRMWARE_NAME=konnected-firmware-2-2-2
FILESYSTEM_NAME=konnected-filesystem-0xa0000-32mb
PORT=/dev/cu.wchusbserial1410

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* for the specific language governing permissions and limitations under the License.
*
*/
public static String version() { return "2.2.1" }
public static String version() { return "2.2.2" }

definition(
name: "Konnected (Connect)",
Expand Down
Loading

0 comments on commit 3c412db

Please sign in to comment.