Hi there, and happy holidays to all of you.
I'm new to homeseer and home automation, but have experience from industrial control systems and programming plc's. I also have some experience writing in C and C++, although I haven't practiced it for years.
I'd like to harvest the power of scripting with homeseer, but I cant even get the simplest hs.writelog statement to work.
I think I need help
My system is HS3 Zee2 installed on a Rasberry pi II B.
Razberry GPIO Z-wave controller, 6 connected devices functioning properly.
Z-wave plugin activated.
HStouch plugin activated.
I have a simple C# testscript with very limited code, I've tried it in different versions with slightly different results. At first I copied a simple piece of code from the user manual to a testcript which I run manually from the event page.
testscript.cs
Running this script crashes the system, I can no longer find the homeseer installation using find.homeseer.com, not from the internet and not from LAN. After restarting the Rasberry by pulling the power both z-wave and hstouch plugins are deactivated, but activating from plugin page brings them back to life.
Adding a namespace for "System" by adding (using System without parentheses as the first line (before the "Main" function call) makes the script run, but now i get a error message in the log instead of the expected "CSHARP From C# TestScript" entry.
Script like so:
testscript.cs
Error message:
I also tried adding more namespaces, like e.g:
using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using HomeSeerAPI;
Changing hs.writelog to hs.WriteLog makes no difference either.
What am I doing wrong?
My next step after getting writelog to work is trying to control a virtual device, then sending parameters and finally actual usage on real devices.
Regards
Frode
I'm new to homeseer and home automation, but have experience from industrial control systems and programming plc's. I also have some experience writing in C and C++, although I haven't practiced it for years.
I'd like to harvest the power of scripting with homeseer, but I cant even get the simplest hs.writelog statement to work.
I think I need help
My system is HS3 Zee2 installed on a Rasberry pi II B.
Razberry GPIO Z-wave controller, 6 connected devices functioning properly.
Z-wave plugin activated.
HStouch plugin activated.
I have a simple C# testscript with very limited code, I've tried it in different versions with slightly different results. At first I copied a simple piece of code from the user manual to a testcript which I run manually from the event page.
testscript.cs
public Object Main(Object[] parm)
{
hs.writelog("CSHARP","From C# TestScript");
return null;
}
{
hs.writelog("CSHARP","From C# TestScript");
return null;
}
Adding a namespace for "System" by adding (using System without parentheses as the first line (before the "Main" function call) makes the script run, but now i get a error message in the log instead of the expected "CSHARP From C# TestScript" entry.
Script like so:
testscript.cs
using System;
public Object Main(Object[] parm)
{
hs.writelog("CSHARP","From C# TestScript");
return null;
}
public Object Main(Object[] parm)
{
hs.writelog("CSHARP","From C# TestScript");
return null;
}
Compiling script /usr/local/HomeSeer/scripts/TestScript.cs: {interactive}(56,8): error CS1061: Type `Scheduler.hsapplication' does not contain a definition for `writelog' and no extension method `writelog' of type `Scheduler.hsapplication' could be found (are you missing a using directive or an assembly reference?) {interactive}(25,17): warning CS0414: The private field `Script.hs' is assigned but its value is never used
using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using HomeSeerAPI;
Changing hs.writelog to hs.WriteLog makes no difference either.
What am I doing wrong?
My next step after getting writelog to work is trying to control a virtual device, then sending parameters and finally actual usage on real devices.
Regards
Frode
Comment