more G-Labs products

Author Topic: passing value back to the web interface  (Read 3220 times)

July 06, 2014, 05:54:01 AM
Read 3220 times

rwxr-xr-x

  • *
  • Information
  • Newbie
  • Posts: 7
Hello,

In the "Setup" page of the Z-Wave device I was able to add a new "Get" button, to get the status of a Door Lock, the "Basic" one does not work for Door lock, i'm able to send all the required messages and get the final value in the Z-Wave library, C# code, but my question is how do I send it to the Web interface ? I'm doing a:

Code: [Select]
nodeHost.RaiseUpdateParameterEvent(nodeHost, 0, ParameterType.PARAMATER_DOORLOCK_GET, message[9]);
but not sure what else I need to do so that the web interface to get it and populate in the "Setup Page"

Any recommendations?

To be more exact I want to populate the "Door Lock Status = ?" field, see attached image

« Last Edit: July 06, 2014, 06:05:54 AM by rwxr-xr-x »

July 07, 2014, 04:20:44 AM
Reply #1

rwxr-xr-x

  • *
  • Information
  • Newbie
  • Posts: 7
after further researched I noticed that the issue is caused by the fact that the property is not attached to the module:

Code: [Select]
ModuleParameter parameter = Service.Utility.ModuleParameterGet(module, parameterName);
I see the "module" as the right one and same for "paramaterName" but "parameter" is null, which tells me that the property is not added.

Anybody has any clues on how do add a new property to a module, even "ZWaveNode.Basic" is missing, not sure how to add them?

July 07, 2014, 01:14:48 PM
Reply #2

Gene

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

you probably have still to integrate your doorlock event into the MIG ZWave class:

https://github.com/genielabs/HomeGenie/blob/master/MIG/MIG/Interfaces/HomeAutomation/ZWave.cs#L783

Also see this message about adding new command classes to ZWaveLib->MIG->HomeGenie:

http://www.homegenie.it/forum/index.php?topic=244.msg1333#msg1333

Cheers,
g.

July 08, 2014, 04:43:27 AM
Reply #3

rwxr-xr-x

  • *
  • Information
  • Newbie
  • Posts: 7
Thank you, i was able to fix that.

In my case the web request, check status of the door, requires a series of messaged to be exchanged between the controller and device, I noticed that sometime the zwave library get's multiple requests to the same command, let's say DoorLock_Get, which mimics the Basic_Get function.

Is there a way to increase the repeat cycle? I mean to make it wait longer than 2-3 seconds as it does right now? To get the status of the door it can take up to 5-10 seconds. Same for locking the door, I can end up sending the same lock command 2-3 times.

Any clues on where I can tweak this?

Thank you


July 10, 2014, 04:40:44 AM
Reply #5

rwxr-xr-x

  • *
  • Information
  • Newbie
  • Posts: 7
I changed the function in the Utility.cs, but this is for how long to wait for the response to the URL request so that it can pass it back to the web interface, I had to change

Code: [Select]
(TimeSpan.FromTicks(parameter.UpdateTime.Ticks - updated).TotalSeconds > 1
to:

Code: [Select]
(TimeSpan.FromTicks(parameter.UpdateTime.Ticks - updated).TotalSeconds < -5
I have a brain freeze now and I can't explain it why it was required but this was the only way for me to get in the while loop - I'm OK with a 5 seconds old data if it get's to that, while the ZWave library was communicating with the device.

The HomeGenieService.cs, not really sure what should be tweaked there.

While debugging I noticed that, based on the call stack, the requests start from:

https://github.com/genielabs/HomeGenie/blob/master/MIG/MIG/Gateways/WebServiceGateway.cs#L296

but I can't figure out what triggers the callback, since no new URL requests are being sent from the web interface.

July 11, 2014, 03:21:52 AM
Reply #6

rwxr-xr-x

  • *
  • Information
  • Newbie
  • Posts: 7
After further investigation I was able to find the issue and now it kinda makes sense on why I did see multiple requests coming to ZWave library area, created the pull request https://github.com/genielabs/HomeGenie/pull/6

To test it,  make sure that port 80 is is use and have homegenie take port 81.
Go in the interfaces section and click on discovery, notice that the discovery is started twice, the same happens with any request

This was discovered and tested on Windows.