more G-Labs products

Author Topic: Add property to sensor.  (Read 1507 times)

January 02, 2015, 07:03:31 PM
Read 1507 times

maxflax

  • ***
  • Information
  • Full Member
  • Posts: 90
Hi,

I am expanding your Security System program and I'm adding some features to the doorwindow sensor so I can see directly on the sensor if it's armed or disarmed with a icon which is red for disarmed and green for armed. I have different modes for the alarm (Away, Home, Off). For this to work I need a property to use on the sensor module to hold my value indicating the armed state. Thought I might use the Sensor.Generic but I don't know if thats for others stuff which I might break then. Haven't really looked into what the generic is for either.

Is there a better way doing this or is it possible to add a new property Sensor.Armed or something?

« Last Edit: January 02, 2015, 07:10:19 PM by maxflax »

January 02, 2015, 09:00:11 PM
Reply #1

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
You can add any custom property to a module.

Code: [Select]
module.Parameter("Sensor.MyParameter").Value = "whatever";


January 02, 2015, 09:16:18 PM
Reply #2

maxflax

  • ***
  • Information
  • Full Member
  • Posts: 90
Cool, and reading that is with the same way as  the others.. HG.WebApp.Utility.GetModulePropertyByName?
Will adding and changing a custom parameter trigger a UI update?

Been trying to figure out how to trigger a refresh of the control in the GUI but with no luck.
« Last Edit: January 03, 2015, 12:50:13 AM by maxflax »

January 03, 2015, 03:20:22 PM
Reply #3

maxflax

  • ***
  • Information
  • Full Member
  • Posts: 90

ProgramHelper RaiseEvent   (   ModuleHelper    module,
string    parameter,
string    value,
string    description
)      

Did the trick, would like to be able to suppress the popup thou. A bool which is default true to show but when set to false will suppress the notification popup.

January 05, 2015, 02:36:20 AM
Reply #4

enterprised

  • ****
  • Information
  • Sr. Member
  • Posts: 101
  • Things are only impossible until they are not
"Did the trick, would like to be able to suppress the popup thou. A bool which is default true to show but when set to false will suppress the notification popup."

I motion that.
4a 75 73 74 20 61 20 70 65 72 73 6f 6e 20 68 61 76 69 6e 67 20 66 75 6e 20 77 69 74 68 20 68 6f 6d 65 20 61 75 74 6f 6d 61 74 69 6f 6e
enterprised == guytpetj

January 05, 2015, 02:43:56 AM
Reply #5

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer