ashleypittman / mec

MyEnergi Client API and Management tools.
GNU General Public License v3.0
31 stars 26 forks source link

--show-month not working if not for the present month /get_zappi_history.py #15

Closed ChenZ86 closed 1 year ago

ChenZ86 commented 1 year ago

I just wanted to fetch data for last month and struggled to find, that he is just taking the first 2 days in the output.

python3 get_zappi_history.py --month=08 --show-month Day 1 There are 0 records Time Duration Imported Exported Generated Negative Generation Zappi diverted Zappi imported pect1 nect1 pect2 nect2 pect3 nect3


Totals 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh Day 2 There are 0 records


Totals 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh


Time Duration Imported Exported Generated Negative Generation Zappi diverted Zappi imported pect1 nect1 pect2 nect2 pect3 nect3


Totals 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh Totals 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh

So i go with the arg day=31 to make clear i want all data, but that is going to an error

python3 get_zappi_history.py --month=08 --show-month --day=31 Traceback (most recent call last): File "get_zappi_history.py", line 217, in main() File "get_zappi_history.py", line 108, in main for dom in range(1, day.tm_mday + 1): TypeError: can only concatenate str (not "int") to str

I could fix the issue by

elif show_month: all_data = [] for dom in range(1, int(day.tm_mday) + 1):

This seems to work for everything but I have to say that I am a complete python noob. Maybe it would be better to have --show-month always checking the max day of the month argument and giving this value as the day argument.