From b5953c758928871ca747f1d5e6087c87532ab661 Mon Sep 17 00:00:00 2001 From: joshs85 Date: Thu, 10 May 2018 20:23:53 -0400 Subject: [PATCH] Update webcore-presence-sensor.groovy Add arrived and departed functions so that the presence sensor status can be changed from webcore. --- .../webcore-presence-sensor.groovy | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/devicetypes/ady624/webcore-presence-sensor.src/webcore-presence-sensor.groovy b/devicetypes/ady624/webcore-presence-sensor.src/webcore-presence-sensor.groovy index 2d9409df..34c85eb4 100644 --- a/devicetypes/ady624/webcore-presence-sensor.src/webcore-presence-sensor.groovy +++ b/devicetypes/ady624/webcore-presence-sensor.src/webcore-presence-sensor.groovy @@ -69,6 +69,8 @@ metadata { attribute "bearing", "Number" command "asleep" command "awake" + command "arrived" + command "departed" command "toggleSleeping" } @@ -482,6 +484,14 @@ def awake() { toggleSleeping('not sleeping') } +def arrived() { + sendEvent(name: "presence", value: "present") +} + +def departed() { + sendEvent(name: "presence", value: "not present") +} + private formatLocalTime(format = "EEE, MMM d yyyy @ h:mm:ss a z", time = now()) { def formatter = new java.text.SimpleDateFormat(format) formatter.setTimeZone(location.timeZone)