Closed ikishk closed 3 years ago
So it looks like because I use f-strings to do string formatting that requires python 3.6 or higher. I can swap all of those over to str.Format to possibly work with older python versions but I don't have time right now to do so, so you upgrading to 3.6+ might be quicker.
excellent, that helped a bit. now showing something new:
# python3.7 -m pyemvue keys.json
Logged in. Authtoken follows:
[snip]
14419 A2032A04B3************ VUE002 Vue2-1598375990
14419 None 1,2,3 1.0
14419 SXA2032A04************ WAT001 None
14419 A/C Upstairs 1 2.0
[snip- all circuits shown, seems to be multiplier]
14782 B0000C89************ SSO001 Outlet-1594685591
14782 None 1,2,3 1.0
[snip- all outlets]
680.9621060973697 kwh used month to date
680.9621060973697 kwh used total
Total usage for today in kwh:
14787 (1,2,3): 0.0 kwh
14786 (1,2,3): 1.136471128910556 kwh
14782 (1,2,3): 0.008774566296009943 kwh
14785 (1,2,3): 3.4460146545716683 kwh
14419 (1,2,3): 36.48905141789754 kwh
[snip- all circuits/outlets]
Total usage for yesterday in kwh:
14785 (1,2,3): 4.150696996170024 kwh
14419 (1,2,3): 113.06661549910652 kwh
[snip- 8 used circuits]
Traceback (most recent call last):
File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.7/dist-packages/pyemvue/__main__.py", line 86, in <module>
main()
File "/usr/local/lib/python3.7/dist-packages/pyemvue/__main__.py", line 77, in main
print(f'{chan.device_gid} ({chan.channel_num}): {usage[1]/1000} kwh')
TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'
# python3.7 --version
Python 3.7.9
seems when it hits circuit #9 is barfs on zero/none
Sounds like the library is working at least but getting bad data for that particular channel. If you were planning on using the library within something else then you should be good to go.
yup. thank you. any shortcuts to output raw json instead of depending on python formatting? ie. might be nice to have a big json dump for some ajax :)
You can always make the calls against their APIs directly. You can get the token out of PyEmVue after logging in with it and then use that for those calls. Alternatively you can use the json library to take one of the response objects and just json.dumps() it. If you wanted to call their API I have some documentation on it here https://github.com/magico13/PyEmVue/blob/master/api_docs.md
perfect and outside the box, love it :)
installed using setup.py...
tried downgrading,.. diff error:
also tried w/ python3 w/ same errors.
any ideas?