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

Main Menu

DataLogger

Started by hari, February 09, 2009, 01:11:08 AM

Previous topic - Next topic

hari

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:


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
rock your home - [url="http://www.agocontrol.com"]http://www.agocontrol.com[/url] home automation

maybeoneday

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

cut down on the smoking  ;D


regards
Ian

jondecker76

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!

colinjones

Quote from: jondecker76 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!

Indeed! I firealarm perhaps? I wonder if the CO2 concentrations during the early parts of a fire allow for positive discrimination?

darrenmason

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

hari

Quote from: maybeoneday on February 09, 2009, 03:01:14 AM
cut down on the smoking  ;D
lol.. wait, DIN allows for 1000ppm :-)

br
rock your home - [url="http://www.agocontrol.com"]http://www.agocontrol.com[/url] home automation

hari

Quote from: jondecker76 on February 09, 2009, 03:11:51 AM
I'll have to take a look at the source!

at your own risk! Beware the dragon. It is in there..
rock your home - [url="http://www.agocontrol.com"]http://www.agocontrol.com[/url] home automation

hari

Quote from: darrenmason 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.
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
rock your home - [url="http://www.agocontrol.com"]http://www.agocontrol.com[/url] home automation

maybeoneday

Hari

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


........does that allow for the popcorn to burn ocaisionally ?     ;D

Ian

bulek

Quote from: darrenmason 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.

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

regards,


Bulek.
Thanks in advance,

regards,

Bulek.

darrenmason

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

hari

#11
Quote from: darrenmason 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.

? I mean you still have to interpret the device data in code.. or do I miss something here?
rock your home - [url="http://www.agocontrol.com"]http://www.agocontrol.com[/url] home automation

krys

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
;D
-Krys

hari

a few lines of php later..
rock your home - [url="http://www.agocontrol.com"]http://www.agocontrol.com[/url] home automation

totallymaxed

Andy Herron,
CHT Ltd

For Dianemo/LinuxMCE consulting advice;
@herron on Twitter, totallymaxed+inquiries@gmail.com via email or PM me here.

Get Dianemo-Rpi2 ARM Licenses [url="http://forum.linuxmce.org/index.php?topic=14026.0"]http://forum.linuxmce.org/index.php?topic=14026.0[/url]

Get RaspSqueeze-CEC or Raspbmc-CEC for Dianemo/LinuxMCE: [url="http://wp.me/P4KgIc-5P"]http://wp.me/P4KgIc-5P[/url]

Facebook: [url="https://www.facebook.com/pages/Dianemo-Home-Automation/226019387454465"]https://www.facebook.com/pages/Dianemo-Home-Automation/226019387454465[/url]

[url="http://www.dianemo.co.uk"]http://www.dianemo.co.uk[/url]