Create For()...

Discussions about Z-Way software and Z-Wave technology in general
Post Reply
NoName
Posts: 2
Joined: 21 Sep 2017 16:52

Create For()...

Post by NoName »

Hello, i wanted to use this Code:

Code: Select all

{
var numh = (192.168.1.102:8083/JS/Run/this.controller.devices.get("CounterTriggeringSensor_21").get("metrics:level"));
for(numh;numh>0;numh-1){
    
	192.168.1.102:8083/JS/Run/zway.devices[5].instances[0].commandClasses[0x20].Set(255);
    
    	192.168.1.102:8083/JS/Run/setTimeout(function(){zway.devices[5].instances[0].commandClasses[0x20].Set(0)},3000);
}
}
So a variable is created aut of a CounterTriggerin Sensor . The Switch should start numh times for a short time.
But it always says "Unexpected Number", but i have really no idea, what is wrong.
Could someone may help?
Greetings
User avatar
PoltoS
Posts: 7571
Joined: 26 Jan 2011 19:36

Re: Create For()...

Post by PoltoS »

You need to learn JS a bit. Do you want to run this code on the Z-Way JS side?

Code: Select all

var numh = this.controller.devices.get("CounterTriggeringSensor_21").get("metrics:level");
for(; numh > 0; numh--) {
	zway.devices[5].instances[0].commandClasses[0x20].Set(255);
    	setTimeout(function() { zway.devices[5].instances[0].commandClasses[0x20].Set(0) }, 3000);
}
But the code is still pretty useless - what the for loop is doing here?
Post Reply