Works perfectly. An example of the output:
Code: Select all
2008-05-10_15:31:42.16472 xpl-trig/sensor.basic: bnz-rfxcom.debian -> * - thgr228n.15[temp]=30.9
2008-05-10_15:31:42.16473 xpl-trig/sensor.basic: bnz-rfxcom.debian -> * - thgr228n.15[humidity]=30
2008-05-10_15:31:42.16473 xpl-trig/sensor.basic: bnz-rfxcom.debian -> * - thgr228n.15[battery]=90
The next step is to put the data in an SQL database. As the wireless sensor outputs data approximately every minute, I intend to store all measurements, received within the same hour, in a database and at the beginning of a new hour calculate an average from all available measurements from the previous hour. This value is then stored permanently in another table.
The callback routine used in xpl-perl would look something like this:
Code: Select all
$xpl->add_xpl_callback(id => "<i>temp</i>",
callback => \&log_temp,
filter => {
class => 'sensor',
class_type => 'basic',
device => 'thgr228n',
});
What I was wondering: Do I have to create 3 callback routines, that is one for <i>temp</i>, one for <i>humidity</i> and one for <i>battery</i>? Or is it possible to deal with all three values in 1 callback routine.
I would prefer one record per sensor in the temporary table, instead of three separate ones (whence the 3 callback routines).
Als het niet gerepareerd kan worden dan is het niet kapot!