I needed a virtual device that could let me know if my inControl mobile app on my phone was successfully communicating with my controller. If I am away from the house and I tell the phone app to shutoff a light how do I know if it really happened? I cannot know for sure, but at least if I know the controller is reporting a device level change back to my phone on a regular basis I will have a better comfort level that everything is actually functioning properly.

I created a simple virtual device the reports the number of seconds on the clock and updates the value every 15 seconds.

1. Create a new virtual device. Call it whatever you want, I called my CurrentTime.
2. Get shortId from virtual device by double clicking new device (in my case it was 24)
3. Copy Script code below and put it in to a file called UpdateTime.cs in Scripts directory
4. Create a new Scene called UpdateTime
5. Don't add any devices to the scene, but add a pre-script and browse to UpdateTime.cs
6. Add a Time trigger to the screen to and have it repeat Secondly with an interval of 15

Now if you open your phone app and view the powered devices you will see the "CurrentTime" device level change every 15 seconds. This should be enough to let you know your phone is properly "receiving" updates from the controller.


[code]

using System;
using System.Collections.Generic;
using System.Text;
using MLS.ZWave.Service.Rules;
using MLS.ZWave.BusinessObjects;


public class UpdateVirtualTimeDevice : ScriptBase, ScriptInterface
{

///


/// This script updates a virtual device with the number of seconds on the clock when the script is run
///
/// ALWAYS MAKE COPIES OF SCRIPTS YOU INTEND TO CUSTOMIZE OR YOUR CHANGES
/// COULD BE LOST.
///

public void runScript()
{
try
{

// Get the shortID from the virtual device replace the 24 with the value from your virtual device
var devID = 24;
var device = getNodeByShortId(devID);
setDeviceLevel(device.deviceId, Convert.ToByte(DateTime.Now.Second));

}
catch (Exception ex)
{
// Log the exception here
var message = ex.Message;
writeFileLog(ex.Message.ToString());
}
}
}



[/code]