Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

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.

#  kasa --version
kasa, version 0.10.2
#  kasa --host powerstrip | grep current_consumption
Current consumption (current_consumption): 45.5 W
        Current consumption (current_consumption): 9.1 W
        Current consumption (current_consumption): 14.8 W
        Current consumption (current_consumption): 4.4 W
        Current consumption (current_consumption): 2.0 W
        Current consumption (current_consumption): 7.9 W
        Current consumption (current_consumption): 7.4 W
#  kasa --json --host powerstrip | grep current_consumption 
(no output). 

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!

You must be logged in to vote

Replies: 2 comments · 2 replies

Comment options

Hi,

you could try kasa --host powerstrip --json feature to see if that works. I cannot recall the exact details, but the discovery part might execute different queries than when using regular commands.

You must be logged in to vote
2 replies
@paulvonbehren
Comment options

kasa --host powerstrip --json feature gives the same response :-(

You are correct - the queries being issued seem to be different with and without --json. I was trying to get the consumption total and the consumption for each socket in a single command to get consistent info. Using 7 separate commands can take almost a minute so it's obvious the numbers don't add up if (for example) a network backup starts up during that minute. I can use the non-json info but using grep and cut to isolate the numbers is more bug-prone than json.

I was looking at some updates rytilahti was making in this area recently and I can't find them now; I'll keep looking.

@rytilahti
Comment options

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.

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.