Digitemp as a meteohub plugin?

Requests for future functionality

Moderator: Mattk

Post Reply
Headworx
Senior Boarder
Senior Boarder
Posts: 45
Joined: Thu Sep 17, 2009 10:08 pm

Digitemp as a meteohub plugin?

Post by Headworx »

Reading the http://www.nslu2-linux.org/wiki/HowTo/A ... ireAdapter I see Digitemp package can nicely handle on wire sensors connected to the USB port.

It looks like the Digitemp writes to stdout, so it may be not that difficult to integrate it as a plugin to MeteoHub.

Any coments on this idea?

Cheers,
Headworx
User avatar
d_l
Expert Boarder
Expert Boarder
Posts: 140
Joined: Fri Mar 13, 2009 12:58 am
Location: Reno, Nevada USA
Contact:

Re:Digitemp as a meteohub plugin?

Post by d_l »

Yes, it would be great if the 1-wire sensors (iButtons) could be attached to the NSLU2 through the DS9490R

I'm already using a very small network of iButton thermochrons and thermometers with a DS9490R attached to a computer USB port.
Headworx
Senior Boarder
Senior Boarder
Posts: 45
Joined: Thu Sep 17, 2009 10:08 pm

Re:Digitemp as a meteohub plugin?

Post by Headworx »

It seems I am close to the solution.

The steps are as follows (I run MH on Sheeva):

1. install digitemp:

Code: Select all

# apt-get install digitemp
2. After plugging in the DS9490 USB to 1-wire converter, I can list (walk) the devices:

Code: Select all

# digitemp_DS2490 -w
3. If the output is correct (it should identify devices on the 1-wire bus), I initialize digitemp and store the current configuration in the .digitemprc file:

Code: Select all

# digitemp_DS2490 -a -i
4. Now I edit the output format template to make it compatible with MeteoHub:

Code: Select all

# nano .digitemprc
and changing the LOG_FORMAT line to:

Code: Select all

LOG_FORMAT "%Y%m%d%H%M%S Temp1 %.2C"
5. Now I run the digitemp:

Code: Select all

digitemp_DS2490 -q -a -d 5 -n 0
It gives me output like below:

Code: Select all

Found DS2490 device #1 at 001/005
20091128140027 Temp1 22.94
20091128140033 Temp1 22.94
20091128140037 Temp1 23.00
20091128140042 Temp1 23.00
20091128140047 Temp1 23.00
20091128140052 Temp1 23.06
Looks almost perfect, with two potential issues:
- there is the not supressed header line "Found DS2490 device #1 at 001/005" - I am not sure if MH will complain about it or not...
- there is a decimal dot in reported values (I don't know how to get rid of it and whether or not this will upset the MeteoHub)

I cannot check if this works as a MH plugin right now, because my MH system is in a distant location and I have just been experimenting with the above on my test Sheeva system (without Meteohub Installed).

May be Boris would be kind to look at it... Seems 1-wire is just around the corner...

Cheers,
Headworx
skyewright
Platinum Boarder
Platinum Boarder
Posts: 873
Joined: Fri Jan 25, 2008 6:27 pm
Location: Isle of Skye, Scotland

Re:Digitemp as a meteohub plugin?

Post by skyewright »

Headworx wrote:It seems I am close to the solution.
Excellent idea. :cheer:
LOG_FORMAT "%Y%m%d%H%M%S Temp1 %.2C"
Yes that is like the Meteohub's raw log format, but it isn't what the plug-in interface expects.

The plug-in interface expects:

a) No date & time. MH provides that itself.
b) Sensor IDs should be like t1 rather than Temp1.
c) Temp values are expected to be (actual temp)x10.

e.g.

t1 100

represents a temp sensor reporting 10.0 C.
Looks almost perfect, with two potential issues:
- there is the not supressed header line "Found DS2490 device #1 at 001/005" - I am not sure if MH will complain about it or not...
I believe that at worst the header would result in an error message line in meteohub log, i.e. not a significant problem.
there is a decimal dot in reported values (I don't know how to get rid of it and whether or not this will upset the MeteoHub)
Not a problem, provide the decimal is in the right place. My plug-in that feeds data from html template file includes a decimal. MH is quite happy to read the number as far as the decimal point and ignore the bit after that.

I think you are very close. A revised LOG_FORMAT should be easy. I'm not familiar with digitemp so I'm not sure how the x10 could be handled? At worst maybe a x10 pseudo calibration factor?

Then there is just the matter of starting digitemp as a plug-in. So far as I'm aware the plug-in station set up doesn't at present allow for command line parameters.
Headworx
Senior Boarder
Senior Boarder
Posts: 45
Joined: Thu Sep 17, 2009 10:08 pm

Re:Digitemp as a meteohub plugin?

Post by Headworx »

Yes... the revised LOG_FORMAT... considering what you said, it should be just like:

Code: Select all

LOG_FORMAT "T1 %.0C0"
then the output is like:

Code: Select all

Found DS2490 device #1 at 001/005
T1 240
T1 240
T1 240
BUT... the "24" part is rounded to zero decimal places (%.0C in the LOG_FORMAT) and then there is an arbitrary "0" added, which should work, but the accuracy is just 1 centigrade... I've looked here and there and cannot find any way to get rid of the decimal point, other than getting rid of the entire decimal part, which is good as a proof of concept, but would be a waste in a production system...
Post Reply