magico13 / PyEmVue

Python Library for the Emporia Vue Energy Monitor
MIT License
185 stars 36 forks source link

Possible API changed again ? #15

Closed aviadoffer closed 3 years ago

aviadoffer commented 3 years ago

I made no changes on my side and see this now :

channel_usage_list = vue.get_devices_usage(deviceGids, None, scale=pyemvue.enums.Scale.SECOND.value, unit=pyemvue.enums.Unit.AMPHOURS.value)

File "c:\Python38-64\lib\site-packages\pyemvue-0.12.2-py3.8.egg\pyemvue\pyemvue.py", line 88, in get_devices_usage File "c:\Python38-64\lib\site-packages\pyemvue-0.12.2-py3.8.egg\pyemvue\device.py", line 97, in from_json_dictionary TypeError: argument of type 'NoneType' is not iterable

aviadoffer commented 3 years ago

same on 12.3 :
channel_usage_list = vue.get_devices_usage(deviceGids, None, scale=pyemvue.enums.Scale.SECOND.value, unit=pyemvue.enums.Unit.AMPHOURS.va lue) File "c:\Python38-64\lib\site-packages\pyemvue-0.12.3-py3.8.egg\pyemvue\pyemvue.py", line 88, in get_devices_usage File "c:\Python38-64\lib\site-packages\pyemvue-0.12.3-py3.8.egg\pyemvue\device.py", line 97, in from_json_dictionary TypeError: argument of type 'NoneType' is not iterable

magico13 commented 3 years ago

Do you have solar? Wonder if it's related to the new MainsFromGrid and MainsToGrid stuff that people with solar are seeing.

aviadoffer commented 3 years ago

I do. I don't mind sending you my code and user/pass for you to look ?

magico13 commented 3 years ago

I've got another user that I can do some solar related testing with. I won't get a chance to do some testing on this for a few hours but I can take a look tonight. I can start with just the same get_devices_usage call

aviadoffer commented 3 years ago

thanks much for looking at it. If you need my user/pass just let me know.

aviadoffer commented 3 years ago

Just a thought, it might only be a problem when solar is sending power to the grid. meaning when watt is negative during the day. so at night the problem might not be there. I didn't notice it last night but this morning as soon as watt became negative due to solar it started (I might be wrong)

magico13 commented 3 years ago

Try 0.12.4, it should basically skip if the call doesn't return a usage block. Fun thing I found while investigating this, apparently the API returns the separate amps for each leg of the mains when using the AmpHours unit but it doesn't give separate kilowatt measurements for each leg. I don't have a use for that info yet but it could be handy in the future. Doesn't look like the app surfaces that yet, much like how the app doesn't surface the MainsFromGrid and MainsToGrid.

aviadoffer commented 3 years ago

Bamm!!! you the man. works like magic. Thanks much @magico13