/* * Copyright 2019-2020 * * 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. * * */ metadata { definition(name: "Arlo Virtual Device", namespace: "mavrrick", author: "Mavrrick", importUrl: "https://tbd.com") { capability "Motion Sensor" capability "SoundSensor" capability "Switch" capability "Battery" capability "Alarm" capability "VideoCapture" attribute "healthStatus", 'STRING' attribute "battery", 'NUMBER' attribute "alarm", "enum", ["off", "both", "siren", "strobe"] attribute "clipStatus", "enum", ["initiated","completed"] command "active" command "inactive" command "motion", [[name: 'Motion Detected', type: 'ENUM', constraints: ["active", "inactive"]]] command "alarm", [[name: 'Alarm Status', type: 'ENUM', constraints: ["off", "both", "siren", "strobe"]]] command "disarm" command "battery", [[name: "Battery Level", type: "NUMBER", description: "Battery Percent full(0 to 100)"]] command "sound", [[name: 'Sound Detected', type: 'ENUM', constraints: ["detected", "not detected"]]] command "healthcheck", [[name: 'Status of Camera', type: 'ENUM', constraints: ["online", "offline"]]] command "capReset" } } /* installed Doesn't do much other than call initialize(). */ def installed() { initialize() } /* updated Doesn't do much other than call initialize(). */ def updated() { initialize() } /* initialize Doesn't do much other than call refresh(). */ def initialize() { // refresh() } /* uninstalled Reports to the remote that this device is being uninstalled. */ def uninstalled() { } /* parse In a virtual world this should never be called. */ def parse(String description) { log.trace "Msg: Description is $description" } /* refresh Refreshes the device by requesting an update from the client hub. def refresh() { // The server will update on/off status parent.sendDeviceEvent(device.deviceNetworkId, "refresh") } */ /* on Turns the device on. */ def on() { // The server will update on/off status sendEvent(name: "switch", value: "on") } /* off Turns the device off. */ def off() { // The server will update on/off status sendEvent(name: "switch", value: "off") } def motion(parm){ sendEvent(name: "motion", value: parm) } /* active Active Motion */ def active(){ sendEvent(name: "motion", value: "active") } /* inactive Inactive Motion */ def inactive(){ sendEvent(name: "motion", value: "inactive") } /* Alarm Command */ def alarm(parm){ sendEvent(name: "alarm", value: parm) } /* both Alarm Both option */ def both(){ sendEvent(name: "alarm", value: "both") } /* Siren Alarm Siren only option */ def siren(){ sendEvent(name: "alarm", value: "siren") } /* Strobe Alarm Strobe only option */ def strobe(){ sendEvent(name: "alarm", value: "strobe") } /* Alarm off Disarm alarm */ def disarm(){ sendEvent(name: "alarm", value: "off") } /* battery Set battery level */ def battery(parm){ sendEvent(name: "battery", value: parm) } /* Sound Set Active Sound */ def sound(parm){ sendEvent(name: "sound", value: parm) } /* Health Check Set health check value to online or offline */ def healthcheck(parm){ sendEvent(name: "healthStatus", value: parm) } /* Capture Initiate Set capture value to online or offline */ def capture(start = now(), capture = now(), end = now()){ sendEvent(name: "clipStatus", value: "initiated") runIn((60), capReset) } /* Reset Capture command */ def capReset() { sendEvent(name: "clipStatus", value: "complete") }