jmhdz / currentcostgui

Automatically exported from code.google.com/p/currentcostgui
GNU General Public License v3.0
0 stars 0 forks source link

Import script fails #23

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Using the latest HEAD to test the import script i get this, both with a new or 
old database file:

$  python2  import-data-envir.py /dev/ttyUSB0 
/home/higuita/apps/currentcost/envi-test.ccd 
{'msg': {'src': u'CC128-v1.30', 'type': u'1', 'dsb': u'00479', 'ch1': {'watts': 
u'00489'}, 'time': u'02:11:57', 'sensor': u'0', 'id': u'03170', 'tmpr': 
u'27.8'}}
Traceback (most recent call last):
  File "import-data-envir.py", line 61, in <module>
    run(s, db)
  File "import-data-envir.py", line 31, in run
    w2 = int(currentcoststruct["msg"]["ch2"]["watts"])
KeyError: 'ch2'

Original issue reported on code.google.com by dmotale...@gmail.com on 29 Jun 2012 at 1:11

GoogleCodeExporter commented 9 years ago
I just look at the code and its simple, just comment out the extra channels i 
dont use:

#w2 = int(currentcoststruct["msg"]["ch2"]["watts"])
#w3 = int(currentcoststruct["msg"]["ch3"]["watts"])
#t = (w1**2 + w2**2 + w3**2 ) **0.5

and add this
t = w1

Original comment by dmotale...@gmail.com on 27 Jul 2012 at 12:48