This is the simplest script I could come up with trying to use the library. I have tried many different variants for this without luck. Since there is hardly any documentation on this (as far as I have found), I copied the Newtonsoft.Json.dll to the scripts directory of Homeseer.
The error I am getting
System info:
Current Date/Time: 26/07/2018 11:31:56 PM
HomeSeer Version: HS3 Pro Edition 3.0.0.435
Operating System: Microsoft Windows 10 Pro - Work Station
System Uptime: 2 Days 1 Hour 12 Minutes 23 Seconds
IP Address: 10.0.0.79
Number of Devices: 302
Number of Events: 21
Available Threads: 200
HSTouch Enabled: True
Event Threads: 0
Event Trigger Eval Queue: 0
Event Trigger Priority Eval Queue: 0
Device Exec Queue: 0
HSTouch Event Queue: 0
Email Send Queue: 0
Anti Virus Installed: Windows Defender
Enabled Plug-Ins
2.0.59.0: BLBackup
3.0.0.21: Chromecast
3.0.0.48: EasyTrigger
3.9.610.5: HSBuddy
3.0.0.28: ImperiHome
3.0.2.0: MeiHarmonyHub
0.0.0.42: Pushover 3P
1.0.0.7: Restart
30.0.0.36: RFXCOM
3.0.8.4: SDJ-VStat
3.0.1.190: Z-Wave
Code:
//css_searchdir "C:\Program Files (x86)\HomeSeer HS3\scripts"; //css_reference Newtonsoft.Json.dll; //css_import Newtonsoft; using Newtonsoft; using Newtonsoft.Json; using Newtonsoft.Json.JsonConvert; public object Main(object[] param) { var someJson = "{}"; var result = Newtonsoft.Json.JsonConvert.DeserializeObject(someJson); hs.WriteLog("Test-Script", "Worked"); return 0; }
Code:
Compiling script C:\Program Files (x86)\HomeSeer HS3\scripts\CSharpTest.cs: {interactive}(36,16): error CS0103: The name `Newtonsoft' does not exist in the current context {interactive}(36,27): error CS0023: The `.' operator cannot be applied to operand of type `' {interactive}(36,3): error CS0825: The contextual keyword `var' may only appear within a local variable declaration {interactive}(13,17): warning CS0414: The private field `Script.hs' is assigned but its value is never used
Current Date/Time: 26/07/2018 11:31:56 PM
HomeSeer Version: HS3 Pro Edition 3.0.0.435
Operating System: Microsoft Windows 10 Pro - Work Station
System Uptime: 2 Days 1 Hour 12 Minutes 23 Seconds
IP Address: 10.0.0.79
Number of Devices: 302
Number of Events: 21
Available Threads: 200
HSTouch Enabled: True
Event Threads: 0
Event Trigger Eval Queue: 0
Event Trigger Priority Eval Queue: 0
Device Exec Queue: 0
HSTouch Event Queue: 0
Email Send Queue: 0
Anti Virus Installed: Windows Defender
Enabled Plug-Ins
2.0.59.0: BLBackup
3.0.0.21: Chromecast
3.0.0.48: EasyTrigger
3.9.610.5: HSBuddy
3.0.0.28: ImperiHome
3.0.2.0: MeiHarmonyHub
0.0.0.42: Pushover 3P
1.0.0.7: Restart
30.0.0.36: RFXCOM
3.0.8.4: SDJ-VStat
3.0.1.190: Z-Wave
Comment