You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The kasa.exe (cli.py) usage option is intended to output a comma separated list of day,minutes or month,minutes instead it outputs the raw list/dict data.
A way to fix this is with the following code in the usage function (note I added a sort that may be redundant):
if year:
click.echo(f"== For year {year.year} ==")
click.echo("Month, usage (minutes)")
usage_data = await usage.get_monthstat(year=year.year)
period="month"
elif month:
click.echo(f"== For month {month.month} of {month.year} ==")
click.echo("Day, usage (minutes)")
usage_data = await usage.get_daystat(year=month.year, month=month.month)
period="day"
else:
# Call with no argument outputs summary data and returns
click.echo("Today: %s minutes" % usage.usage_today)
click.echo("This month: %s minutes" % usage.usage_this_month)
return
# output any detailed usage data
usage_data = usage_data.get(period + "_list")
usage_data.sort(key = lambda item: item.get(period))
for usage in usage_data:
click.echo(f'{usage.get(period)}, {usage.get("time")}')
The kasa.exe (cli.py) usage option is intended to output a comma separated list of day,minutes or month,minutes instead it outputs the raw list/dict data.
A way to fix this is with the following code in the usage function (note I added a sort that may be redundant):