All Events from EventBus in Script

Discussions about Z-Way software and Z-Wave technology in general
Raptor2k1
Posts: 14
Joined: 31 Dec 2015 20:23

All Events from EventBus in Script

Post by Raptor2k1 » 31 Dec 2015 20:39

Hi everybody!

I`m searching a way to transmit ALL Events going over Z-Way EventBus by Script to another system.

Similar to this method:
viewtopic.php?t=20849&p=53783

...but i want not only special defined Z-Wave devices. I want to send ALL Events over UDP to another system. The way in the linked scripted works, but only for devices/variables i define in the code.

Is it possible to register/bind to ALL Events? Or could Z-Way start a JS-File at every event and in this JS-Code i need to have the complete event-text in a variable and send this variable-string over the UDP socket.

Or any other solution or idea?

The goal is, to have ALL Events from Z-Way in another system WITHOUT polling for events by "/ZWaveAPI/Data/**timestamp**". All events should be send directly in REAL-TIME.

Sorry for my bad english :ugeek:

Thanks in advance and kind regards,
Chris

pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: All Events from EventBus in Script

Post by pz1 » 31 Dec 2015 20:58

Events do not happen synchronously, so you have to send them one by one as they occur.

In my UDP module, that your refer to, send I deliberately made a selection of events.

It is conceivable to send all of them, but you do need quite a bit of knowledge of the system to make such a module. Maybe either moderator PoltoS or Pofs have mentioned that in one of the posts about UDP.

Raptor2k1
Posts: 14
Joined: 31 Dec 2015 20:23

Re: All Events from EventBus in Script

Post by Raptor2k1 » 31 Dec 2015 21:28

Thanks for your answer!

It`s ok for me to send every single event "alone". But the main thing for me is to send EVERY event and not only events for devices/variables i registered/bind before.

Can i put some code in "eventemitter2.js" to send ALL events to my system? If yes, where in the file can i "grab" the complete event-text for each event and send it to my system?

Greets,
Chris

pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: All Events from EventBus in Script

Post by pz1 » 31 Dec 2015 21:37

Sorry, I have to leave the answer to the Z-Wave.me experts

bc-109
Posts: 10
Joined: 01 Jan 2016 00:11

Re: All Events from EventBus in Script

Post by bc-109 » 01 Jan 2016 00:28

Hi,

I'm having exactly the same problem. It seems very obvious to me. I read a lot of things, but I didn't find any simple solution. Z-Way is a fantastic piece of software... but I don't understand Javascript, and I don't want learn ;-)

I just need to transmit all events (with all attached data) to my software. The best way to do that would be UDP or Unix socket, but I can accept any other protocol.

The main idea is that I want to use Z-Way as a "Z-Wave modem". I just want Z-Way to forward *all* the incoming events to me. Of course, without having to manually "bind" every new Z-Wave peripheral, and without having to add Javascript code for any new variable I need.

Thank you in advance. Kind regards

Raptor2k1
Posts: 14
Joined: 31 Dec 2015 20:23

Re: All Events from EventBus in Script

Post by Raptor2k1 » 01 Jan 2016 00:55

Now we are two :ugeek: bc-109 has exactly the same problem i have... and we have both the same needings :)


I also tried this code:
viewtopic.php?f=3422&t=20816&hilit=zwav ... =10#p53478

Code: Select all

var sock = new sockets.udp();
sock.connect("192.168.1.20", 1234); 
sock.send("ZWAY_MESSAGE_XY");


this.registerBinding = function(zwayName) {
  if (zwayName != "zway") return;
  debugPrint("Binding enabled");
}

// process all active bindings
if (global.ZWave) {
  global.ZWave().forEach(this.registerBinding);

}
// and listen for future ones
global.controller.on("ZWave.register", this.registerBinding);
...but the file only run once at z-way start. I hoped this will register to ALL events...but...no :( And here is also no event-text available...


There must anywhere be a code, where all events pass through?! This place i have to know, including the event-text var, then i can put my code for UDP transmitting in the lines after and all is fine. But i`m searching and searching and nowhere i can find this code-part :?

In germany we say "guten Rutsch" :D > Happy slide to the new year :D

Greets,
Chris

remoticz
Posts: 45
Joined: 07 Oct 2015 20:35
Location: no

Re: All Events from EventBus in Script

Post by remoticz » 01 Jan 2016 11:37

Raptor2k1 wrote:Now we are two :ugeek: bc-109 has exactly the same problem i have... and we have both the same needings :)
Three, see viewtopic.php?f=3419&t=22637
v2.1.1 raspi2

bc-109
Posts: 10
Joined: 01 Jan 2016 00:11

Re: All Events from EventBus in Script

Post by bc-109 » 01 Jan 2016 13:05

Hi,

I read again lots of things, but I didn't find anything.

I'm very disappointed ! I decided to leave my previous ZWave controller, because its UDP API was limited, and didn't evolve anymore. I decided to switch to Razberry / ZWay, because I thought it was having a very rich API, with lots of possibilities (the API doc takes 100 pages). After two days of testing, I'm, again, very disappointed.

Here's what I understood. Please correct if I'm wrong :
- There's a "C" API, that can do everything. But, if I decide to use it, I'll loose all the high-end features of the Z-WAY Advanced GUI, such as monitoring, inclusion, configuration, backup, etc... In other words, I'll have to re-invent the wheel.
- There are several other API models, but none of them seem to provide easy access to Z-Wave events. To do that, I would have to learn the programming language used by the authors (Javascript), read and understand the code, then write and maintain my own event handler in JS. That's not what I would call an "API".

The problem may be very simple for any JS guru : catch any event on the Event Bus, and write it somewhere (pipe, socket, UDP, etc...) asynchronously. But this is merely undoable for people who don't (and won't) code in JS...

Thanks anybody in advance for help...

And, HNY :-) As we say on my island : "Pace e Salute" :-)

Raptor2k1
Posts: 14
Joined: 31 Dec 2015 20:23

Re: All Events from EventBus in Script

Post by Raptor2k1 » 01 Jan 2016 14:34

Happy new year everbody :)

I would also learn more JS to solve the problem, but before i have to know - if it`s possible to solve the problem by a JScript :geek:

I found some hint to TTY. If i could grab the HEX directly from the controller, it would be ok for me too. I only need ANY way to forward ALL events/infos from supported AND unsupported devices/commandclasses to another system.

Greets,
Chris

bc-109
Posts: 10
Joined: 01 Jan 2016 00:11

Re: All Events from EventBus in Script

Post by bc-109 » 01 Jan 2016 14:57

I have exactly the same needs as you :-) I'd like to use Z-Way as a Z-Wave transceiver, in the same way I'm using RFXCom for 433 MHz. I'd like Z-Way to handle all the protocol basics (network, association, interview...), and I'd like it to forward all its incoming data to me.

Z-Way automation module is fully written in JS, and there's a system of plugins/modules, for various things, all written in JS. So, I'm quite sure that's possible. The problem, for me, is that my knowledge of JS is zero. And learning it, just for that purpose, is not in the plans.

Another option would be to use directly the "C" API. Doing so, we would have full control. But this would add a lot of overhead, because we need to re-write lots of things. I'm not sure if it's possible to use Z-Way for association/network configuration ("installer mode"), then switch to "C" API for full control in everyday use.

Post Reply