Hello,
The program monit can monitor the z-way-server.log, using 1 second increments
Thank you for your answer. But this is not the solution I need. I will use this, among other to confirm if i.E. a switch has switched. This must go fast as possible. And I will not use a extra program to make that.
The last days I looked into the /automation folder files to understand what is going on.
What we poll was the notifications from the "InbandNotifications" Modul.
This Modul use the vDev API to become the data.
And the vDev do lot of filtering.
I need a way to grab the Data before the vDev is working on it.
I think I have found the part were the vDev catch the Data (VirtualDevice.js, see picture). But my knowledge about Javascript is not enough to change my Code that it works.
My Code is simply the "InbandNotifications" code that I have changed, that the Data will be send by Websocket. It works fine, but, of course only limited of the data that I become with the old poll method.
Code: Select all
function TestModul (id, controller) {
TestModul.super_.call(this, id, controller);
}
inherits(TestModul, AutomationModule);
_module = TestModul;
TestModul.prototype.init = function () {
var self = this,
lastChanges = [];
this.writeNotification = function (vDev) {
if(!Boolean(vDev.get('permanently_hidden'))){
var devId = vDev.get('id'),
devType = vDev.get('deviceType'),
devProbeType = vDev.get('probeType'),
devName = vDev.get('metrics:title'),
scaleUnit = vDev.get('metrics:scaleTitle'),
lvl = vDev.get('metrics:level'),
eventType = function(){
if(vDev.get('metrics:probeTitle')){
return vDev.get('metrics:probeTitle').toLowerCase();
}else {
return 'status';
}
},
createItem = 0,
item, msg;
if(lastChanges.filter(function(o){
return o.id === devId;
}).length < 1){
item = {
id: devId,
l: lvl
};
lastChanges.push(item);
createItem = 1;
}
for(var i = 0; i < lastChanges.length; i++){
var cl = lastChanges[i]['l'],
cid = lastChanges[i]['id'];
if(lvl === +lvl && lvl !== (lvl|0)) {
lvl = lvl.toFixed(1);
}
if((cid === devId && cl !== lvl) || (cid === devId && cl === lvl && (createItem === 1 || devType === "toggleButton" || devType === "switchControl"))){
msg = {
devId: devId,
devType: devType,
devProbeType: devProbeType,
devName: devName,
scaleUnit: scaleUnit,
lvl: lvl,
eventType: eventType
};
ws.push("TestModul", msg);
lastChanges[i]['l'] = lvl;
createItem = 0;
}
}
}
};
self.controller.devices.on('change:metrics:level', self.writeNotification);
};
TestModul.prototype.stop = function () {
var self = this;
self.controller.devices.off('change:metrics:level', self.writeNotification);
TestModul.super_.prototype.stop.call(this);
};
TestModul.prototype.deviceCollector = function(deviceType){
var allDevices = this.controller.devices,
filteredDevices = [];
if(deviceType === 'all'){
return allDevices;
} else {
filteredDevices = allDevices.filter(function (vDev){
return vDev.get('deviceType') === deviceType;
});
return filteredDevices;
}
};
How must be the Code that If the Zwave Core (see picture) or JavaScript Core (see picture) send a message then this raw data pushed to the websocket.
Or If in the Dataholder a Value will be changed then push the device data to the websocket.
i hope, if I catch the infos in a low level that there are the Infos I.e. that the switchbinary class from the Fibaro FGR-222 has switched or the battery value and lot of other infos that the zwave devices send but only is visible in the dataholder or zway.log file.

- 123.JPG (188.79 KiB) Viewed 10428 times