hi,
I would like to know how I can create a custom function (for example, a scenario) and how can I call it using the JSON-API.
For example if I want to call the function
function myFunctio () {
zway.devices[2].SwitchBinary.Set(1);
zway.devices[3].SwitchBinary.Set(0);
zway.devices[4].SwitchBinary.Set(1);
}
how can i to do?
must i to insert the function in utomation/main.js?
must I to use a module?
Can you to help me please?
thanks
custom Function
Re: custom Function
You can do this at the moment with a scene in the latest version (1.7.1-rc2) using the develop branch of Home Automation
Since 29-12-2016 I am no longer a moderator for this forum
Re: custom Function
What you described above, perfectly fits a light scene concept.
But if you really want to make it a function, the simplest way is to put your it into a separate js file under z-way-utils/ folder. It will be accessible as http://ip:8083/ZAutomation/YourFunctionName after z-way-server restart.
But if you really want to make it a function, the simplest way is to put your it into a separate js file under z-way-utils/ folder. It will be accessible as http://ip:8083/ZAutomation/YourFunctionName after z-way-server restart.
Re: custom Function
@pofspofs wrote: a separate js file under z-way-utils/ folder
Do the contents of that folder survive a version upgrade?
Since 29-12-2016 I am no longer a moderator for this forum
Re: custom Function
No, it doesn't. Only userModules folder survives it.pz1 wrote:@pofspofs wrote: a separate js file under z-way-utils/ folder
Do the contents of that folder survive a version upgrade?
But I've said it is the simplest way, not the best one
Re: custom Function
hello,
thank you very much to everyone for your answers!
were very helpful.
I have another question:
how do I listen to an event from the network and call my function?
For example, if the switch changes state I see the change from the log file.
I want that when there is a change, is executed my function "myFunction ()".
is it possible?
how can I to do?
thanks
thank you very much to everyone for your answers!
were very helpful.
I have another question:
how do I listen to an event from the network and call my function?
For example, if the switch changes state I see the change from the log file.
I want that when there is a change, is executed my function "myFunction ()".
is it possible?
how can I to do?
thanks