Author Topic: DataLogger  (Read 6696 times)

hari

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 2428
    • View Profile
    • ago control
DataLogger
« 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: [Select]
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 - http://www.agocontrol.com home automation

maybeoneday

  • Guru
  • ****
  • Posts: 194
    • View Profile
Re: DataLogger
« Reply #1 on: February 09, 2009, 03:01:14 am »
Hari,
nice.....wheres the sensor ?
 419 | ppm !!

cut down on the smoking  ;D


regards
Ian

jondecker76

  • Alumni
  • wants to work for LinuxMCE
  • *
  • Posts: 763
    • View Profile
Re: DataLogger
« 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!

colinjones

  • Alumni
  • LinuxMCE God
  • *
  • Posts: 3003
    • View Profile
Re: DataLogger
« 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?

darrenmason

  • Addicted
  • *
  • Posts: 529
    • View Profile
Re: DataLogger
« 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

hari

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 2428
    • View Profile
    • ago control
Re: DataLogger
« Reply #5 on: February 09, 2009, 10:37:48 pm »
cut down on the smoking  ;D
lol.. wait, DIN allows for 1000ppm :-)

br
rock your home - http://www.agocontrol.com home automation

hari

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 2428
    • View Profile
    • ago control
Re: DataLogger
« 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..
rock your home - http://www.agocontrol.com home automation

hari

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 2428
    • View Profile
    • ago control
Re: DataLogger
« 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
rock your home - http://www.agocontrol.com home automation

maybeoneday

  • Guru
  • ****
  • Posts: 194
    • View Profile
Re: DataLogger
« 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 ?     ;D

Ian

bulek

  • Administrator
  • wants to work for LinuxMCE
  • *****
  • Posts: 909
  • Living with LMCE
    • View Profile
Re: DataLogger
« 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.
Thanks in advance,

regards,

Bulek.

darrenmason

  • Addicted
  • *
  • Posts: 529
    • View Profile
Re: DataLogger
« 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.

hari

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 2428
    • View Profile
    • ago control
Re: DataLogger
« 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 »
rock your home - http://www.agocontrol.com home automation

krys

  • Addicted
  • *
  • Posts: 583
    • View Profile
Re: DataLogger
« 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
 ;D
-Krys

hari

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 2428
    • View Profile
    • ago control
Re: DataLogger
« Reply #13 on: February 14, 2009, 05:17:09 pm »
a few lines of php later..
rock your home - http://www.agocontrol.com home automation

totallymaxed

  • LinuxMCE God
  • ****
  • Posts: 4660
  • Smart Home Consulting
    • View Profile
    • Dianemo - at home with technology
Re: DataLogger
« Reply #14 on: February 14, 2009, 08:46:52 pm »
a few lines of php later..

Love it :-)

Andrew
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 http://forum.linuxmce.org/index.php?topic=14026.0

Get RaspSqueeze-CEC or Raspbmc-CEC for Dianemo/LinuxMCE: http://wp.me/P4KgIc-5P

Facebook: https://www.facebook.com/pages/Dianemo-Home-Automation/226019387454465

http://www.dianemo.co.uk