From de7cdd5a6afb68b8b3fa55d6e1c95a952cf90bdb Mon Sep 17 00:00:00 2001 From: Ryan Press Date: Fri, 5 Feb 2016 09:07:33 -0800 Subject: [PATCH] Add "capability.sensor" with custom attribute list This allows adding any attributes on a device that exposes "capability.sensor". --- .../google-sheets-logging.src/google-sheets-logging.groovy | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/smartapps/cschwer/google-sheets-logging.src/google-sheets-logging.groovy b/smartapps/cschwer/google-sheets-logging.src/google-sheets-logging.groovy index 05fb18e..5e741c3 100644 --- a/smartapps/cschwer/google-sheets-logging.src/google-sheets-logging.groovy +++ b/smartapps/cschwer/google-sheets-logging.src/google-sheets-logging.groovy @@ -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...") { @@ -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() {