HomeGenie Forum

General Category => Troubleshooting and Support => Topic started by: amselem on March 05, 2017, 11:48:51 AM

Title: Incoherent dimmer Level value when using web api
Post by: amselem on March 05, 2017, 11:48:51 AM
 Hello,
When setting a zwave dimmer via web api I use an url like this (to set the dimmer at 25%):
/api/HomeAutomation.ZWave/3/Control.Level/25

But when querying this same value with this url
/api/HomeAutomation.HomeGenie/Config/Modules.ParameterGet/HomeAutomation.ZWave/3/Status.Level

The returned value is 0.25 instead of 25

I think this is incoherent, HG is multiplying/dividing by 100 somewhere.

I'm binding this value to slider of an external application (which I don't control) and the get/set operations doesn't work correctly.
Title: Re: Incoherent dimmer Level value when using web api
Post by: bkenobi on March 06, 2017, 05:10:38 PM
I agree that this is a bit non-intuitive.  But, perhaps the reason is because the URL would be more complicated with a decimal value?  I don't know the reason why you HG would return 25 rather than 0.25 as HG actually uses 0-1 for level values in code.
Title: Re: Incoherent dimmer Level value when using web api
Post by: Bounz on March 06, 2017, 10:22:55 PM
Hi, amselem.
That's because you are setting the value directly to ZWave device (range [0-100]) but are reading the value from HG's module properties (range [0-1]).
I suggest you use following API endpoints and read data directly from device:
Title: Re: Incoherent dimmer Level value when using web api
Post by: amselem on March 06, 2017, 11:45:36 PM
Thank you very much Bounz!
 You were right, I was Reading/Writing to different sources (Zwave device vs HG Module).

The api you suggested works as expected.

Regards