Log only changes

Begonnen von Lectere, 15 Mai 2013, 11:08:03

Vorheriges Thema - Nächstes Thema

Lectere

I've got a nice FHEM setup on my RASPI, with 4 FHT's (room thermostaat), 4 FHTTK's (window contact) and 4 FS20 tfk's (window contacts).

Now the FS20 TFK hardware device reports only when the window opens or closes.

But the FHTTK's report their status every 3 minutes or so. This is an example on how these devices are defined in my config:


define raamcontact.terras CUL_FHTTK 3f8a91
attr raamcontact.terras group deurraamcontacten
attr raamcontact.terras icon icoDoorClosed
attr raamcontact.terras model FHT80TF
attr raamcontact.terras room Zolder
define FileLog_raamcontact.terras FileLog ./log/raamcontact.terras-%Y.log raamcontact.terras
attr FileLog_raamcontact.terras logtype fht80tf:Window,text
attr FileLog_raamcontact.terras room Zolder
define weblink_raamcontact.terras weblink fileplot FileLog_raamcontact.terras:fht80tf:CURRENT
attr weblink_raamcontact.terras label "raamcontact.terras Min $data{min1}, Max $data{max1}, Last $data{currval1}"
attr weblink_raamcontact.terras room Plots


This generates very big log files. Because every 3 minutes items are added to the log.

I've been googling, and it seems you can use: event-on-change-reading

But I can't find a proper way to set that up for my device...

Should I:

attr raamcontact.terras event-on-change-reading state


If I do that, I get an error message...
SMSPassword redundant two-factor authentication for Netscaler, Vmware View, Cisco, Juniper, etc via SMS

http://www.smspassword.com

rudolfkoenig

The mentioned attribute is only available, if the module is converted to new user*Readings functions, which is not the case with the FHTTK module.

The module was created by Painseeker (Kai) and maintained later by klassm, but it seems to be unchanged for at least a year now.
I do not have an FHTTK myself, so I cannot test it, but if you provide me some tested patches, I can check them in.

Until this module is updated I'm afraid you have to live with about 7MB/device/year. Btw. this amount of data is only a problem if you try to visualize it on a slow machine.

Lectere

Thanks for the answer, I've misread the manual, I thought I was an attribute which was support by all devices.


So I should patch 09_CUL_FHTTK.pm?, oefff... I got a spare FHT TK, which I can send to you... :)

I run it on a raspi. So yea, it's getting a little slow because of that..

I have the same problem with the FHT room controller, but that code is 3x as long... :(
SMSPassword redundant two-factor authentication for Netscaler, Vmware View, Cisco, Juniper, etc via SMS

http://www.smspassword.com

Lectere

I think this needs to be added, but I'm not sure about handeling the parameter "event-on-update-reading", does it need to be defined somewhere?


if(event-on-update-reading($self)) {
        if(defined($defs{$self}{PREV}{STATE})) {
             if($defs{$self}{PREV}{STATE} eq $state) {
                 Log GetLogLevel($def->{NAME},4), sprintf("FHTTK skipping state $state event-on-update-reading is on", $defs{$self}{PREV}{STATE});
                 return "";
             }
         }
}


Needs to be added just after the 'similar telegram was received less than 5 secs ago' check, in the CUL_FHTTK_Parse($$) sub of the file 09_CUL_FHTTK.PM

Sorry to post this here, I'm not allowed to post in the coding section... :>
SMSPassword redundant two-factor authentication for Netscaler, Vmware View, Cisco, Juniper, etc via SMS

http://www.smspassword.com

rudolfkoenig

This code-snippet is not even syntactically correct, so I think you have to excercise further :)

As I wrote above, the module has to user the user*Readings functions for reporting changes, then this attribute will be handled automatically along with the others, see http://fhem.de/commandref.html#readingFnAttributes

The logic for this is implemented in fhem.pl

Lectere

Took me a day to figure out these 5 lines. Never did perl before :*)

So some hints to push me in the right direction are appriciated... :)

As I understand, it needs to do a call to something else instead of returning strings?
SMSPassword redundant two-factor authentication for Netscaler, Vmware View, Cisco, Juniper, etc via SMS

http://www.smspassword.com