Page 1 of 1
set termostat value in module
Posted: 12 Nov 2014 19:40
by kgm
I'm trying to write module that scheldue thermostat, but it doesnt work
In index.js I have
var aDev = this.controller.devices.get(this.config.thermostat);
aDev.instances[0].ThermostatSetPoint.Set(1,6);
I also tried
this.controller.devices[9].instances[0].ThermostatSetPoint.Set(1,6);
What am I doing wrong? How set temperature in script?
Re: set termostat value in module
Posted: 12 Nov 2014 21:11
by pofs
You're mixing two different API levels.
Accessing devices[x].instances[y].ThermostatSetPoint is applicable only to Z-Wave binding, which is exported into global object zway. Note that global zway object may change or disappear, so your module should be ready to handle that.
If you're going with this.controller.devices, it returns virtual device that can be operated with metrics. This is a higher level of abstraction.
Re: set termostat value in module
Posted: 12 Nov 2014 22:49
by pz1
pofs wrote: Note that global zway object may change or disappear
Does this mean that I can throw away the whole 1.7 Z-Way developers manual ?
Re: set termostat value in module
Posted: 12 Nov 2014 23:02
by pofs
pz1 wrote:pofs wrote: Note that global zway object may change or disappear
Does this mean that I can throw away the whole 1.7 Z-Way developers manual ?
No, why? I mean it may be re-created/removed in 2.0 when you reconfigure/disable Z-Wave Binding module, so you should design your modules having that in mind and don't keep global references to the objects that may become invalid.
Re: set termostat value in module
Posted: 12 Nov 2014 23:32
by pz1
OK thanks, now (I think) I understand the context.
Re: set termostat value in module
Posted: 13 Nov 2014 03:18
by kgm
Thank for reply. Now I have in script
Code: Select all
var aDev = self.controller.devices.get(self.config.thermostat);
aDev.performCommand("exact", { level : 16 });
but it still doesn't work
in log file:
ZWayVDev_8:0:Thermostat:T performCommand processing: {"0":"exact","1":{"level":16}}
but nothing happens, temperature setpoint remains unchanged.
Re: set termostat value in module
Posted: 14 Nov 2014 19:21
by kgm
It seems that metrics doesn't work with object thermostat neither on v1.7.2 nor 2.0.0rc17.
There is also some problem with widget, witch doesn't display at all.
This worked for me. Maybe someone find it usefull
Code: Select all
var setTemp = parseInt ( self.config.temperature,10);
zway.devices[9].instancds[0].ThermostatSetPoint.Set(1,setTemp) ;
Re: set termostat value in module
Posted: 15 Nov 2014 10:43
by etrust
Hi Guys,
I can control my lights using http request very well. I am searching the http request to setup temperature. Can somebody show me an url example to be able to setup the temperature for my Danfoss Thermostat?
Thanks
Re: set termostat value in module
Posted: 15 Nov 2014 20:04
by LAN-Opfer