HomeGenie Forum

Automation Program Plugins and Wizard Scripting => Help => Topic started by: KaZe on March 15, 2015, 06:24:04 PM

Title: Change Z-Wave multi sensor Parameters in C#
Post by: KaZe on March 15, 2015, 06:24:04 PM
How do I change the Z-wave multi sensor "HomeGenie.SecuritySensor" parameter to "Off" in C # code?
Title: Re: Change Z-Wave multi sensor Parameters in C#
Post by: nolio on March 15, 2015, 08:55:13 PM
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
Title: Re: Change Z-Wave multi sensor Parameters in C#
Post by: KaZe on March 15, 2015, 09:23:37 PM
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.)
Title: Re: Change Z-Wave multi sensor Parameters in C#
Post by: Gene on March 15, 2015, 10:48:38 PM
Code: [Select]
var module = Modules.WithName("Nappali");
module.Parameter("HomeGenie.SecuritySensor").Value = "Off";

g.
Title: Re: Change Z-Wave multi sensor Parameters in C#
Post by: KaZe on March 16, 2015, 07:17:05 AM
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?)"
Title: Re: Change Z-Wave multi sensor Parameters in C#
Post by: Gene on March 16, 2015, 11:09:14 AM
forget the Get:
Code: [Select]
var module = Modules.WithName("Nappali").Get();
module.Parameter("HomeGenie.SecuritySensor").Value = "Off";

g.
Title: Re: Change Z-Wave multi sensor Parameters in C#
Post by: KaZe on March 16, 2015, 07:07:22 PM
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.
Title: Re: Change Z-Wave multi sensor Parameters in C#
Post by: Gene on March 16, 2015, 07:58:00 PM
Hi Kaze did you try reloading the page?
Or just use Program.RaiseEvent (http://www.homegenie.it/docs/doxy/a00007.html#a218728a3b9a672b32b46f1e2275cc20d) 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.
Title: Re: Change Z-Wave multi sensor Parameters in C#
Post by: KaZe on March 16, 2015, 09:57:58 PM
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 (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;
Title: Re: Change Z-Wave multi sensor Parameters in C#
Post by: Gene on March 17, 2015, 12:01:00 AM
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.
Title: Re: Change Z-Wave multi sensor Parameters in C#
Post by: KaZe on March 17, 2015, 05:54:28 PM
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.
Title: Re: Change Z-Wave multi sensor Parameters in C#
Post by: KaZe on March 17, 2015, 06:07:45 PM
I corrected a few typo.
Title: Re: Change Z-Wave multi sensor Parameters in C#
Post by: [email protected] on May 26, 2015, 04:56:50 PM
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
Title: Re: Change Z-Wave multi sensor Parameters in C#
Post by: KaZe on May 27, 2015, 03:25:30 PM
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 (http://www.vesternet.com/resources/application-notes/apnt-31#.VWXFas_tlBc)
Title: Re: Change Z-Wave multi sensor Parameters in C#
Post by: [email protected] on May 27, 2015, 05:23:04 PM
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
Title: Re: Change Z-Wave multi sensor Parameters in C#
Post by: dani on May 27, 2015, 06:31:24 PM
The different Sensor values will appear in the widget automatically at the first data receive from the Node.
Title: Re: Change Z-Wave multi sensor Parameters in C#
Post by: [email protected] on May 29, 2015, 12:13:55 AM
Hi dani, thank you for responding.
Unfortunately I don't get any of the other values from any of the multi sensors.
Maybe that was because I added the devices without adding them to group1???
When I realised I needed to do this I went back and assigned each of the sensors to group1.

Thanking you in advance.
Martin
Title: Re: Change Z-Wave multi sensor Parameters in C#
Post by: dani on May 29, 2015, 08:25:21 AM
For receive all sensor datas, sometimes you have to modify the parameters of your sensor by SetUp Screen. The dfault values are not always correct. For kkep alive the battery, the construcor setup the minimum transmission by default You have to read the notice. But yes, the principal values are the Groups ID.
For exemple with Fibaro Motion multisensor you must modify some parameters for temperature report as if you want to receive it and the variation of temperature to generate report, etc...
Title: Re: Change Z-Wave multi sensor Parameters in C#
Post by: [email protected] on May 29, 2015, 11:53:38 PM
Hi dani, yes I've done that for all sensors as part of the setup but I still don't get any other values.
I have trialled Indigo, domoticz and domotiga and they all get the all the values from the sensors.
What do I put into the Group 1...????


Scrub that, I figured it out. I had to add Node 1 to all 3 groups for each device. D'oh!!

All working nicely now thank you dani, and Kaze, much obliged to you.

Martin
:-)