FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add support for plugs with emeters. by brendandburns · Pull Request #154 · python-kasa/python-kasa · GitHub

Repository navigation

Add support for plugs with emeters. - #154

Closed
brendandburns wants to merge 1 commit into
python-kasa:masterfrom
brendandburns:master
Closed

brendandburns wants to merge 1 commit into
python-kasa:masterfrom
brendandburns:master

Conversation

Copy link
Copy Markdown

This fixes #64

Copy link
Copy Markdown
Author

Look like linting is failing, I will try to correct it.

kirichkov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Also the linting errors need to be addressed. Otherwise it looks good to me. I'd appreciate a review from @rytilahti as I haven't looked into the HS300 code.

Comment thread kasa/smartstrip.py
emeter_rt[field] += value

# Voltage is averaged
emeter_rt['voltage_mv'] /= count

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I get the idea here, but have you ever noticed the individual plugs reporting different voltage? Normally you should get the same voltage from each child-plug.

Comment thread kasa/smartstrip.py
emeter_rt: DefaultDict[int, float] = defaultdict(lambda: 0.0)
count = 0
for plug in self.children:
if not plug.has_emeter:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Is this a real-world case, where some sockets on the same strip have and some sockets don't have emeter? If not I think this would be redundant

ctresco commented Jun 21, 2021

Copy link
Copy Markdown

Testing with changes:

import asyncio
from kasa import SmartStrip
strip = SmartStrip("172.25.100.114")
asyncio.run(strip.update())

print(strip.alias)

for plug in strip.children:
   print(f"{plug.alias}: {plug.emeter_realtime}")

Output shows same data for each plug, unlike the app.

ubuntu@ubuntu:~/working/kasa-pull$ python3 kasa-pull.py
TP-LINK_Power Strip_0C50
Hi CMH 01: {'voltage_mv': 119151, 'current_ma': 3, 'power_mw': 6, 'total_wh': 47924, 'err_code': 0}
Lo CMH 01: {'voltage_mv': 119151, 'current_ma': 3, 'power_mw': 6, 'total_wh': 47924, 'err_code': 0}
Irrigation Pump: {'voltage_mv': 119151, 'current_ma': 3, 'power_mw': 6, 'total_wh': 47924, 'err_code': 0}
Exhaust Fan: {'voltage_mv': 119151, 'current_ma': 3, 'power_mw': 6, 'total_wh': 47924, 'err_code': 0}
LED: {'voltage_mv': 119151, 'current_ma': 3, 'power_mw': 6, 'total_wh': 47924, 'err_code': 0}
Sump Pump: {'voltage_mv': 119151, 'current_ma': 3, 'power_mw': 6, 'total_wh': 47924, 'err_code': 0}

I am guessing this isn't the expected behavior?

Copy link
Copy Markdown

Just wanted to say that it would be great to see kasa officially support tplink powerstrips with emeters. I don't have mine yet, but from the looks of the last comment, it's not reporting real time data correctly.

ctresco commented Sep 7, 2021 via email

Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

Last I checked it didn't report any emeter data.

Looks like the PR has gone stale, so you'd need to manually add the changes from the PR to your local codebase to test it. Unfortunately we don't have the device at all in Europe, so people who have the device (I think it's available only in the US) should provide at minimum a json dump and do the real-world testing.

Copy link
Copy Markdown
Member

Superseded by #203, thanks for the PR though :-)

rytilahti closed this Sep 23, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HS300 Children plugs have emeter

6 participants


Back | FazBrowse Home | New Git URL