I prefer C# and was looking for a C# version of test.aspx that is installed in the html folder. It took me some time so I figured I post the code here. I am purposely not using any 'using' statement so it's clear in which namespace certain classes, enums, etc reside in. lightRefID is the device I am controlling. You have to change this for your case. It's the device Reference ID you find when clicking on the device name in device management and then going to the Advanced tab. I am assuming the device has an On/Off state. If it doesn't then the call to CAPIGetSingleControl will probably fail. Instead of "On" and "Off" you can also use "Dim". These states avoid the issue of some devices having different values for the On state. For instance my Cooper Wiring dimmers use 99 as On. I was assuming that it's 100 but 100 doesn't seem to be used (255=Last). With "On" I don't have to worry about this.

<%@PageLanguage="C#" %>
<scriptrunat="server">
Scheduler.hsapplication hs;
HomeSeerAPI.PluginAccess plugin;
int lightRefID = 22; //Reference ID to a light or any other device that accepts status values of 0 and 100
void Page_Load(object Sender, EventArgs E)
{
try
{
// for use with the HS web server
hs = (Scheduler.hsapplication)Context.Items["Content"];
if (hs == null)
{
throw new Exception("Error getting access to HS application.");
}
// get a reference to the Z-Wave plugin
HomeSeerAPI.IHSApplication ihs = (HomeSeerAPI.IHSApplication)hs;
plugin = new HomeSeerAPI.PluginAccess(ref ihs, "Z-Wave", "");
if (plugin == null)
{
throw new Exception("Could not load plugin");
}
if ((bool)plugin.Connected)
{
Label2.Text = "Connected to Z-Wave plugin, name=" + plugin.Name;
}
Label1.Text = "HomeSeer Ver: " + hs.Version();
Scheduler.Classes.clsDeviceEnumeration EN;
Scheduler.Classes.DeviceClass dv;
EN = (Scheduler.Classes.clsDeviceEnumeration)hs.GetDeviceEnumerat or();
do
{
dv = EN.GetNext();
if (dv == null)
continue;
}
while (!EN.Finished);
}
catch (Exception ex)
{
Response.Write(ex.Message + ex.StackTrace);
}
}

void ButSpeak_Click(object sender, EventArgs e)
{
hs.Speak(TxtSpeak.Text, false, "");
Scheduler.Classes.clsDeviceEnumeration EN;
Scheduler.Classes.DeviceClass dv;
EN = (Scheduler.Classes.clsDeviceEnumeration)hs.GetDeviceEnumerat or();
do
{
dv = EN.GetNext();
if (dv == null)
continue;
}
while (!EN.Finished);
}

void ButtonOn_Click(object sender, System.EventArgs e)
{
//hs.SetDeviceValueByRef(lightRefID, 0, true); //This function only set the value so the status in device manager changes but the device doesn't really change its state
HomeSeerAPI.CAPI.CAPIControlResponse response;
response = hs.CAPIControlHandler(hs.CAPIGetSingleControl(lightRefID, true, "On", false, false));
if(response == HomeSeerAPI.CAPI.CAPIControlResponse.Indeterminate) { Status.Text = "Unknown result"; }
else if(response == HomeSeerAPI.CAPI.CAPIControlResponse.All_Success) { Status.Text = "All succeeded"; }
else if(response == HomeSeerAPI.CAPI.CAPIControlResponse.Some_Failed) { Status.Text = "Some failed"; }
else if(response == HomeSeerAPI.CAPI.CAPIControlResponse.All_Failed) { Status.Text = "All unsuccessful"; }
}

void ButtonOff_Click(object sender, System.EventArgs e)
{
HomeSeerAPI.CAPI.CAPIControlResponse response;
response = hs.CAPIControlHandler(hs.CAPIGetSingleControl(lightRefID, true, "Off", false, false));
if(response == HomeSeerAPI.CAPI.CAPIControlResponse.Indeterminate) { Status.Text = "Unknown result"; }
else if(response == HomeSeerAPI.CAPI.CAPIControlResponse.All_Success) { Status.Text = "All succeeded"; }
else if(response == HomeSeerAPI.CAPI.CAPIControlResponse.Some_Failed) { Status.Text = "Some failed"; }
else if(response == HomeSeerAPI.CAPI.CAPIControlResponse.All_Failed) { Status.Text = "All unsuccessful"; }
}

string GetHeadContent()
{
try
{
return hs.GetPageHeader("", "Test Page", "", "", false, false, true, false, false);
}
catch (Exception ex)
{
}
return "";
}

string GetBodyContent()
{
try
{
return hs.GetPageHeader("", "Test Page", "", "", false, true, false, true, false);
}
catch (Exception ex)
{
}
return "";
}

</script>
<html>
<headrunat="server">
<%Response.Write(GetHeadContent());%>
</head>
<body>
<%Response.Write(GetBodyContent()); %>
<formrunat="server">
<p>
<asp:Labelid="Label1"runat="server"width="210px">Label</asp:Label>
</p>
<p>
<asp:Labelid="Label2"runat="server"width="400px">Label</asp:Label>
</p>
<p>
<asp:LabelID="Status"runat="server"Width="200px"></asp:Label>
</p>
<p>
<asp:Buttonid="ButSpeak"onclick="ButSpeak_Click"runat="server"Text="Speak"></asp:Button>
<asp:TextBoxid="TxtSpeak"runat="server"></asp:TextBox>
</p>
<p>
<asp:ButtonID="ButtonOn"runat="server"OnClick="ButtonOn_Click"Text="Light On"/>
</p>
<p>
<asp:ButtonID="ButtonOff"runat="server"OnClick="ButtonOff_Click"Text="Light Off"/>&nbsp;
</p>
<!-- Insert content here -->
</form>
</body>
</html>