LinuxMCE Forums
May 19, 2013, 11:35:12 am GMT-1 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Rule #1 - Be Patient - Rule #2 - Don't ask when, if you don't contribute - Rule #3 - You have coding skills - LinuxMCE's small brother is available: http://www.agocontrol.com
 
   Home   Help Search Chat Login Register  
Pages: [1]
  Print  
Author Topic: DataLogger  (Read 1669 times)
hari
Administrator
LinuxMCE God
*****
Posts: 2412



View Profile WWW
« on: February 09, 2009, 01:11:08 am »

Hi Girls and Guys,

I've written a small DataLogger plugin for the DCERouter. It is way not finished and only stores the value of co2 level change events for now:

Code:
mysql> select PK_Datapoints,EK_Device,Description,timestamp,Datapoint,Unit from Datapoints,Unit where FK_Unit=PK_Unit order by timestamp desc limit 5;
+---------------+-----------+-------------+---------------------+-----------+------+
| PK_Datapoints | EK_Device | Description | timestamp           | Datapoint | Unit |
+---------------+-----------+-------------+---------------------+-----------+------+
|           106 |       101 | CO2 level   | 2009-02-09 01:07:42 |       410 | ppm  |
|           105 |       101 | CO2 level   | 2009-02-09 01:06:42 |       416 | ppm  |
|           104 |       101 | CO2 level   | 2009-02-09 01:05:42 |       417 | ppm  |
|           103 |       101 | CO2 level   | 2009-02-09 01:04:42 |       419 | ppm  |
|           102 |       101 | CO2 level   | 2009-02-09 01:03:42 |       411 | ppm  |
+---------------+-----------+-------------+---------------------+-----------+------+
5 rows in set (0.00 sec)

DT is on schema, the code is in the 0810 branch, src/DataLogger_Plugin and src/lmce_datalog.

best regards,
Hari
Logged

rock your home - http://www.agocontrol.com home automation
maybeoneday
Guru
****
Posts: 194


View Profile
« Reply #1 on: February 09, 2009, 03:01:14 am »

Hari,
nice.....wheres the sensor ?
 419 | ppm !!

cut down on the smoking  Grin


regards
Ian
Logged
jondecker76
Alumni
wants to work for LinuxMCE
*
Posts: 763


View Profile
« Reply #2 on: February 09, 2009, 03:11:51 am »

Hari -

very neat idea for a plugin. I deally you could set it up to log any command or event. I'll have to take a look at the source!
Logged
colinjones
Alumni
LinuxMCE God
*
Posts: 3003


View Profile
« Reply #3 on: February 09, 2009, 03:20:02 am »

Hari -

very neat idea for a plugin. I deally you could set it up to log any command or event. I'll have to take a look at the source!

Indeed! I firealarm perhaps? I wonder if the CO2 concentrations during the early parts of a fire allow for positive discrimination?
Logged
darrenmason
Addicted
*
Posts: 529


View Profile
« Reply #4 on: February 09, 2009, 05:10:43 am »

Fantastic idea Hari,

Couple of questions...
1. Is it possible to register the interceptor method multiple times for each of the specific Event types that you would like to log. I am just trying to work out how that part could be made configurable.

2. Do you think that it would be possible to have the message interceptor callback to not have code specific to each event type?

Well done.

Darren
Logged
hari
Administrator
LinuxMCE God
*****
Posts: 2412



View Profile WWW
« Reply #5 on: February 09, 2009, 10:37:48 pm »

cut down on the smoking  Grin
lol.. wait, DIN allows for 1000ppm :-)

br
Logged

rock your home - http://www.agocontrol.com home automation
hari
Administrator
LinuxMCE God
*****
Posts: 2412



View Profile WWW
« Reply #6 on: February 09, 2009, 10:38:30 pm »

I'll have to take a look at the source!

at your own risk! Beware the dragon. It is in there..
Logged

rock your home - http://www.agocontrol.com home automation
hari
Administrator
LinuxMCE God
*****
Posts: 2412



View Profile WWW
« Reply #7 on: February 09, 2009, 10:43:02 pm »

Fantastic idea Hari,

Couple of questions...
1. Is it possible to register the interceptor method multiple times for each of the specific Event types that you would like to log. I am just trying to work out how that part could be made configurable.
I just register an interceptor for all events:
RegisterMsgInterceptor((MessageInterceptorFn)(&DataLogger_Plugin::ProcessEvent) ,0,0,0,0,MESSAGETYPE_EVENT,0);

ProcessEvent() then looks at pMessage->m_dwID to switch() event types.

Quote
2. Do you think that it would be possible to have the message interceptor callback to not have code specific to each event type?
as each event has different event parameters I have no idea how to do some "generic" translation...

br, Hari
Logged

rock your home - http://www.agocontrol.com home automation
maybeoneday
Guru
****
Posts: 194


View Profile
« Reply #8 on: February 10, 2009, 11:35:22 am »

Hari

"lol.. wait, DIN allows for 1000ppm :-)"


........does that allow for the popcorn to burn ocaisionally ?     Grin

Ian
Logged
bulek
Administrator
wants to work for LinuxMCE
*****
Posts: 868

Living with LMCE


View Profile
« Reply #9 on: February 11, 2009, 12:21:38 pm »

Fantastic idea Hari,

Couple of questions...
1. Is it possible to register the interceptor method multiple times for each of the specific Event types that you would like to log. I am just trying to work out how that part could be made configurable.

...
Darren
I think it can be done by just sequence of register commands.
HTH,

regards,


Bulek.
Logged

Thanks in advance,

regards,

Bulek.
darrenmason
Addicted
*
Posts: 529


View Profile
« Reply #10 on: February 11, 2009, 01:53:27 pm »

That is what I thought... so in theory it could read events from the device data and register interceptor for each one.
Logged
hari
Administrator
LinuxMCE God
*****
Posts: 2412



View Profile WWW
« Reply #11 on: February 11, 2009, 09:02:11 pm »

That is what I thought... so in theory it could read events from the device data and register interceptor for each one.

? I mean you still have to interpret the device data in code.. or do I miss something here?
« Last Edit: February 11, 2009, 09:40:12 pm by hari » Logged

rock your home - http://www.agocontrol.com home automation
krys
Addicted
*
Posts: 583


View Profile
« Reply #12 on: February 11, 2009, 09:25:49 pm »

now work on one that can log data from a ph meter and a water temp sensor and I can hook LMCE up to my saltwater aquarium
 Grin
-Krys
Logged
hari
Administrator
LinuxMCE God
*****
Posts: 2412



View Profile WWW
« Reply #13 on: February 14, 2009, 05:17:09 pm »

a few lines of php later..
Logged

rock your home - http://www.agocontrol.com home automation
totallymaxed
LinuxMCE God
****
Posts: 4310


View Profile WWW
« Reply #14 on: February 14, 2009, 08:46:52 pm »

a few lines of php later..

Love it :-)

Andrew
Logged

Andy Herron,
Convergent Home Technologies Ltd
United Kingdom

Dianemo S Now Shipping on Ubuntu 12.04LTS
Build your system on the latest Ubuntu OS Release!

Get a Dianemo S License: http://forum.linuxmce.org/index.php?topic=8880.0
iOS Orbiter: http://wiki.linuxmce.org/index.php/Dianemo_iOS_Orbiter
Follow us on Facebook: https://www.facebook.com/pages/Dianemo-Home-Automation/226019387454465

Sales & Info:
http://www.dianemo.co.uk
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!