mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-13 13:21:53 +00:00
Compare commits
1 Commits
MSA-1189-1
...
MSA-1182-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c09c530f81 |
351
devicetypes/melissa/melissa-climate.src/melissa-climate.groovy
Normal file
351
devicetypes/melissa/melissa-climate.src/melissa-climate.groovy
Normal file
@@ -0,0 +1,351 @@
|
||||
/**
|
||||
* Melissa Climate
|
||||
*
|
||||
* Copyright 2016 Kiril Maslenkov
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
preferences {
|
||||
input "email", "text", title: "Email", description: "Your Email", required: true
|
||||
input "password", "password", title: "Password", description: "Your Melissa Password", required: true
|
||||
input "mac", "text", title: "Melissa MAC Address", description: "Melissa Mac Address", required: true
|
||||
}
|
||||
|
||||
|
||||
metadata {
|
||||
definition (name: "Melissa Climate", namespace: "Melissa", author: "Melissa Climate") {
|
||||
|
||||
capability "Thermostat"
|
||||
|
||||
|
||||
command temperatureUp
|
||||
command temperatureDown
|
||||
|
||||
command sendCommand
|
||||
|
||||
command switchMode
|
||||
command switchFanMode
|
||||
command switchingState
|
||||
|
||||
command refreshApp
|
||||
|
||||
}
|
||||
|
||||
simulator { }
|
||||
|
||||
tiles(scale: 2) {
|
||||
multiAttributeTile(name:"status", type: "thermostat", width: 6, height: 4){
|
||||
tileAttribute("device.temperature", key:"PRIMARY_CONTROL"){
|
||||
attributeState("default", label:'${currentValue}°', unit: "df", backgroundColor: '#4b8df8')
|
||||
}
|
||||
|
||||
tileAttribute("device.humidity", key: "SECONDARY_CONTROL") {
|
||||
attributeState("default", label:'${currentValue}%', unit:"%")
|
||||
}
|
||||
|
||||
tileAttribute("device.temperature", key: "VALUE_CONTROL") {
|
||||
attributeState("VALUE_UP", action: "temperatureUp")
|
||||
attributeState("VALUE_DOWN", action: "temperatureDown")
|
||||
}
|
||||
}
|
||||
|
||||
standardTile("mode", "device.mode", decoration: "flat", width: 3, height: 2) {
|
||||
state "auto", action:"switchMode", label: '${name}', nextState: "cool", icon: "http://server.seemelissa.com/smartthings/icons/modes/auto-2.png"
|
||||
state "cool", action:"switchMode", label: '${name}', nextState: "heat", icon: "http://server.seemelissa.com/smartthings/icons/modes/cool.png"
|
||||
state "heat", action:"switchMode", label: '${name}', nextState: "dry", icon: "http://server.seemelissa.com/smartthings/icons/modes/heat.png"
|
||||
state "dry", action:"switchMode", label: '${name}', nextState: "auto", icon: "http://server.seemelissa.com/smartthings/icons/modes/dry.png"
|
||||
}
|
||||
|
||||
standardTile("fan", "device.fan", decoration: "flat", width: 3, height: 2, canChangeIcon: true, canChangeBackground: true) {
|
||||
state "auto", action:"switchFanMode", label: '${name}', nextState: "high", icon: "http://server.seemelissa.com/smartthings/icons/modes/auto-2.png"
|
||||
state "high", action:"switchFanMode", label: '${name}', nextState: "medium", icon: "http://server.seemelissa.com/smartthings/icons/fan/fan1.png"
|
||||
state "medium", action:"switchFanMode", label: '${name}', nextState: "low", icon: "http://server.seemelissa.com/smartthings/icons/fan/fan2.png"
|
||||
state "low", action:"switchFanMode", label: '${name}', nextState: "auto", icon: "http://server.seemelissa.com/smartthings/icons/fan/fan3.png"
|
||||
}
|
||||
|
||||
standardTile("switchState", "device.switchState", width: 3, height: 2, decoration: "flat", canChangeIcon: true, canChangeBackground: true) {
|
||||
state "on", label: '${name}', action: "switchingState", nextState: "off", icon: "http://server.seemelissa.com/smartthings/icons/on_off/turn-on-off-white.png", backgroundColor: "#79b821"
|
||||
state "off", label: '${name}', action: "switchingState", nextState: "on", icon: "http://server.seemelissa.com/smartthings/icons/on_off/turn-on-off.png", backgroundColor: "#ffffff"
|
||||
|
||||
//state "on", label: '${name}', action: "switchState.off", icon: "st.switches.switch.on", backgroundColor: "#79b821"
|
||||
//state "off", label: '${name}', action: "switchState.on", icon: "st.switches.switch.off", backgroundColor: "#ffffff"
|
||||
}
|
||||
|
||||
standardTile("send", "device.send", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
|
||||
state "default", action:"sendCommand", label: 'Send Command'
|
||||
}
|
||||
|
||||
standardTile("refresh", "device.send2", inactiveLabel: false, decoration: "flat", width: 3, height: 2) {
|
||||
state "default", action:"refreshApp", icon: "st.secondary.refresh"
|
||||
}
|
||||
|
||||
standardTile("username", "device.username", inactiveLabel: false, decoration: "flat", width: 6, height: 2) {
|
||||
state "default", label:'${currentValue}'
|
||||
}
|
||||
|
||||
main(["status", "mode", "fan", "send"])
|
||||
//details(["status", "mode", "fan", "refresh", "switchState", "username"])
|
||||
|
||||
details(["status", "mode", "fan", "refresh", "switchState"])
|
||||
}
|
||||
}
|
||||
|
||||
def switchingState() {
|
||||
if (state.ac_state == "on") {
|
||||
state.ac_state = "off"
|
||||
} else {
|
||||
state.ac_state = "on"
|
||||
}
|
||||
sendEvent(name: "switchState", value: state.ac_state);
|
||||
sendCommand()
|
||||
}
|
||||
|
||||
/* SWITCHING MODES Auto, Cool, Heat, Dry*/
|
||||
|
||||
def switchMode() {
|
||||
switch (state.mode) {
|
||||
case "auto":
|
||||
state.mode = "cool";
|
||||
break;
|
||||
case "cool":
|
||||
state.mode = "heat";
|
||||
break;
|
||||
case "heat":
|
||||
state.mode = "dry";
|
||||
break;
|
||||
case "dry":
|
||||
state.mode = "auto";
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
//sendEvent(name: "username", value: state.mode)
|
||||
sendCommand()
|
||||
// log.debug state.mode
|
||||
}
|
||||
|
||||
/* SWITCHING FAN MODES*/
|
||||
|
||||
def switchFanMode() {
|
||||
switch (state.fan) {
|
||||
case "auto":
|
||||
state.fan = "high";
|
||||
break;
|
||||
case "high":
|
||||
state.fan = "medium";
|
||||
break;
|
||||
case "medium":
|
||||
state.fan = "low";
|
||||
break;
|
||||
|
||||
case "low":
|
||||
state.fan = "auto";
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
sendEvent(name: "username", value: state.fan)
|
||||
sendCommand()
|
||||
//log.debug state.fan
|
||||
}
|
||||
|
||||
def refreshApp() {
|
||||
def params = [
|
||||
uri: 'http://api2.seemelissa.com/user/login',
|
||||
body: [
|
||||
|
||||
email: "k.maslenkov@sabev.at",
|
||||
password: "xxxxx"
|
||||
|
||||
//email: settings.email,
|
||||
//password: settings.password
|
||||
]
|
||||
]
|
||||
try {
|
||||
httpPost(params) {resp ->
|
||||
/*
|
||||
log.debug "resp data: ${resp.data}"
|
||||
log.debug resp.data
|
||||
log.debug resp
|
||||
*/
|
||||
def _try = resp.data
|
||||
def slurper = new groovy.json.JsonSlurper()
|
||||
def results = slurper.parseText("${resp.data}")
|
||||
|
||||
|
||||
state.token = results.Data
|
||||
|
||||
settings.mac = "OIEQ321TGR6"
|
||||
def getParams = [
|
||||
uri: "http://api2.seemelissa.com",
|
||||
path: "/testusers/getMelissaData/${settings.mac}"
|
||||
|
||||
//path: "/testusers/getMelissaData/OIEQ321TGR6"
|
||||
|
||||
]
|
||||
try {
|
||||
httpGet(getParams) {response->
|
||||
|
||||
def getResult = slurper.parseText("${response.data}")
|
||||
|
||||
state.temp = getResult.temp as int
|
||||
state.humidity = getResult.humidity
|
||||
state.codeset = getResult.codeset_id as int
|
||||
switch (getResult.mode) {
|
||||
case "0":
|
||||
state.mode = "auto";
|
||||
break;
|
||||
case "1":
|
||||
state.mode = "fan";
|
||||
break;
|
||||
case "2":
|
||||
state.mode = "heat";
|
||||
break;
|
||||
case "3":
|
||||
state.mode = "cool";
|
||||
break;
|
||||
case "4":
|
||||
state.mode = "dry";
|
||||
break;
|
||||
}
|
||||
switch (getResult.fan) {
|
||||
case "0":
|
||||
state.fan = "auto";
|
||||
break;
|
||||
case "1":
|
||||
state.fan = "low";
|
||||
break;
|
||||
case "2":
|
||||
state.fan = "medium";
|
||||
break;
|
||||
case "3":
|
||||
state.fan = "high";
|
||||
break;
|
||||
}
|
||||
if (getResult.state == "0") {
|
||||
state.ac_state = "off"
|
||||
} else {
|
||||
state.ac_state = "on"
|
||||
}
|
||||
sendEvent(name: "mode", value: state.mode)
|
||||
sendEvent(name: "fan", value: state.fan)
|
||||
sendEvent(name: "temperature", value: state.temp)
|
||||
sendEvent(name: "humidity", value: state.humidity)
|
||||
sendEvent(name: "switchState", value: state.ac_state)
|
||||
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
log.error "error: $e"
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
log.error "error: $e"
|
||||
}
|
||||
}
|
||||
|
||||
def sendCommand () {
|
||||
log.error state
|
||||
|
||||
def params = [
|
||||
uri: 'http://api2.seemelissa.com/testusers/sendCommand',
|
||||
body: [
|
||||
mac: "OIEQ321TGR6",
|
||||
//mac: settings.mac,
|
||||
temp: state.temp,
|
||||
token: state.token,
|
||||
fan: state.fan,
|
||||
mode: state.mode,
|
||||
ac_state: state.ac_state,
|
||||
codeset: state.codeset
|
||||
]
|
||||
]
|
||||
try {
|
||||
httpPost(params) {resp ->
|
||||
|
||||
log.debug "Send command done"
|
||||
log.debug "resp data: ${resp.data}"
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
log.error "error: $e"
|
||||
}
|
||||
}
|
||||
|
||||
def updated() {
|
||||
//log.debug "Updated !!!"
|
||||
login()
|
||||
}
|
||||
|
||||
def temperatureDown() {
|
||||
if (state.temp != 18) {
|
||||
state.temp = state.temp - 1
|
||||
}
|
||||
sendEvent(name: "temperature", value: state.temp)
|
||||
sendCommand()
|
||||
}
|
||||
|
||||
def temperatureUp() {
|
||||
if (state.temp != 30) {
|
||||
state.temp = state.temp + 1
|
||||
}
|
||||
|
||||
sendEvent(name: "temperature", value: state.temp)
|
||||
sendCommand()
|
||||
}
|
||||
|
||||
|
||||
def login() {
|
||||
refreshApp()
|
||||
/*
|
||||
def params = [
|
||||
uri: 'http://api2.seemelissa.com/user/login',
|
||||
body: [
|
||||
email: settings.email,
|
||||
password: settings.password
|
||||
]
|
||||
]
|
||||
|
||||
try {
|
||||
httpPost(params) {resp ->
|
||||
log.debug "resp data: ${resp.data}"
|
||||
log.debug "Response Received: Status [$resp.status]"
|
||||
|
||||
def _try = resp.data
|
||||
def slurper = new groovy.json.JsonSlurper()
|
||||
def results = slurper.parseText("${resp.data}")
|
||||
|
||||
|
||||
state.token = results.Data
|
||||
state.temp = 18
|
||||
state.humidity = 40
|
||||
|
||||
sendEvent(name: "temperature", value: state.temp)
|
||||
sendEvent(name: "humidity", value: state.humidity)
|
||||
|
||||
sendEvent(name: "username", value: state.token)
|
||||
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
log.error "error: $e"
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
// parse events into attributes
|
||||
def parse(String description) {
|
||||
log.debug "Parsing '${description}'"
|
||||
|
||||
}
|
||||
@@ -1,118 +1,118 @@
|
||||
/**
|
||||
* Copyright 2015 SmartThings
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Aeon Home Energy Meter
|
||||
*
|
||||
* Author: SmartThings
|
||||
*
|
||||
* Date: 2013-05-30
|
||||
*/
|
||||
metadata {
|
||||
definition (name: "Aeon Home Energy Meter", namespace: "smartthings", author: "SmartThings") {
|
||||
capability "Energy Meter"
|
||||
capability "Power Meter"
|
||||
capability "Configuration"
|
||||
capability "Sensor"
|
||||
|
||||
command "reset"
|
||||
|
||||
fingerprint deviceId: "0x2101", inClusters: " 0x70,0x31,0x72,0x86,0x32,0x80,0x85,0x60"
|
||||
}
|
||||
|
||||
// simulator metadata
|
||||
simulator {
|
||||
for (int i = 0; i <= 10000; i += 1000) {
|
||||
status "power ${i} W": new physicalgraph.zwave.Zwave().meterV1.meterReport(
|
||||
scaledMeterValue: i, precision: 3, meterType: 4, scale: 2, size: 4).incomingMessage()
|
||||
}
|
||||
for (int i = 0; i <= 100; i += 10) {
|
||||
status "energy ${i} kWh": new physicalgraph.zwave.Zwave().meterV1.meterReport(
|
||||
scaledMeterValue: i, precision: 3, meterType: 0, scale: 0, size: 4).incomingMessage()
|
||||
}
|
||||
}
|
||||
|
||||
// tile definitions
|
||||
tiles {
|
||||
valueTile("power", "device.power", decoration: "flat") {
|
||||
state "default", label:'${currentValue} W'
|
||||
}
|
||||
valueTile("energy", "device.energy", decoration: "flat") {
|
||||
state "default", label:'${currentValue} kWh'
|
||||
}
|
||||
standardTile("reset", "device.energy", inactiveLabel: false, decoration: "flat") {
|
||||
state "default", label:'reset kWh', action:"reset"
|
||||
}
|
||||
standardTile("refresh", "device.power", inactiveLabel: false, decoration: "flat") {
|
||||
state "default", label:'', action:"refresh.refresh", icon:"st.secondary.refresh"
|
||||
}
|
||||
standardTile("configure", "device.power", inactiveLabel: false, decoration: "flat") {
|
||||
state "configure", label:'', action:"configuration.configure", icon:"st.secondary.configure"
|
||||
}
|
||||
|
||||
main (["power","energy"])
|
||||
details(["power","energy", "reset","refresh", "configure"])
|
||||
}
|
||||
}
|
||||
|
||||
def parse(String description) {
|
||||
def result = null
|
||||
def cmd = zwave.parse(description, [0x31: 1, 0x32: 1, 0x60: 3])
|
||||
if (cmd) {
|
||||
result = createEvent(zwaveEvent(cmd))
|
||||
}
|
||||
log.debug "Parse returned ${result?.descriptionText}"
|
||||
return result
|
||||
}
|
||||
|
||||
def zwaveEvent(physicalgraph.zwave.commands.meterv1.MeterReport cmd) {
|
||||
if (cmd.scale == 0) {
|
||||
[name: "energy", value: cmd.scaledMeterValue, unit: "kWh"]
|
||||
} else if (cmd.scale == 1) {
|
||||
[name: "energy", value: cmd.scaledMeterValue, unit: "kVAh"]
|
||||
}
|
||||
else {
|
||||
[name: "power", value: Math.round(cmd.scaledMeterValue), unit: "W"]
|
||||
}
|
||||
}
|
||||
|
||||
def zwaveEvent(physicalgraph.zwave.Command cmd) {
|
||||
// Handles all Z-Wave commands we aren't interested in
|
||||
[:]
|
||||
}
|
||||
|
||||
def refresh() {
|
||||
delayBetween([
|
||||
zwave.meterV2.meterGet(scale: 0).format(),
|
||||
zwave.meterV2.meterGet(scale: 2).format()
|
||||
])
|
||||
}
|
||||
|
||||
def reset() {
|
||||
// No V1 available
|
||||
return [
|
||||
zwave.meterV2.meterReset().format(),
|
||||
zwave.meterV2.meterGet(scale: 0).format()
|
||||
]
|
||||
}
|
||||
|
||||
def configure() {
|
||||
def cmd = delayBetween([
|
||||
zwave.configurationV1.configurationSet(parameterNumber: 101, size: 4, scaledConfigurationValue: 4).format(), // combined power in watts
|
||||
zwave.configurationV1.configurationSet(parameterNumber: 111, size: 4, scaledConfigurationValue: 300).format(), // every 5 min
|
||||
zwave.configurationV1.configurationSet(parameterNumber: 102, size: 4, scaledConfigurationValue: 8).format(), // combined energy in kWh
|
||||
zwave.configurationV1.configurationSet(parameterNumber: 112, size: 4, scaledConfigurationValue: 300).format(), // every 5 min
|
||||
zwave.configurationV1.configurationSet(parameterNumber: 103, size: 4, scaledConfigurationValue: 0).format(), // no third report
|
||||
zwave.configurationV1.configurationSet(parameterNumber: 113, size: 4, scaledConfigurationValue: 300).format() // every 5 min
|
||||
])
|
||||
log.debug cmd
|
||||
cmd
|
||||
}
|
||||
/**
|
||||
* Copyright 2015 SmartThings
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Aeon Home Energy Meter
|
||||
*
|
||||
* Author: SmartThings
|
||||
*
|
||||
* Date: 2013-05-30
|
||||
*/
|
||||
metadata {
|
||||
definition (name: "Aeon Home Energy Meter", namespace: "smartthings", author: "SmartThings") {
|
||||
capability "Energy Meter"
|
||||
capability "Power Meter"
|
||||
capability "Configuration"
|
||||
capability "Sensor"
|
||||
|
||||
command "reset"
|
||||
|
||||
fingerprint deviceId: "0x2101", inClusters: " 0x70,0x31,0x72,0x86,0x32,0x80,0x85,0x60"
|
||||
}
|
||||
|
||||
// simulator metadata
|
||||
simulator {
|
||||
for (int i = 0; i <= 10000; i += 1000) {
|
||||
status "power ${i} W": new physicalgraph.zwave.Zwave().meterV1.meterReport(
|
||||
scaledMeterValue: i, precision: 3, meterType: 4, scale: 2, size: 4).incomingMessage()
|
||||
}
|
||||
for (int i = 0; i <= 100; i += 10) {
|
||||
status "energy ${i} kWh": new physicalgraph.zwave.Zwave().meterV1.meterReport(
|
||||
scaledMeterValue: i, precision: 3, meterType: 0, scale: 0, size: 4).incomingMessage()
|
||||
}
|
||||
}
|
||||
|
||||
// tile definitions
|
||||
tiles {
|
||||
valueTile("power", "device.power", decoration: "flat") {
|
||||
state "default", label:'${currentValue} W'
|
||||
}
|
||||
valueTile("energy", "device.energy", decoration: "flat") {
|
||||
state "default", label:'${currentValue} kWh'
|
||||
}
|
||||
standardTile("reset", "device.energy", inactiveLabel: false, decoration: "flat") {
|
||||
state "default", label:'reset kWh', action:"reset"
|
||||
}
|
||||
standardTile("refresh", "device.power", inactiveLabel: false, decoration: "flat") {
|
||||
state "default", label:'', action:"refresh.refresh", icon:"st.secondary.refresh"
|
||||
}
|
||||
standardTile("configure", "device.power", inactiveLabel: false, decoration: "flat") {
|
||||
state "configure", label:'', action:"configuration.configure", icon:"st.secondary.configure"
|
||||
}
|
||||
|
||||
main (["power","energy"])
|
||||
details(["power","energy", "reset","refresh", "configure"])
|
||||
}
|
||||
}
|
||||
|
||||
def parse(String description) {
|
||||
def result = null
|
||||
def cmd = zwave.parse(description, [0x31: 1, 0x32: 1, 0x60: 3])
|
||||
if (cmd) {
|
||||
result = createEvent(zwaveEvent(cmd))
|
||||
}
|
||||
log.debug "Parse returned ${result?.descriptionText}"
|
||||
return result
|
||||
}
|
||||
|
||||
def zwaveEvent(physicalgraph.zwave.commands.meterv1.MeterReport cmd) {
|
||||
if (cmd.scale == 0) {
|
||||
[name: "energy", value: cmd.scaledMeterValue, unit: "kWh"]
|
||||
} else if (cmd.scale == 1) {
|
||||
[name: "energy", value: cmd.scaledMeterValue, unit: "kVAh"]
|
||||
}
|
||||
else {
|
||||
[name: "power", value: Math.round(cmd.scaledMeterValue), unit: "W"]
|
||||
}
|
||||
}
|
||||
|
||||
def zwaveEvent(physicalgraph.zwave.Command cmd) {
|
||||
// Handles all Z-Wave commands we aren't interested in
|
||||
[:]
|
||||
}
|
||||
|
||||
def refresh() {
|
||||
delayBetween([
|
||||
zwave.meterV2.meterGet(scale: 0).format(),
|
||||
zwave.meterV2.meterGet(scale: 2).format()
|
||||
])
|
||||
}
|
||||
|
||||
def reset() {
|
||||
// No V1 available
|
||||
return [
|
||||
zwave.meterV2.meterReset().format(),
|
||||
zwave.meterV2.meterGet(scale: 0).format()
|
||||
]
|
||||
}
|
||||
|
||||
def configure() {
|
||||
def cmd = delayBetween([
|
||||
zwave.configurationV1.configurationSet(parameterNumber: 101, size: 4, scaledConfigurationValue: 4).format(), // combined power in watts
|
||||
zwave.configurationV1.configurationSet(parameterNumber: 111, size: 4, scaledConfigurationValue: 300).format(), // every 5 min
|
||||
zwave.configurationV1.configurationSet(parameterNumber: 102, size: 4, scaledConfigurationValue: 8).format(), // combined energy in kWh
|
||||
zwave.configurationV1.configurationSet(parameterNumber: 112, size: 4, scaledConfigurationValue: 300).format(), // every 5 min
|
||||
zwave.configurationV1.configurationSet(parameterNumber: 103, size: 4, scaledConfigurationValue: 0).format(), // no third report
|
||||
zwave.configurationV1.configurationSet(parameterNumber: 113, size: 4, scaledConfigurationValue: 300).format() // every 5 min
|
||||
])
|
||||
log.debug cmd
|
||||
cmd
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ metadata {
|
||||
state "power", label: '${currentValue} W'
|
||||
}
|
||||
|
||||
htmlTile(name: "powerContent", attribute: "powerContent", type: "HTML", whitelist: ["www.wattvision.com"] , url: '${currentValue}', width: 3, height: 2)
|
||||
htmlTile(name: "powerContent", attribute: "powerContent", type: "HTML", whitelist: "www.wattvision.com" , url: '${currentValue}', width: 3, height: 2)
|
||||
|
||||
standardTile("refresh", "device.power", inactiveLabel: false, decoration: "flat") {
|
||||
state "default", label: '', action: "refresh.refresh", icon: "st.secondary.refresh"
|
||||
|
||||
@@ -60,7 +60,7 @@ def bridgeDiscovery(params=[:])
|
||||
app.updateSetting("selectedHue", "")
|
||||
}
|
||||
|
||||
ssdpSubscribe()
|
||||
subscribe(location, null, locationHandler, [filterEvents:false])
|
||||
|
||||
//bridge discovery request every 15 //25 seconds
|
||||
if((bridgeRefreshCount % 5) == 0) {
|
||||
@@ -152,10 +152,6 @@ private discoverBridges() {
|
||||
sendHubCommand(new physicalgraph.device.HubAction("lan discovery urn:schemas-upnp-org:device:basic:1", physicalgraph.device.Protocol.LAN))
|
||||
}
|
||||
|
||||
void ssdpSubscribe() {
|
||||
subscribe(location, "ssdpTerm.urn:schemas-upnp-org:device:basic:1", ssdpBridgeHandler)
|
||||
}
|
||||
|
||||
private sendDeveloperReq() {
|
||||
def token = app.id
|
||||
def host = getBridgeIP()
|
||||
@@ -165,7 +161,7 @@ private sendDeveloperReq() {
|
||||
headers: [
|
||||
HOST: host
|
||||
],
|
||||
body: [devicetype: "$token-0"]], "${selectedHue}", [callback: "usernameHandler"]))
|
||||
body: [devicetype: "$token-0"]], "${selectedHue}"))
|
||||
}
|
||||
|
||||
private discoverHueBulbs() {
|
||||
@@ -175,7 +171,7 @@ private discoverHueBulbs() {
|
||||
path: "/api/${state.username}/lights",
|
||||
headers: [
|
||||
HOST: host
|
||||
]], "${selectedHue}", [callback: "lightsHandler"]))
|
||||
]], "${selectedHue}"))
|
||||
}
|
||||
|
||||
private verifyHueBridge(String deviceNetworkId, String host) {
|
||||
@@ -185,7 +181,7 @@ private verifyHueBridge(String deviceNetworkId, String host) {
|
||||
path: "/description.xml",
|
||||
headers: [
|
||||
HOST: host
|
||||
]], deviceNetworkId, [callback: "bridgeDescriptionHandler"]))
|
||||
]], deviceNetworkId))
|
||||
}
|
||||
|
||||
private verifyHueBridges() {
|
||||
@@ -297,9 +293,8 @@ def bulbListHandler(hub, data = "") {
|
||||
}
|
||||
}
|
||||
def bridge = null
|
||||
if (selectedHue) {
|
||||
bridge = getChildDevice(selectedHue)
|
||||
}
|
||||
if (selectedHue)
|
||||
bridge = getChildDevice(selectedHue)
|
||||
bridge.sendEvent(name: "bulbList", value: hub, data: bulbs, isStateChange: true, displayed: false)
|
||||
msg = "${bulbs.size()} bulbs found. ${bulbs}"
|
||||
return msg
|
||||
@@ -387,9 +382,8 @@ def addBridge() {
|
||||
def oldDNI = it.deviceNetworkId
|
||||
log.debug "updating dni for device ${it} with $newDNI - previous DNI = ${it.deviceNetworkId}"
|
||||
it.setDeviceNetworkId("${newDNI}")
|
||||
if (oldDNI == selectedHue) {
|
||||
app.updateSetting("selectedHue", newDNI)
|
||||
}
|
||||
if (oldDNI == selectedHue)
|
||||
app.updateSetting("selectedHue", newDNI)
|
||||
newbridge = false
|
||||
}
|
||||
}
|
||||
@@ -418,111 +412,6 @@ def addBridge() {
|
||||
}
|
||||
}
|
||||
|
||||
def ssdpBridgeHandler(evt) {
|
||||
def description = evt.description
|
||||
log.trace "Location: $description"
|
||||
|
||||
def hub = evt?.hubId
|
||||
def parsedEvent = parseLanMessage(description)
|
||||
parsedEvent << ["hub":hub]
|
||||
|
||||
def bridges = getHueBridges()
|
||||
log.trace bridges.toString()
|
||||
if (!(bridges."${parsedEvent.ssdpUSN.toString()}")) {
|
||||
//bridge does not exist
|
||||
log.trace "Adding bridge ${parsedEvent.ssdpUSN}"
|
||||
bridges << ["${parsedEvent.ssdpUSN.toString()}":parsedEvent]
|
||||
} else {
|
||||
// update the values
|
||||
def ip = convertHexToIP(parsedEvent.networkAddress)
|
||||
def port = convertHexToInt(parsedEvent.deviceAddress)
|
||||
def host = ip + ":" + port
|
||||
log.debug "Device ($parsedEvent.mac) was already found in state with ip = $host."
|
||||
def dstate = bridges."${parsedEvent.ssdpUSN.toString()}"
|
||||
def dni = "${parsedEvent.mac}"
|
||||
def d = getChildDevice(dni)
|
||||
def networkAddress = null
|
||||
if (!d) {
|
||||
childDevices.each {
|
||||
if (it.getDeviceDataByName("mac")) {
|
||||
def newDNI = "${it.getDeviceDataByName("mac")}"
|
||||
if (newDNI != it.deviceNetworkId) {
|
||||
def oldDNI = it.deviceNetworkId
|
||||
log.debug "updating dni for device ${it} with $newDNI - previous DNI = ${it.deviceNetworkId}"
|
||||
it.setDeviceNetworkId("${newDNI}")
|
||||
if (oldDNI == selectedHue) {
|
||||
app.updateSetting("selectedHue", newDNI)
|
||||
}
|
||||
doDeviceSync()
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (d.getDeviceDataByName("networkAddress")) {
|
||||
networkAddress = d.getDeviceDataByName("networkAddress")
|
||||
} else {
|
||||
networkAddress = d.latestState('networkAddress').stringValue
|
||||
}
|
||||
log.trace "Host: $host - $networkAddress"
|
||||
if (host != networkAddress) {
|
||||
log.debug "Device's port or ip changed for device $d..."
|
||||
dstate.ip = ip
|
||||
dstate.port = port
|
||||
dstate.name = "Philips hue ($ip)"
|
||||
d.sendEvent(name:"networkAddress", value: host)
|
||||
d.updateDataValue("networkAddress", host)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void bridgeDescriptionHandler(physicalgraph.device.HubResponse hubResponse) {
|
||||
log.trace "description.xml response (application/xml)"
|
||||
def body = hubResponse.xml
|
||||
if (body?.device?.modelName?.text().startsWith("Philips hue bridge")) {
|
||||
def bridges = getHueBridges()
|
||||
def bridge = bridges.find {it?.key?.contains(body?.device?.UDN?.text())}
|
||||
if (bridge) {
|
||||
bridge.value << [name:body?.device?.friendlyName?.text(), serialNumber:body?.device?.serialNumber?.text(), verified: true]
|
||||
} else {
|
||||
log.error "/description.xml returned a bridge that didn't exist"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void lightsHandler(physicalgraph.device.HubResponse hubResponse) {
|
||||
if (isValidSource(hubResponse.mac)) {
|
||||
def body = hubResponse.json
|
||||
if (!body?.state?.on) { //check if first time poll made it here by mistake
|
||||
def bulbs = getHueBulbs()
|
||||
log.debug "Adding bulbs to state!"
|
||||
body.each { k, v ->
|
||||
bulbs[k] = [id: k, name: v.name, type: v.type, modelid: v.modelid, hub: hubResponse.hubId]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void usernameHandler(physicalgraph.device.HubResponse hubResponse) {
|
||||
if (isValidSource(hubResponse.mac)) {
|
||||
def body = hubResponse.json
|
||||
if (body.success != null) {
|
||||
if (body.success[0] != null) {
|
||||
if (body.success[0].username)
|
||||
state.username = body.success[0].username
|
||||
}
|
||||
} else if (body.error != null) {
|
||||
//TODO: handle retries...
|
||||
log.error "ERROR: application/json ${body.error}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated This has been replaced by the combination of {@link #ssdpBridgeHandler()}, {@link #bridgeDescriptionHandler()},
|
||||
* {@link #lightsHandler()}, and {@link #usernameHandler()}. After a pending event subscription migration, it can be removed.
|
||||
*/
|
||||
@Deprecated
|
||||
def locationHandler(evt) {
|
||||
def description = evt.description
|
||||
log.trace "Location: $description"
|
||||
@@ -558,19 +447,17 @@ def locationHandler(evt) {
|
||||
def oldDNI = it.deviceNetworkId
|
||||
log.debug "updating dni for device ${it} with $newDNI - previous DNI = ${it.deviceNetworkId}"
|
||||
it.setDeviceNetworkId("${newDNI}")
|
||||
if (oldDNI == selectedHue) {
|
||||
app.updateSetting("selectedHue", newDNI)
|
||||
}
|
||||
if (oldDNI == selectedHue)
|
||||
app.updateSetting("selectedHue", newDNI)
|
||||
doDeviceSync()
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (d.getDeviceDataByName("networkAddress")) {
|
||||
networkAddress = d.getDeviceDataByName("networkAddress")
|
||||
} else {
|
||||
networkAddress = d.latestState('networkAddress').stringValue
|
||||
}
|
||||
if (d.getDeviceDataByName("networkAddress"))
|
||||
networkAddress = d.getDeviceDataByName("networkAddress")
|
||||
else
|
||||
networkAddress = d.latestState('networkAddress').stringValue
|
||||
log.trace "Host: $host - $networkAddress"
|
||||
if(host != networkAddress) {
|
||||
log.debug "Device's port or ip changed for device $d..."
|
||||
@@ -603,9 +490,8 @@ def locationHandler(evt) {
|
||||
def body = new groovy.json.JsonSlurper().parseText(parsedEvent.body)
|
||||
if (body.success != null) {
|
||||
if (body.success[0] != null) {
|
||||
if (body.success[0].username) {
|
||||
if (body.success[0].username)
|
||||
state.username = body.success[0].username
|
||||
}
|
||||
}
|
||||
} else if (body.error != null) {
|
||||
//TODO: handle retries...
|
||||
@@ -630,7 +516,11 @@ def doDeviceSync(){
|
||||
log.trace "Doing Hue Device Sync!"
|
||||
convertBulbListToMap()
|
||||
poll()
|
||||
ssdpSubscribe()
|
||||
try {
|
||||
subscribe(location, null, locationHandler, [filterEvents:false])
|
||||
} catch (all) {
|
||||
log.trace "Subscription already exist"
|
||||
}
|
||||
discoverBridges()
|
||||
}
|
||||
|
||||
@@ -857,11 +747,15 @@ private getId(childDevice) {
|
||||
private poll() {
|
||||
def host = getBridgeIP()
|
||||
def uri = "/api/${state.username}/lights/"
|
||||
log.debug "GET: $host$uri"
|
||||
sendHubCommand(new physicalgraph.device.HubAction("""GET ${uri} HTTP/1.1
|
||||
try {
|
||||
sendHubCommand(new physicalgraph.device.HubAction("""GET ${uri} HTTP/1.1
|
||||
HOST: ${host}
|
||||
|
||||
""", physicalgraph.device.Protocol.LAN, selectedHue))
|
||||
} catch (all) {
|
||||
log.warn "Parsing Body failed - trying again..."
|
||||
doDeviceSync()
|
||||
}
|
||||
}
|
||||
|
||||
private put(path, body) {
|
||||
|
||||
@@ -1,149 +1,150 @@
|
||||
/**
|
||||
* Copyright 2015 SmartThings
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Flasher
|
||||
*
|
||||
* Author: bob
|
||||
* Date: 2013-02-06
|
||||
*/
|
||||
definition(
|
||||
name: "The Flasher",
|
||||
namespace: "smartthings",
|
||||
author: "SmartThings",
|
||||
description: "Flashes a set of lights in response to motion, an open/close event, or a switch.",
|
||||
category: "Convenience",
|
||||
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Meta/light_motion-outlet-contact.png",
|
||||
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Meta/light_motion-outlet-contact@2x.png"
|
||||
)
|
||||
|
||||
preferences {
|
||||
section("When any of the following devices trigger..."){
|
||||
input "motion", "capability.motionSensor", title: "Motion Sensor?", required: false
|
||||
input "contact", "capability.contactSensor", title: "Contact Sensor?", required: false
|
||||
input "acceleration", "capability.accelerationSensor", title: "Acceleration Sensor?", required: false
|
||||
input "mySwitch", "capability.switch", title: "Switch?", required: false
|
||||
input "myPresence", "capability.presenceSensor", title: "Presence Sensor?", required: false
|
||||
}
|
||||
section("Then flash..."){
|
||||
input "switches", "capability.switch", title: "These lights", multiple: true
|
||||
input "numFlashes", "number", title: "This number of times (default 3)", required: false
|
||||
}
|
||||
section("Time settings in milliseconds (optional)..."){
|
||||
input "onFor", "number", title: "On for (default 1000)", required: false
|
||||
input "offFor", "number", title: "Off for (default 1000)", required: false
|
||||
}
|
||||
}
|
||||
|
||||
def installed() {
|
||||
log.debug "Installed with settings: ${settings}"
|
||||
|
||||
subscribe()
|
||||
}
|
||||
|
||||
def updated() {
|
||||
log.debug "Updated with settings: ${settings}"
|
||||
|
||||
unsubscribe()
|
||||
subscribe()
|
||||
}
|
||||
|
||||
def subscribe() {
|
||||
if (contact) {
|
||||
subscribe(contact, "contact.open", contactOpenHandler)
|
||||
}
|
||||
if (acceleration) {
|
||||
subscribe(acceleration, "acceleration.active", accelerationActiveHandler)
|
||||
}
|
||||
if (motion) {
|
||||
subscribe(motion, "motion.active", motionActiveHandler)
|
||||
}
|
||||
if (mySwitch) {
|
||||
subscribe(mySwitch, "switch.on", switchOnHandler)
|
||||
}
|
||||
if (myPresence) {
|
||||
subscribe(myPresence, "presence", presenceHandler)
|
||||
}
|
||||
}
|
||||
|
||||
def motionActiveHandler(evt) {
|
||||
log.debug "motion $evt.value"
|
||||
flashLights()
|
||||
}
|
||||
|
||||
def contactOpenHandler(evt) {
|
||||
log.debug "contact $evt.value"
|
||||
flashLights()
|
||||
}
|
||||
|
||||
def accelerationActiveHandler(evt) {
|
||||
log.debug "acceleration $evt.value"
|
||||
flashLights()
|
||||
}
|
||||
|
||||
def switchOnHandler(evt) {
|
||||
log.debug "switch $evt.value"
|
||||
flashLights()
|
||||
}
|
||||
|
||||
def presenceHandler(evt) {
|
||||
log.debug "presence $evt.value"
|
||||
if (evt.value == "present") {
|
||||
flashLights()
|
||||
} else if (evt.value == "not present") {
|
||||
flashLights()
|
||||
}
|
||||
}
|
||||
|
||||
private flashLights() {
|
||||
def doFlash = true
|
||||
def onFor = onFor ?: 1000
|
||||
def offFor = offFor ?: 1000
|
||||
def numFlashes = numFlashes ?: 3
|
||||
|
||||
log.debug "LAST ACTIVATED IS: ${state.lastActivated}"
|
||||
if (state.lastActivated) {
|
||||
def elapsed = now() - state.lastActivated
|
||||
def sequenceTime = (numFlashes + 1) * (onFor + offFor)
|
||||
doFlash = elapsed > sequenceTime
|
||||
log.debug "DO FLASH: $doFlash, ELAPSED: $elapsed, LAST ACTIVATED: ${state.lastActivated}"
|
||||
}
|
||||
|
||||
if (doFlash) {
|
||||
log.debug "FLASHING $numFlashes times"
|
||||
state.lastActivated = now()
|
||||
log.debug "LAST ACTIVATED SET TO: ${state.lastActivated}"
|
||||
def initialActionOn = switches.collect{it.currentSwitch != "on"}
|
||||
def delay = 0L
|
||||
numFlashes.times {
|
||||
log.trace "Switch on after $delay msec"
|
||||
switches.eachWithIndex {s, i ->
|
||||
if (initialActionOn[i]) {
|
||||
s.on(delay: delay)
|
||||
}
|
||||
else {
|
||||
s.off(delay:delay)
|
||||
}
|
||||
}
|
||||
delay += onFor
|
||||
log.trace "Switch off after $delay msec"
|
||||
switches.eachWithIndex {s, i ->
|
||||
if (initialActionOn[i]) {
|
||||
s.off(delay: delay)
|
||||
}
|
||||
else {
|
||||
s.on(delay:delay)
|
||||
}
|
||||
}
|
||||
delay += offFor
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Copyright 2015 SmartThings
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Flasher
|
||||
*
|
||||
* Author: bob
|
||||
* Date: 2013-02-06
|
||||
*/
|
||||
definition(
|
||||
name: "The Flasher",
|
||||
namespace: "smartthings",
|
||||
author: "SmartThings",
|
||||
description: "Flashes a set of lights in response to motion, an open/close event, or a switch.",
|
||||
category: "Convenience",
|
||||
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Meta/light_motion-outlet-contact.png",
|
||||
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Meta/light_motion-outlet-contact@2x.png"
|
||||
)
|
||||
|
||||
preferences {
|
||||
section("When any of the following devices trigger..."){
|
||||
input "motion", "capability.motionSensor", title: "Motion Sensor?", required: false
|
||||
input "contact", "capability.contactSensor", title: "Contact Sensor?", required: false
|
||||
input "acceleration", "capability.accelerationSensor", title: "Acceleration Sensor?", required: false
|
||||
input "mySwitch", "capability.switch", title: "Switch?", required: false
|
||||
input "myPresence", "capability.presenceSensor", title: "Presence Sensor?", required: false
|
||||
}
|
||||
section("Then flash..."){
|
||||
input "switches", "capability.switch", title: "These lights", multiple: true
|
||||
input "numFlashes", "number", title: "This number of times (default 3)", required: false
|
||||
}
|
||||
section("Time settings in milliseconds (optional)..."){
|
||||
input "onFor", "number", title: "On for (default 1000)", required: false
|
||||
input "offFor", "number", title: "Off for (default 1000)", required: false
|
||||
}
|
||||
}
|
||||
|
||||
def installed() {
|
||||
log.debug "Installed with settings: ${settings}"
|
||||
|
||||
subscribe()
|
||||
}
|
||||
|
||||
def updated() {
|
||||
log.debug "Updated with settings: ${settings}"
|
||||
|
||||
unsubscribe()
|
||||
subscribe()
|
||||
}
|
||||
|
||||
def subscribe() {
|
||||
if (contact) {
|
||||
subscribe(contact, "contact.open", contactOpenHandler)
|
||||
}
|
||||
if (acceleration) {
|
||||
subscribe(acceleration, "acceleration.active", accelerationActiveHandler)
|
||||
}
|
||||
if (motion) {
|
||||
subscribe(motion, "motion.active", motionActiveHandler)
|
||||
}
|
||||
if (mySwitch) {
|
||||
subscribe(mySwitch, "switch.on", switchOnHandler)
|
||||
}
|
||||
if (myPresence) {
|
||||
subscribe(myPresence, "presence", presenceHandler)
|
||||
}
|
||||
}
|
||||
|
||||
def motionActiveHandler(evt) {
|
||||
log.debug "motion $evt.value"
|
||||
flashLights()
|
||||
}
|
||||
|
||||
def contactOpenHandler(evt) {
|
||||
log.debug "contact $evt.value"
|
||||
flashLights()
|
||||
}
|
||||
|
||||
def accelerationActiveHandler(evt) {
|
||||
log.debug "acceleration $evt.value"
|
||||
flashLights()
|
||||
}
|
||||
|
||||
def switchOnHandler(evt) {
|
||||
log.debug "switch $evt.value"
|
||||
flashLights()
|
||||
}
|
||||
|
||||
def presenceHandler(evt) {
|
||||
log.debug "presence $evt.value"
|
||||
if (evt.value == "present") {
|
||||
flashLights()
|
||||
} else if (evt.value == "not present") {
|
||||
flashLights()
|
||||
}
|
||||
}
|
||||
|
||||
private flashLights() {
|
||||
def doFlash = true
|
||||
def onFor = onFor ?: 1000
|
||||
def offFor = offFor ?: 1000
|
||||
def numFlashes = numFlashes ?: 3
|
||||
|
||||
log.debug "LAST ACTIVATED IS: ${state.lastActivated}"
|
||||
if (state.lastActivated) {
|
||||
def elapsed = now() - state.lastActivated
|
||||
def sequenceTime = (numFlashes + 1) * (onFor + offFor)
|
||||
doFlash = elapsed > sequenceTime
|
||||
log.debug "DO FLASH: $doFlash, ELAPSED: $elapsed, LAST ACTIVATED: ${state.lastActivated}"
|
||||
}
|
||||
|
||||
if (doFlash) {
|
||||
log.debug "FLASHING $numFlashes times"
|
||||
state.lastActivated = now()
|
||||
log.debug "LAST ACTIVATED SET TO: ${state.lastActivated}"
|
||||
def initialActionOn = switches.collect{it.currentSwitch != "on"}
|
||||
def delay = 0L
|
||||
numFlashes.times {
|
||||
log.trace "Switch on after $delay msec"
|
||||
switches.eachWithIndex {s, i ->
|
||||
if (initialActionOn[i]) {
|
||||
s.on(delay: delay)
|
||||
}
|
||||
else {
|
||||
s.off(delay:delay)
|
||||
}
|
||||
}
|
||||
delay += onFor
|
||||
log.trace "Switch off after $delay msec"
|
||||
switches.eachWithIndex {s, i ->
|
||||
if (initialActionOn[i]) {
|
||||
s.off(delay: delay)
|
||||
}
|
||||
else {
|
||||
s.on(delay:delay)
|
||||
}
|
||||
}
|
||||
delay += offFor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user