CodeBardian / tplink-smartdevices-netstandard

.NET Standard 2.0 Library for Discovering and Operating TP-Link Smart Devices
https://codebardian.github.io/tplink-smartdevices-netstandard/
Apache License 2.0
18 stars 5 forks source link

Add new supported devices #10

Open AndrewKlasen opened 3 years ago

AndrewKlasen commented 3 years ago

Hello, how would I add support for new devices such as the TP-Link smart switches, routers, etc?

CodeBardian commented 3 years ago

Simplified, this library simulates messages of the TP-Link Device Debug Protocol (TDDP) which is mainly used across tp-links kasa product line. To add support for new devices the network traffic between the Kasa app and the smart device needs to be read out in order to get the json-commands (e.g {"system":{"set_relay_state":{"state":1}}} to turn on a plug). This can be done with wireshark and a dissector from here: https://github.com/softScheck/tplink-smartplug/blob/master/tplink-smarthome.lua

Which specific devices did you have in mind? if you meant a dimmer switch (like HS220) I think I would be able to add support for those. A network switch (like TL-SG series) can't be controlled over this protocol. And routers neither, I believe.

If you happen to have several other tp-link devices in your network you could also run a discovery with new TPLinkDiscovery().Discover() and set a breakpoint in TPLinkDiscovery.cs, line 66 and look at the content of message variable. If the devices in question respond, then message variable should not be empty and you can look at it in the json-visualizer to check for model property and see which device responded. discovery

AndrewKlasen commented 3 years ago

Thanks for the quick response. Some KASA devices I would like to use are the HS300 or KP303 power strip, LB200 KL50/60 bulbs and possibly the range extenders! If we could get support for these devices and possibly other devices in the future I’d be very happy! Do you think there is a way to add support for Kasa’s smart security cameras and the ability to watch them with audio?

AndrewKlasen commented 3 years ago

Thank you for adding multi plug support, could you add support for the wall switches like the HS200 and LB200 bulbs?

CodeBardian commented 3 years ago

I'm not sure, but from what I've read, it seems like both could already be working. The HS200 maybe works by using it just like a HS100 plug with TPLinkSmartPlug. The LB200 maybe works using it the same way as any other bulb with TPLinkSmartBulb. Could you try that?

AndrewKlasen commented 3 years ago

I could try that. I also have an issue with changing color of KL130 driving my CPU and RAM to 100 and crashing

CodeBardian commented 3 years ago

Hard to tell why that's happening. I'm not running into any issues with my KL130. From which .net implementation (.net core, .net framework, xamarin etc.) are you using this library? and which version of it?

AndrewKlasen commented 3 years ago

@CodeBardian Sorry, I'm using .net, i'm not sure if it was core or framework