Why not all actions in Event Log?

Discussions about Z-Way software and Z-Wave technology in general
Post Reply
SReibert
Posts: 11
Joined: 20 Jan 2016 20:35

Why not all actions in Event Log?

Post by SReibert »

Hello,

why not all actions are listed in the event log?
How decides z-way if a action will be listet in event log and when not?

We poll the event log and need the feedback from the device in the event log to confirm the status.

Regards
Steffen
viper384
Posts: 42
Joined: 18 Feb 2015 05:25

Re: Why not all actions in Event Log?

Post by viper384 »

All data the device sends should be in the z-way-server.log file, regardless if higher level layer knows what to do with it. Some devices don't send reports, in that case you may have to query frequently. For example my Aspire RF send in reports while my GE switches don't.
SReibert
Posts: 11
Joined: 20 Jan 2016 20:35

Re: Why not all actions in Event Log?

Post by SReibert »

viper384 wrote:All data the device sends should be in the z-way-server.log file, regardless if higher level layer knows what to do with it. Some devices don't send reports, in that case you may have to query frequently. For example my Aspire RF send in reports while my GE switches don't.

Thank you for your answere.

Yes in the logfile all the data are listed. But not all in the Event Log. And we use the Event Log for poll.
I.e. the switchbinary class of the Fibaro FGR-222 v2.5 Roller Shutter. It will nothing listed in the Event Log but in the Dataholder the Value will be changed and in the logfile we see the response.
Or the Battery class. The same. In Event Log nothing but I see the response in the logfile and the new Value in the Dataholder.
There are a few other Devices or Classes with the same "problem".

If I know how Z-way handle it. What rules have Zway if a event will be listed in the Event Log? Then I can react and grab the Value from the dataholder.

PS: To avoid misunderstandings. The Event Log is not the Zway Logfile.
remoticz
Posts: 45
Joined: 07 Oct 2015 20:35
Location: no

Re: Why not all actions in Event Log?

Post by remoticz »

SReibert wrote:The Event Log is not the Zway Logfile.
Please explain what and where it is. I could not find a reference to it in the Developers Manual
v2.1.1 raspi2
SReibert
Posts: 11
Joined: 20 Jan 2016 20:35

Re: Why not all actions in Event Log?

Post by SReibert »

remoticz wrote:
SReibert wrote:The Event Log is not the Zway Logfile.
Please explain what and where it is. I could not find a reference to it in the Developers Manual
Sorry it is named "Notifications" not "Events"
In the Developers Manual under Chapter 6 is only a link to the full doku:
http://docs.zwayhomeautomation.apiary.i ... tification

Code: Select all

$url ='http://'.$ZWayUser.':'.$ZWayPassword.'@'.$ZWayIP.':'.$ZWayWebPort.'/ZAutomation/api/v1/notifications since='.$timestamp;
viper384
Posts: 42
Joined: 18 Feb 2015 05:25

Re: Why not all actions in Event Log?

Post by viper384 »

I'm not sure how well developed the Zautomation Event Log for what you are trying to do. Is this a shell script? Can you use the raw data from z-way-server.log instead? The program monit can monitor the z-way-server.log, using 1 second increments, use the "check file" "if match" in monit to catch a unique event and launch your script of choice.

While running monit in 1 second increments takes a small CPU hit, that hit can be further reduced by using inotifywait to call monit when the file content changing via SIGUSR1, in a loop, removing the need for monit to check in 1 second increments, it's default is 5 minutes.
SReibert
Posts: 11
Joined: 20 Jan 2016 20:35

Re: Why not all actions in Event Log?

Post by SReibert »

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
123.JPG (188.79 KiB) Viewed 9022 times
Post Reply