Skip to content

Conversation

@brendandburns
Copy link

This fixes #64

@brendandburns
Copy link
Author

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

Copy link
Contributor

@kirichkov kirichkov left a comment

Choose a reason for hiding this comment

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

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.

emeter_rt[field] += value

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

Choose a reason for hiding this comment

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

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.

emeter_rt: DefaultDict[int, float] = defaultdict(lambda: 0.0)
count = 0
for plug in self.children:
if not plug.has_emeter:
Copy link
Contributor

Choose a reason for hiding this comment

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

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
Copy link

ctresco commented Jun 21, 2021

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?

@Einsteinjr84
Copy link

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
Copy link

ctresco commented Sep 7, 2021 via email

@kirichkov
Copy link
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.

@rytilahti
Copy link
Member

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

@rytilahti rytilahti closed this Sep 23, 2021
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