This repository has been archived by the owner on Apr 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 114
/
Broadlink Manual device entry
53 lines (45 loc) · 1.88 KB
/
Broadlink Manual device entry
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/**
* *
* Copyright 2016 Rebecca Onuschak
*
*/
definition(
name: "broadlinkmanualentry" ,
namespace: "smartthings",
author: "BeckyR",
description: "manual update of broadlink devices",
category: "",
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/[email protected]",
iconX3Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/[email protected]")
preferences {
page(name: "page1", title: "Select Device", nextPage: "devicedata", install: false, uninstall: false){
section("Select Broadlink Devices to Update:") {
input(name:"somedevice", type: "device.broadlinkswitch", title: "Devices?", multiple: false)
}}
page(name: "devicedata", title: "Input device data", install: true, uninstall: true)
}
def devicedata(){
dynamicPage(name: "devicedata") {
somedevice.each{
section("${somedevice.name}") {
input(name: "BLURL", type: "string", title: "Broadlink URL",defaultValue: "${somedevice.currentValue('BLURL')}")
input(name: "BLMac", type: "string", title: "Broadlink MAC Address",defaultValue: "${somedevice.currentValue('BLmac')}",required:false)
input(name: "onCodeID", type: "string", title: "Code to turn on",defaultValue: "${somedevice.currentValue('onCodeID')}",required:false)
input(name: "offCodeID", type: "string", title: "Code to turn off",defaultValue: "${somedevice.currentValue('offCodeID')}",required:false)
}
}}}
def installed() {
initialize()
}
def updated() {
initialize()
}
def initialize() {
def d=settings.somedevice
d.changedata("BLURL","${settings.BLURL}")
d.changedata("BLmac","${settings.BLMac}")
d.changedata("onCodeID","${settings.onCodeID}")
d.changedata("offCodeID","${settings.offCodeID}")
log.info "Device ${d.name} updated"
}