Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for the KP200 #179

Closed
bmoregeo opened this issue Jul 26, 2019 · 23 comments
Closed

Add support for the KP200 #179

bmoregeo opened this issue Jul 26, 2019 · 23 comments

Comments

@bmoregeo
Copy link
Contributor

Kasa added a new smart outlet the kp200 - https://www.kasasmart.com/us/products/smart-plugs/kasa-smart-wifi-power-outlet-kp200

It is not being discovered automagically. I am hopeful that it uses the same api as the rest of the smart sockets.

@rytilahti
Copy link
Collaborator

Can you do a traffic capture from the discovery process (wireshark, or maybe --debug flag gives more details, too)? #175 may also be related.

@liferealized
Copy link

Here is the sysinfo dump of the KP200. Hope this helps.

defaultdict(<function SmartDevice.sys_info.<locals>.<lambda> at 0x7f0478119488>,
            {'alias': 'TP-LINK_Smart Plug_49BD',
             'child_num': 2,
             'children': [{'alias': 'Nice Redacted Name',
                           'id': '0000000000000000000000000000000000000000000',
                           'next_action': {'action': 1,
                                           'schd_sec': 75600,
                                           'type': 1},
                           'on_time': 0,
                           'state': 0},
                          {'alias': 'Nice REdacted Name 2',
                           'id': '0000000000000000000000000000000000000000001',
                           'next_action': {'type': -1},
                           'on_time': 16018,
                           'state': 1}],
             'deviceId': '0000000000000000000000000000000000000000002',
             'feature': 'TIM',
             'hwId': '0000000000000000000000000000000000000000003',
             'hw_ver': '1.0',
             'latitude_i': 000000,
             'led_off': 1,
             'longitude_i': -000000,
             'mac': '00:00:00:00:00:00',
             'mic_type': 'IOT.SMARTPLUGSWITCH',
             'model': 'KP200(US)',
             'ntc_state': 0,
             'oemId': '0000000000000000000000000000000000000000004',
             'rssi': -39,
             'sw_ver': '1.0.7 Build 190309 Rel.180427',
             'updating': 0})

@kirichkov
Copy link
Collaborator

The KP200 is reported as fully working in home assistant 0.101. Can you guys check whether yours are working?

@liferealized
Copy link

It is working with the "strip" designation

@rytilahti
Copy link
Collaborator

Thanks for your input, that's how all multisocket devices work. If you don't mind doing pyhs100 dump_discover --save and creating a PR to add the sysinfo file under pyHS100/tests/fixtures & add the device to supported devices list in README.md, that'd be great!

@pcwalden
Copy link

There is also a KP400, which looks like an outdoor variation on the KP200.

I do not have one to provide any dumps as yet. Perhaps it owuld just need a different label/ID?

https://www.kasasmart.com/us/products/smart-plugs/kasa-smart-wifi-outdoor-plug-kp400

@guice
Copy link

guice commented Dec 29, 2019

^^ Issue with KP400 brought me here. It's not being properly discovered in 0.101.x.

@trentjw
Copy link

trentjw commented Dec 30, 2019

Home Assistant release with the issue:
103.4

Last working Home Assistant release (if known):
unkown

Operating environment (Hass.io/Docker/Windows/etc.):
venv on raspberry

Integration:
TP-Link

Description of problem:
KP200 not reporting status just shows off not showing both switches for the plug both come on with switch on HA then switch slides back to off even with plug turned on can turn on plug via switch and quicky slid to off to power off switch

Also will not auto discover tp-link devices, I had to manually add TP-Link and add IP of switches in the Config file. The HS200 working fine and reports as it should, the KP200 is not, only shows it is off. It shows unavailable if I disconnect the power to it, so it kind of talks to HA

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

Traceback (if applicable):


Additional information:
KP200 Firmware: 1.0.7 Build 190309 Rel.180427

@vinmar1
Copy link

vinmar1 commented Dec 30, 2019

The KP200 is reported as fully working in home assistant 0.101. Can you guys check whether yours are working?

My KP200 came to life with the addition of the 400 in HA 101.0 and was discovered and works perfectly. It shows as a separate entity for each socket on the outlet.

@guice
Copy link

guice commented Dec 30, 2019

I'm running HA 0.103.5. KP400 does not get discovered:


Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/pyHS100/smartdevice.py", line 117, in _query_helper
    request=request,
  File "/usr/local/lib/python3.7/site-packages/pyHS100/protocol.py", line 60, in query
    length = struct.unpack(">I", chunk[0:4])[0]
struct.error: unpack requires a buffer of 4 bytes

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/pyHS100/discover.py", line 57, in discover
    devices[ip] = device_class(ip)
  File "/usr/local/lib/python3.7/site-packages/pyHS100/smartstrip.py", line 43, in __init__
    children = self.sys_info["children"]
  File "/usr/local/lib/python3.7/site-packages/pyHS100/smartdevice.py", line 186, in sys_info
    return defaultdict(lambda: None, self.get_sysinfo())
  File "/usr/local/lib/python3.7/site-packages/pyHS100/smartdevice.py", line 196, in get_sysinfo
    return self._query_helper("system", "get_sysinfo")
  File "/usr/local/lib/python3.7/site-packages/pyHS100/smartdevice.py", line 120, in _query_helper
    raise SmartDeviceException('Communication error') from ex
pyHS100.smartdevice.SmartDeviceException: Communication error

And auto-discovery is behaving so horribly, I can't reboot my device without losing ALL my TP Link devices. Getting them back is not a simple task: it takes multiple (a dozen) reboots to finally rediscovery.

It's so bad, I dread every moment I have to reboot after they (finally) get discovered.

(I suspect this exception is breaking auto-discovery)

@promiseofcake
Copy link

I'm running HA 0.103.5. KP400 does not get discovered:

Same issuse, same release, same error. Seems like there was an API change we need to fix.

@guice
Copy link

guice commented Dec 30, 2019

PS: Let me rephrase my previous comment: the Plug "is" getting discovered, but they're showing Unavailable:

Screen Shot 2019-12-30 at 4 26 41 PM

@trentjw
Copy link

trentjw commented Dec 31, 2019

The KP200 is reported as fully working in home assistant 0.101. Can you guys check whether yours are working?

My KP200 came to life with the addition of the 400 in HA 101.0 and was discovered and works perfectly. It shows as a separate entity for each socket on the outlet.

it appears yours a fluke

@vinmar1
Copy link

vinmar1 commented Dec 31, 2019

The KP200 is reported as fully working in home assistant 0.101. Can you guys check whether yours are working?

My KP200 came to life with the addition of the 400 in HA 101.0 and was discovered and works perfectly. It shows as a separate entity for each socket on the outlet.

it appears yours a fluke

Actually if you search the forum there are several others who are working just like mine is even though not officially supported, yet... call it what you may it's not the only one working sorry yours isn't. With your TP-Link auto integration not working I would say you have other issues preventing it.

Mine shows up like this, I edited entity names...

Opera Snapshot_2019-12-31_100519_intel-nuc

@guice
Copy link

guice commented Dec 31, 2019

it appears yours a fluke

I wouldn't say that. My KP200 is working just fine. My KP400, however, is not.

@hvacengi
Copy link

I found this thread yesterday because my KP400 suddenly stopped working (the log showed the same traceback listed above). I had tried removing the integration and re-adding it, and the error prevented re-adding the integration. What didn't make sense to me was that the KP400 and other kasa devices had worked perfectly until yesterday.

This morning I decided to try to re-add the integration, and for some reason everything is working again (including both outlets on the KP400). The firmware hasn't changed (it showed 1.0.10 yesterday and today). I did unplug the KP400 yesterday night because one of the two outlets stopped responding to the Kasa app too. Maybe that made a difference.

I can't imagine that the local api changes without a firmware update. But the device could be in an error state. Is it possible that the api is affected by something server side?

Also, I know that this is a thread for the KP200 (which I do not have and cannot test) but the mentions of the KP400 made me think I should include my information.

Home-assistant: 0.103.5
hassOS: 3.7
devices

  • KP400 (1.0.10) working
  • HS200 (1.0.3) working
  • HS105 (1.5.6) working

@guice
Copy link

guice commented Jan 1, 2020

An update on my situation: Kasa was having trouble communicating with my plug. So, I decided to give it a power cycle -- I unplugged/plugged the plug. After a reboot of HA:

Screen Shot 2020-01-01 at 10 02 45 AM

Connected!

Looks like there was a firmware update to the KP400 that probably didn't go according to plan. Try rebooting your outlets / plugs to see if that works.

@trentjw
Copy link

trentjw commented Jan 1, 2020

rebooted and power down so many time I lost count currently completely wiped out my HA and raspberry pi done a clean metal install auto discovery still does not work move back to v101.1 still nothing doing another clean metal install will manually add the TP link intergration once again not counting on the KP200 to take hold but at least the HS200 works as intended

@guice
Copy link

guice commented Jan 2, 2020

rebooted and power down so many time I lost count completely wiped out my HA and raspberry pi done a clean metal install

I did mean your devices -- i.e. the plugs themselves -- not just HA. You caught that, right?

I'm honestly not sure with the lack of periods. I'm sorry if that is what you tried. Everything is running together, I can't figure out what are separate statements or connected sequencing.

@trentjw
Copy link

trentjw commented Jan 3, 2020

yes everything full blown shut down breaker off to devices no more power to them. the problem was because I had to manually configure them and the instruction to add TPlink is vague on the KP200 and other multi plug devices. it only really showed lights and switches to add to Home assistant. further digging revealed the strip option, once I put the KP200 under that all is well with it. periods installed for your benefit

@rytilahti
Copy link
Collaborator

@trentjw, feel free to improve the documentation in those parts that were unclear, thanks!

@guice do you encounter the problem also when using the discovery from console?

To me it looks like that the problem is mostly on homeassistant's side and not in this project? What homeassistant displays is not very helpful, testing is much easier with the pyhs100 tool in the console. If KP200 is working fine with it, then the problem lies in the homeassistant integration.

@guice
Copy link

guice commented Jan 6, 2020

@rytilahti I had not tested or used the console commands. These errors were from within HA. After rebooting my KP400 device, connectivity started working again. Now I've completely removed KP400 as the Christmas season is now over. ;)

My KP200 is functioning, and has been functioning for a bit now. No issues there.

@rytilahti
Copy link
Collaborator

Then it is a known issue with multiplug devices and homeassistant. Considering that this issue is about adding support for KP200 in pyhs100, I'm closing this issue for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants