I am a script dummy however this is what I use.  Just uses cut command to get 
rid of everything after the decimal point

temp_integer=`echo $temp_float |cut -f1 -d'.'`



  ----- Original Message ----- 
  From: Paul Alfille 
  To: C. Schumann 
  Cc: [email protected] 
  Sent: Sunday, July 15, 2007 8:52 AM
  Subject: Re: [Owfs-developers] floating point to integer


  Hi Christian,

  I am well.

  There are many answers to your question.

  1. "bd" is a venerable command line program that handles real numbers.
  2. All the languanges (perl, python, php, tcl, vb, ...) handle owfs (or 
owserver) and real numbers 
  3. It would be easy to add a command line switch to round off.
  4. Adding the switch might make for some unexpected results -- suppose you 
connect to a bunch of owservers, one of which has the --roundoff flag?
  5. Should  we round off all real numbers ( temperature, humidity, voltage, 
current ) or just temperature? 

  Paul Alfille


  On 7/14/07, C.Schumann wrote:
    Dear Paul,

    hope you're fine !!
    Thanks for your great OWFS projekt !!
    I'm in touch with Christian Magnuson at the moment but we're still looking 
for a simple solution of a tricky prolblem that shouldn't be any in last 
consequece ...
    I'm working with X-WRT and the webif2 (great thing for dummies like me) on 
an ASUS 500 DL.
    I wanna use some 1wire switches depending on different temperature values 
of the sensors I've installed within my solar heating system.
    The simple script language is only working with integer values for 
comparing values but the OWFS is that brilliant giving me floating point values 
with sometimes 3 digits after the point.
    That's great for measurements but unfortunately I can't use this values for 
my script comparements. 
    Is there a simple way for getting pure integer values out of the OWFS data 
? 
    It would be great also to detect the first digit behind the decimal point 
for making a decision to round up or down the value but this only secondary ...

    Working with "owread" often gives me "data error" arguments; Think this is 
a timing depending story, I'm working with a DS9480 ?? USB interface.
    Where do I have to deklare the measurement time (may be 1000 mS); is it to 
be deklared in the OWSERVER configsheet or when calling an OWREAD instruction ?

    Sorry for bothering on this, may be old story but I didn't found any anwers 
until now in the internet; may be I can write down some notes for the OWFS 
pages later on to push this very great idea and solution ?

    Thanks for your reply at your earliest convencience !!

    Christian Schumann, germany




------------------------------------------------------------------------------


  -------------------------------------------------------------------------
  This SF.net email is sponsored by DB2 Express
  Download DB2 Express C - the FREE version of DB2 express and take
  control of your XML. No limits. Just data. Click to get it now.
  http://sourceforge.net/powerbar/db2/


------------------------------------------------------------------------------


  _______________________________________________
  Owfs-developers mailing list
  [email protected]
  https://lists.sourceforge.net/lists/listinfo/owfs-developers
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Owfs-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/owfs-developers

Reply via email to