Notify if connection lost to device?

Discussions about RaZberry - Z-Wave board for Raspberry computer
Post Reply
z-wavettaja
Posts: 4
Joined: 02 Nov 2017 18:49

Notify if connection lost to device?

Post by z-wavettaja » 09 Nov 2017 22:40

Hi,

Quite new here with razberry and z-wave. I have got Fibaro universal sensor connected my existing fire and co2 alarm network and managed to create rules in alarm to ring D-Link siren and send a Pushover notifications of that kind of events. Now I would like to get some kind of notifications also if that Fibaro device connection is lost and/or is back to life.

I see these events in event log, but is there application or way to make something on those events like below?

9.11. - 18:56 | "Z-Wave device ID is back to life: 3"
8.11. - 22:20 | "Connection lost to Z-Wave device ID: 2"

I found "Event Watcher" (https://github.com/maros/Zway-EventWatc ... /README.md) application and it's documentation lists come common events that can used to trigger an action, example "security.smoke.alarm". It also says "Please refer to the documentation of the event emitting modules for details".

How can I find out, what is those events for "connection lost" and "back to life", like lines abowe?

Thanks in advance
-JK

User avatar
PoltoS
Posts: 3931
Joined: 26 Jan 2011 19:36

Re: Notify if connection lost to device?

Post by PoltoS » 12 Nov 2017 01:01

Those are emitted by ZWave module. Check for addNotification in the ZWave/index.js

z-wavettaja
Posts: 4
Joined: 02 Nov 2017 18:49

Re: Notify if connection lost to device?

Post by z-wavettaja » 22 Nov 2017 21:19

Thank you very much about hint! :)

Found below, but could not understood/find if it is doing those events "emitting". I managed to add those 2 bolded lines and now I can catch those events in Event Watcher.

---
ZWave.prototype.deadDetectionCheckDevice = function (self, nodeId) {
var values = nodeId.toString(10),
langFile = this.loadModuleLang();

if (self.zway.devices[nodeId].data.isFailed.value) {
if (self.zway.devices[nodeId].data.failureCount.value === 2) {
self.addNotification("error", langFile.err_connct + values, "connection");
this.controller.emit("device.lostconnection");
}
} else {
self.addNotification("notification", langFile.dev_btl + values, "connection");
this.controller.emit("device.connectionback");
}
};

wildling
Posts: 1
Joined: 13 Feb 2018 20:49

Re: Notify if connection lost to device?

Post by wildling » 13 Feb 2018 20:53

Thanks a lot for sharing your solution in such a detailed way, it was exactely what I needed too
kt

Post Reply