Virtual Presence Sensor

The Unofficial SmartThings Blog
Jump to: navigation, search

A Virtual Presence Sensor (or Simulated Presence Sensor) is a device within the SmartThings environment that appears to be a regular presence sensor to other applications; however, the device is “virtual” and not tied to a physical device. This is useful to use for advanced controlling of automations based on presence but without a physical device. For example, using the popular Community SmartApp Ask Alexa a person could 'check in' when arriving at home, and then check out when leaving home, allowing automations (and status checking) to accurately operate.

SimPresence.png

Summary

Product: Virtual Presence Sensor/Simulated Presence Sensor

Type: Virtual

Device Type Author: SmartThings

Open Source License/Trademarks

Licensed under the Apache License, Version 2.0 (the "License"); you may not use the Virtual Dimmer code 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.

All product and company names are trademarks™ or registered® trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.

Installation

To install the virtual presence sensor, find the section labeled My Devices at the top of http://ide.smartthings.com. Click this link.

MyDevices.png

On this next page you will be presented a list of all of the devices within your SmartThings account. These are typically the physical devices within your account. From here, find the button in the upper-right corner of the page labeled +New Device. Click this link and you will be presented a number of fields to fill in.

+newDevice.png

Starting at the top of the fields, fill out the name of the device. You can always change this name later within the SmartThings mobile application or the IDE.

Once you fill out the name, simply use the same name for the Label.

Since this is a virtual device, leave the Zigbee Id field blank.

For the field labeled Device Network Id, fill in a number that is unique to your environment (you may need to look at the list from the previous screen to determine what is unique.) This field is required, however, the number is not used anywhere else, so a simple “1234567890” could work well for this. Any subsequent devices created could build off of this (for example: “223456790”).

In the next field labeled Type, choose “Simulated Presence Sensor”.

VPresence.png

The Version field should remain as “Published”, and both the Location and Hub should have your location’s hub listed. Ensure both of these fields are not empty, however Group can remain empty. When you are happy with your entries, click the Create button. You will be taken back to the My Devices page, which should now include your newly created virtual sensor. You can always click on the switch again and edit it should you need to, or you can edit some of the attributes (such as the name) in the SmartThings mobile application on your phone or tablet.

Usage

Unlike other simulated devices, when you add this device, you CAN NOT change the status via the GUI. You will need software such as Ask Alexa or WebCoRE to update the device's status.

Developer Notes

Ironically, while a simulated presence sensor acts like a normal physical sensor and registers "Present" and "Not Present", the actual commands to change the status are:

Present: {STDEVICE}.arrived()

Not Present: {STDEVICE}.departed()