This question is more related to python programming than using weewx, but I 
cant find a solution - so I hope that Tom and the other gurus can point me 
in the right direction.

I am writing a function to capture power consumption from the utility 
meter.  As part of that I am storing the cumulative energy reading for each 
archive period in the archive.  

To get the incremental energy reading between archive periods I read the 
last archive record of the cumulative energy with the "latest" function in 
weewx.tags.  Reading and printing the latest archive record of cumulative 
energy works fine - here is a snippet of the code to do that (thanks to 
Tom's answers to previous threads)

      # Create a RecordBinder, bound to the database and timestamp        
      rb = weewx.tags.RecordBinder(db_lookup, timestamp)
      print "The last cumulative electrical energy record =", 
rb.latest().cumEnergy

When I try to subtract the value for rb.latest().cumEnergy from the current 
cumulative energy reading just obtained from the meter, I get a type error.

Then I added the following code to try and figure out what the out type of 
rb.latest().cumEnergy 
is

      last_cum_energy = rb.latest().cumEnergy
      print type(last_cum_energy)

This does not help because the output of the last print command is

<class 'weewx.units.ValueHelper'>


I tried doing a float modification, but that does not work.

Any help to turn the output of the function into something I can do 
arithmetic with will be appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to