Author: Mark Stayton Version: 2 Added to Library: 10-Nov-23 HCAVersion needed: 16 Keywords: Class
Package Description: This class implements "virtual" On/Off devices. Virtual devices exist only in HCA and do not in and of themselves control anything. They can be used to create devices that allow a flag or numeric value to be visible to the HCA Android and IOS clients, or to an external assistant such as Alexa, Google Home, or Homebridge (IOS).
ADDING A VIRTUAL DEVICE TO YOUR DESIGN:
1. Create a new device.
2. In Step 3 of the New Device Wizard, select "Virtual OnOff Device" from the dialog.
3. In Step 4 of the wizard, select an icon appropriate for the intended usage of the virtual device.
4. If you will be using this device with an external assistant, open the device's Properties, check the Friendly Name box on the Name tab, and provide a unique name for the external assistant to use.
5. If you want the state of the device to be automatically restored when HCA restarts, open the device's Properties, and on the Restart tab check the "Use the method described above" option.
Program Description: This program implements a Virtual On/Off Device class. A virtual device is resident only in HCA and has no direct connection to any physical entities.
The class was developed to support a "soft" switch or lamp indication in the HCA Control User Interface, the HCA Android and IOS apps, and external assistants such as Alexa, Google Home, and Homebridge. It allows the user to use a device in place of a flag variable, and make that variable visible to the HCA mobile apps and external assistants.
A device based on this class supports the following commands: ON, OFF, Get Status
HOW TO USE THIS CLASS:
1. Create a new device.
2. In Step 3 of the New Device Wizard, select "Virtual OnOff Device" from the dialog.
3. In Step 4, select an icon appropriate for the intended usage of the virtual device.
4. If you will be using this device with an external assistant, open the device's Properties, check the Friendly Name box on the Name tab, and provide a unique name for the external assistant to use.
5. If you want the state of the device to be automatically restored when HCA restarts, open the device's Properties, and on the Restart tab check the "Use the method described above" option.
When a command is issued to the device, it will automatically execute this program, and the device state will change to reflect the command.
Class implementation by Mark Stayton (mark@thestaytons.net) | Version 1 | 14-Jul-2018
Example: Example applications for this class include:
1. Use in place of a flag variable to expose the value to the HCA mobile apps and/or external assistants.
2. Show / Change HCA Home Mode using external assistants
3. Occupancy Status (Person is Home/Away) used with geofencing
4. Enable/Disable SMS messaging (for instance, send SMS messages when away but not when home)
Return value: This program does not return a result.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
HCAName | Value | HCA's name for the device that activates this program | |
id | Value | Optional device ID, entered on the device properties User Class tab. | |
action | Value | Action to be performed on the $HCAName device (On, Off, Get Status) | |
percent | Value | Percent value to set or change |