more G-Labs products

Author Topic: AddVirtualModules problem popped up today for some reason  (Read 1737 times)

July 01, 2015, 02:47:15 AM
Read 1737 times

kevin1

  • *****
  • Information
  • Hero Member
  • Posts: 330

The MotionDetect module started causing runtime problems this evening for some reason...
Code: [Select]
Program.AddVirtualModules("HomeAutomation.ArduinoGarage", "DoorWindow", "homegenie/generic/doorwindow", 1, 2);
Program.AddVirtualModules("HomeAutomation.ArduinoGarage", "Sensor", "homegenie/generic/sensor", 3, 3);
Program.AddVirtualModules("HomeAutomation.ArduinoGarage", "Sensor.MotionDetect", "homegenie/generic/sensor", 4, 4);

Program.AddInputField("ArduinoIP", "192.168.1.71", "Arduino Garage IP Address");

Here is the error when I try to run the code which has been working fine for a couple weeks...
Code: [Select]
TC: at System.Enum.TryParseEnum(Type enumType, String value, Boolean ignoreCase, EnumResult& parseResult) at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase) at HomeGenie.Automation.Scripting.ProgramHelper.AddVirtualModules(String domain, String type, String widget, Int32 startAddress, Int32 endAddress) at HomeGenie.Automation.Scripting.ScriptingInstance.b__10() at HomeGenie.Automation.Scripting.ProgramHelper.Setup(Action functionBlock) Runtime
Error
8:45:37 PM Block popup from this source
Error
×
     at System.Enum.TryParseEnum(Type enumType, String value, Boolean ignoreCase, EnumResult& parseResult)
     at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase)
     at HomeGenie.Automation.Scripting.ProgramHelper.AddVirtualModules(String domain, String type, String widget, Int32 startAddress, Int32 endAddress)
     at HomeGenie.Automation.Scripting.ScriptingInstance.b__10()
     at HomeGenie.Automation.Scripting.ProgramHelper.Setup(Action functionBlock)

I have restarted and commented out lines until I narrowed it down to the line referenced above.
« Last Edit: July 01, 2015, 03:59:03 PM by kevin1 »

July 01, 2015, 04:10:20 PM
Reply #1

kevin1

  • *****
  • Information
  • Hero Member
  • Posts: 330
Fixed it I guess, deleted ".MotionDetect", compile, runs ok, add ".MotionDetect" back, compile, runs ok  ???

July 01, 2015, 04:41:17 PM
Reply #2

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
Sometimes a recompile is necessary after an update.  Sometimes it's required without an update too though.  I can't explain either.   :o

July 15, 2015, 01:02:53 PM
Reply #3

kevin1

  • *****
  • Information
  • Hero Member
  • Posts: 330
Its happening again  >:(

My MotionDetect arduino sensor modules have been working fine for weeks.  Last night I rebooted my PC and getting runtime errors  :-[

 
Quote
Requested value 'Sensor.MotionDetect' was not found.
Quote
Error
×
     at System.Enum.TryParseEnum(Type enumType, String value, Boolean ignoreCase, EnumResult& parseResult)
     at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase)
     at HomeGenie.Automation.Scripting.ProgramHelper.AddVirtualModules(String domain, String type, String widget, Int32 startAddress, Int32 endAddress)
     at HomeGenie.Automation.Scripting.ScriptingInstance.b__15()
     at HomeGenie.Automation.Scripting.ProgramHelper.Setup(Action functionBlock)

Tried recompiling the files with minor edits.  Tried restarting HG.

Commenting this out seems to fix the runtime problem  ???
Code: [Select]
//Program.AddVirtualModules("HomeAutomation.ArduinoGarage", "Sensor.MotionDetect", "homegenie/generic/sensor", 4, 4);


July 15, 2015, 07:21:22 PM
Reply #4

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Sensor.MotionDetect is not a module type but rather a module property name.

Allowed module types are listed here:

https://github.com/genielabs/HomeGenie/blob/master/MigFiles/MIG/MIGInterface.cs#L145

Cheers,
g.

July 15, 2015, 08:18:31 PM
Reply #5

kevin1

  • *****
  • Information
  • Hero Member
  • Posts: 330
Thanks Gene.  I am definitely confused on the details.  So DoorWindow is a module type, and Sensor.DoorWindow is a property, shoudn't it be DoorWindow.Status or something?

July 28, 2015, 06:40:28 PM
Reply #6

kevin1

  • *****
  • Information
  • Hero Member
  • Posts: 330
So what am I mixing up to cause my ArduinoGarage module to show as a feature under IpCamera  :-\ :o ??? :'(

I added this to IpCamera triggers to enable motion detection notification via webapi:
Code: [Select]
    Program.AddFeature("Media.IpCamera", "HomeGenie.SecuritySensor", "Use as Security Sensor");
ArduinoGarage program has this:
Code: [Select]
Program.Setup(()=>{

Program.AddVirtualModules("HomeAutomation.ArduinoGarage", "DoorWindow", "homegenie/generic/doorwindow", 1, 2);
Program.AddVirtualModules("HomeAutomation.ArduinoGarage", "Sensor", "homegenie/generic/sensor", 3, 3);
Program.AddVirtualModules("HomeAutomation.ArduinoGarage", "Sensor", "homegenie/generic/sensor", 4, 4);

Program.AddFeature("Sensor,DoorWindow", "HomeGenie.SecuritySensor", "Use as Security Sensor");

Program.AddInputField("ArduinoIP", "192.168.1.71", "Arduino Garage IP Address");

Program.Parameter("Temperature").Value = "-1";
Program.Parameter("Humidity").Value = "-1";
Program.Parameter("Luminance").Value = "-1";
Program.Parameter("Door1").Value = "-1";
Program.Parameter("Door2").Value = "-1";
Program.Parameter("MotionDetect").Value = "-1";
});


return true; // execute "Code To Run"

Screenshot showing problem below...