current_consumtion is missing in CLI json discovery output, but present in non-json response #1540
Unanswered
paulvonbehren
asked this question in
Q&A
Replies: 2 comments 2 replies
-
Hi, you could try |
Beta Was this translation helpful? Give feedback.
2 replies
-
My previous message was after I installed version 0.10.2 and I was not
familiar with all the changes in the CLI. I reviewed the related commands
and it seems like the info I need is available in json, but not in a
single CLI statement. The value for me of using a single CLI statement is
that the values of the outlets are from the same (approximately) point of
time. The value of using JSON is avoiding the quirks of extracting bits of
info from data with undocumented, possibly unstable formatting. Considering
the trade-offs, I'm now considering separating the data collection from
creation of the dashboard; saving seven days of data and returning a weekly
average.
Here's an example using jq to extract a single field from JSON
# kasa --json --host powerstrip energy --index 2 | jq ."power_mw"
4738
The response is in milliwatts and is a typical value for this outlet
(powering a 2.5G network switch). I'll convert it to watts and use the
result from each outlet in a web dashboard for now. When it's ready, I'll
switch to the weekly average.
It looks like the usage command is related to scheduling the outlet off/on;
which I don't use.
Final verdict: the implementation is fine.
Paul
β¦On Sun, Jun 1, 2025 at 7:39β―AM Teemu R. ***@***.***> wrote:
Okay, perhaps kasa usage or kasa energy provides this? Add --help to see
what parameters and/or sub-commands they accept, but one of those should
work if you only need the energy consumption as json :-)
The person who worked on this earlier was me, but I don't currently have
any devices nor development environment at hand go check it out myself.
β
Reply to this email directly, view it on GitHub
<#1540 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABPA6QYNCL2LXLX7UBCFSHT3BLQ6JAVCNFSM6AAAAAB5Z4UZVCVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTGMZTGM4TAMY>
.
You are receiving this because you authored the thread.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using python-kasa to display home lab power consumption. My program is in bash using the kasa CLI. In particular, I need current_consumption for each outlet in an HS300 strip plus non-outlet power (USB ports, wifi radio). I was able to see all 7 values in the non-json discovery output, but all the current_consumption is missing when I add --json. I see that emeter was reworked recently so I updated to version 0.10.2; same problem.
When I search through the json output, there's no power consumption data.
Is there a bug to update the json data? Another kasa command to fetch power consumption data?
PS, the json data is great!
Beta Was this translation helpful? Give feedback.
All reactions