more G-Labs products

Author Topic: Change Z-Wave multi sensor Parameters in C#  (Read 5096 times)

March 15, 2015, 06:24:04 PM
Read 5096 times

KaZe

  • ****
  • Information
  • Sr. Member
  • Posts: 219
How do I change the Z-wave multi sensor "HomeGenie.SecuritySensor" parameter to "Off" in C # code?

March 15, 2015, 08:55:13 PM
Reply #1

nolio

  • *****
  • Information
  • Global Moderator
  • Posts: 544
Hi,
In "Configure" -> "Groups and Modules" -> <your group> -> <your module>.
Then configure the module, choose "Security Alarm System" and uncheck "Use as Security Sensor".
Bye

March 15, 2015, 09:23:37 PM
Reply #2

KaZe

  • ****
  • Information
  • Sr. Member
  • Posts: 219
I know that.
I need to change this parameter with program code (C#).

The idea:
All motion sensor and door / window sensor parameters of "HomeGenie.SecuritySensor" is checked.
I create a virtual switch, which checked off this parameter for all motion sensors. (Virtual switch = Switch OFF)
So, if I'm at home, I can alert the home without motion detectors. Only the door / window sensors are active.
When I leave the house, the virtual switch will switch back to ON, and all sensors works again (motion, door, windows) with alarm system.

(Sorry, my English is not the best.)

March 15, 2015, 10:48:38 PM
Reply #3

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Code: [Select]
var module = Modules.WithName("Nappali");
module.Parameter("HomeGenie.SecuritySensor").Value = "Off";

g.

March 16, 2015, 07:17:05 AM
Reply #4

KaZe

  • ****
  • Information
  • Sr. Member
  • Posts: 219
Code: [Select]
module.Parameter("HomeGenie.SecuritySensor").Value = "Off";
this section displays the following error message:

"  'HomeGenie.Automation.Scripting.ModulesManager' does not contain a definition for 'Parameter' and no extension method 'Parameter' accepting a first argument of type 'HomeGenie.Automation.Scripting.ModulesManager' could be found (are you missing a using directive or an assembly reference?)"

March 16, 2015, 11:09:14 AM
Reply #5

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
forget the Get:
Code: [Select]
var module = Modules.WithName("Nappali").Get();
module.Parameter("HomeGenie.SecuritySensor").Value = "Off";

g.

March 16, 2015, 07:07:22 PM
Reply #6

KaZe

  • ****
  • Information
  • Sr. Member
  • Posts: 219
Thx! The code works fine.
But, if the code run with this command "module.Parameter("HomeGenie.SecuritySensor").Value = "Off";" I see, the changes in "parameters", but nothing happening in "Z-Wave 2 - Settings" panel.
And the motion sensor in the alarm system is still active.

March 16, 2015, 07:58:00 PM
Reply #7

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Hi Kaze did you try reloading the page?
Or just use Program.RaiseEvent instead of module.Parameter. This will make the UI update the value as well.

Code: [Select]
Program.RaiseEvent(module, "HomeGenie.SecuritySensor", "Off", "put some event description here...");

Cheers,
g.

March 16, 2015, 09:57:58 PM
Reply #8

KaZe

  • ****
  • Information
  • Sr. Member
  • Posts: 219
I've tried many variations.

1. The problem same as whitch is in this topic: http://www.homegenie.it/forum/index.php?topic=663.msg3863#msg3863
When I disabled Ping Me At Home program, the feature not disappear.

2. The parameters are updated the motion sensor, when i refresh the page. But the alarm system can not realize the changes. Despite "Off" value is set in motion sensor "HomeGenie.SecuritySensor" parameter, the alarm system takes into account the motion sensor.

This is the code:

Code: [Select]
    case "Control.On":
      Program.RaiseEvent(module, "Status.Level", "1", "SecuritySwitch"); //virtual switch
      modulesensor.Parameter("HomeGenie.SecuritySensor").Value = "Off"; //motion detector
      Program.RaiseEvent(modulesensor, "HomeGenie.SecuritySensor", "Off", "Nappali");
      break;
    case "Control.Off":
      Program.RaiseEvent(module, "Status.Level", "0", "SecuritySwitch");
      modulesensor.Parameter("HomeGenie.SecuritySensor").Value = "On";
      Program.RaiseEvent(modulesensor, "HomeGenie.SecuritySensor", "On", "Nappali");
      break;
« Last Edit: March 16, 2015, 10:01:56 PM by KaZe »

March 17, 2015, 12:01:00 AM
Reply #9

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
The reason is that the parameter has to be set to an empty string in order to be considered not active.
Any other value will make HG think that the flag is active.

Code: [Select]
Program.RaiseEvent(modulesensor, "HomeGenie.SecuritySensor", "", "Nappali");

Cheers,
g.

March 17, 2015, 05:54:28 PM
Reply #10

KaZe

  • ****
  • Information
  • Sr. Member
  • Posts: 219
You are right!  ::)
It's works fine!
With this simple solution can be developed zones in Security Alarm System.
I wrote a sample of 10 zones.
« Last Edit: March 17, 2015, 06:22:40 PM by KaZe »

March 17, 2015, 06:07:45 PM
Reply #11

KaZe

  • ****
  • Information
  • Sr. Member
  • Posts: 219
I corrected a few typo.

May 26, 2015, 04:56:50 PM
Reply #12

[email protected]

  • *
  • Information
  • Newbie
  • Posts: 7
Hi Kaze, I've just read the thread you had about multi sensor parameters and I would like to ask you a few questions if I may please?:
How did you get all the values from your multisensor?
I have a Fibaro motion sensor, a Fibaro flood sensor and a door/window sensor (that also has a temp sensor in it) and when I add the modules after including them into the z-wave network I only see one value.
And also how did you get all the values to show in the module widget and change the icon?

Thank you for any help you can give.
Kind regards
Martin

May 27, 2015, 03:25:30 PM
Reply #13

KaZe

  • ****
  • Information
  • Sr. Member
  • Posts: 219
Hi!

With this program, you can set the alarm system zones.
It does not set the sensors.
Try this:
http://www.vesternet.com/resources/application-notes/apnt-31#.VWXFas_tlBc

May 27, 2015, 05:23:04 PM
Reply #14

[email protected]

  • *
  • Information
  • Newbie
  • Posts: 7
Hi KaZe, thank you for the response.

I don't have the Aeon multisensor, I have Fibaro multi sensors and last night I managed to get them all into HomeGenie and get them to update the UI when events are triggered, motion and door open/close etc.

What I can't work out how to get are the other values from the sensors, like temp, lux and tamper from say the motion sensor. And then how to get them displayed in the widget like you showed in the image you attached below?

HG rocks!!! :-)

Thanks again
Martin