Skip to content

Commit

Permalink
Add "capability.sensor" with custom attribute list
Browse files Browse the repository at this point in the history
This allows adding any attributes on a device that exposes
"capability.sensor".
  • Loading branch information
presslab-us committed Feb 5, 2016
1 parent d851c50 commit de7cdd5
Showing 1 changed file with 7 additions and 0 deletions.
Expand Up @@ -49,6 +49,8 @@ preferences {
input "illuminances", "capability.illuminanceMeasurement", title: "Illuminance Sensors", required: false, multiple: true
input "presenceSensors", "capability.presenceSensor", title: "Presence Sensors", required: false, multiple: true
input "switches", "capability.switch", title: "Switches", required: false, multiple: true
input "sensors", "capability.sensor", title: "Sensors", required: false, multiple: true
input "sensorAttributes", "text", title: "Sensor Attributes (comma delimited)", required: false
}

section ("Google Sheets script url key...") {
Expand Down Expand Up @@ -92,6 +94,11 @@ def initialize() {
subscribe(illuminances, "illuminance", handleNumberEvent)
subscribe(presenceSensors, "presence", handleStringEvent)
subscribe(switches, "switch", handleStringEvent)
if (sensors != null && sensorAttributes != null) {
sensorAttributes.tokenize(',').each {
subscribe(sensors, it, handleStringEvent)
}
}
}

def setOriginalState() {
Expand Down

0 comments on commit de7cdd5

Please sign in to comment.