Hello!
Last few days I started to dive into the JavaScript API of Z-Way and I want to start an own home automation project with serverside programming.
But I do not really got it, how to set up the project and the whole toolchain on my raspberry.
What I had done until now:
- installed node.js and npm
- installed express framework -> but do I really need this? I set up an express project that runs a webserver, but what libraries do I need to import and where do I get them? Do I have to copy them from automation/modules or can I point on them anyhow? How do I go ahead from here?
- the README.md inside the automation folder says I should test with gulp -> do I need Gulp?
I think I'm a little bit confused about all the things and how they come together. Can anyone give me a kind of red line or point me to a tutorial that gives me a clear overview about these things?
Greez a lot!
Johannes
Howto start with JavaScript API
Re: Howto start with JavaScript API
Documentation: http://razberry.z-wave.me
Re: Howto start with JavaScript API
Hi,
I know this website and I studied almost everything but I think it focusses on programming with the HTTP-Interface for client side.
I cannot find code samples for server side Virtual Device API.
I want to do some server-side programming with the Java Script API as referenced in the in zwayDev.pdf in Chapter 1.3.4 and Chapter 5.
But I can only find samples like
The code samples section (http://razberry.z-wave.me/index.php?id=15) only offers sample code for HTTP API's.
Greez a lot!
Johannes
I know this website and I studied almost everything but I think it focusses on programming with the HTTP-Interface for client side.
I cannot find code samples for server side Virtual Device API.
I want to do some server-side programming with the Java Script API as referenced in the in zwayDev.pdf in Chapter 1.3.4 and Chapter 5.
But I can only find samples like
Code: Select all
dev = this.controller.devices.get('ZWayVDev 6:0:37');
dev.command('o');
Greez a lot!
Johannes
Re: Howto start with JavaScript API
Hi,
it depends of what you mean under server side programming. ZWay is already a working system with web server, infrastucture and so on. Why should you need an another web server, node. io and so on?
Better look at existing modules under automation/modules. Thre is readable source code. Just copy modules's folder and play with it.
it depends of what you mean under server side programming. ZWay is already a working system with web server, infrastucture and so on. Why should you need an another web server, node. io and so on?
Better look at existing modules under automation/modules. Thre is readable source code. Just copy modules's folder and play with it.
Re: Howto start with JavaScript API
Hi,
I wanted to implement my own "individual home automation script" with my own callback functions and I thougt this is only possible with server-side programming, isn't it?
I wanted to implement my own "individual home automation script" with my own callback functions and I thougt this is only possible with server-side programming, isn't it?
Re: Howto start with JavaScript API
I think you need a module. A module is just an javascript and with them you can do anything you want. The module is called once the zway server is started. Thus you can define a callback function, register it by e.g. a timer or any virtual device for changes and do any thing provided the V8 engine implements this.johannes wrote:Hi,
I wanted to implement my own "individual home automation script" with my own callback functions and I thougt this is only possible with server-side programming, isn't it?
Almost every part/function of zway is a module. And modules are running server side.
Re: Howto start with JavaScript API
Ahh, OK!
And what's the best way to start with it? Do i need to create an own folder inside automation/modules, respectively duplicate an existing module an adapt it to my needs?
And what's the best way to start with it? Do i need to create an own folder inside automation/modules, respectively duplicate an existing module an adapt it to my needs?
Will this new module found automatically after starting the z-way server or do I have to reference it anywhere? Is this the same like an app that I can activate inside the z-wave.me GUI?called once the zway server is started
Re: Howto start with JavaScript API
I looked under existing modules for one which almost suitable for my needs and copied whole module folder to automation/userModules/ dir. You have then to adapt json file with definition (rename module), change index.js (same, rename module to avoid collisions with existing one). Probably look in other sub directories and adapt language translations. Now you have a working new module. Then you can rework it for your needs.johannes wrote:Ahh, OK!
And what's the best way to start with it? Do i need to create an own folder inside automation/modules, respectively duplicate an existing module an adapt it to my needs?
Yes, you have to activate the module in GUI. If you done with steps above and restarted z-way server you should have your module under available modules. You add it with (+). Now it is active.johannes wrote:Ahh, OK!Will this new module found automatically after starting the z-way server or do I have to reference it anywhere? Is this the same like an app that I can activate inside the z-wave.me GUI?called once the zway server is started
You have to restart server every time if you made any changes on your module.
Last edited by gsaw on 01 Sep 2016 15:43, edited 2 times in total.
Re: Howto start with JavaScript API
Thank you!
That's the way I've been looking for!
Why didn't I found any information on http://razberry.z-wave.me about this simple solution?
I really saw the forest for the trees ...
That's the way I've been looking for!
Why didn't I found any information on http://razberry.z-wave.me about this simple solution?
I really saw the forest for the trees ...
Re: Howto start with JavaScript API
Documentation is indeed rather scattered an incomplete. It has grown over time, and deserves a thourough rewrite now.johannes wrote:Thank you!
That's the way I've been looking for!
Why didn't I found any information on http://razberry.z-wave.me about this simple solution?
I really saw the forest for the trees ...
Did you happen to come across this: http://developer.z-wave.me/?uri=help ? It is more recent. It does focus more on the apps side.
Since 29-12-2016 I am no longer a moderator for this forum