smdn / Smdn.TPSmartHomeDevices

.NET libraries for operating Tapo/Kasa, the TP-Link smart home devices.
GNU General Public License v3.0
5 stars 1 forks source link

API stopped working #20

Closed ErrorCZE closed 1 year ago

ErrorCZE commented 1 year ago

Description

Hello, this problem is there since new firmware update.

Reproduction steps

Attempt to create any request

Expected behavior

Before the firmware update, everything worked without a problem

Actual behavior

Unhandled exception. Smdn.TPSmartHomeDevices.Tapo.TapoAuthenticationException: Failed to handshake with the device at 'http://192.168.0.64/' with error code 1003.
 ---> Smdn.TPSmartHomeDevices.Tapo.TapoErrorResponseException: Request 'handshake' failed with error code 1003. (Request URI: http://192.168.0.64/app)
   at Smdn.TPSmartHomeDevices.Tapo.TapoErrorResponseException.ThrowIfError(Uri requestUri, String requestMethod, Int32 errorCode) in /_/src/Smdn.TPSmartHomeDevices.Tapo/Smdn.TPSmartHomeDevices.Tapo/TapoErrorResponseException.cs:line 20
   at Smdn.TPSmartHomeDevices.Tapo.Protocol.TapoClient.PostPlainTextRequestAsync[TRequest,TResponse,THttpResult](TRequest request, JsonSerializerOptions jsonSerializerOptions, Func`2 processHttpResponse, CancellationToken cancellationToken) in /_/src/Smdn.TPSmartHomeDevices.Tapo/Smdn.TPSmartHomeDevices.Tapo.Protocol/TapoClient.Http.cs:line 173
   at Smdn.TPSmartHomeDevices.Tapo.Protocol.TapoClient.HandshakeAsync(ITapoCredentialIdentity identity, CancellationToken cancellationToken) in /_/src/Smdn.TPSmartHomeDevices.Tapo/Smdn.TPSmartHomeDevices.Tapo.Protocol/TapoClient.Authentication.cs:line 98
   --- End of inner exception stack trace ---
   at Smdn.TPSmartHomeDevices.Tapo.Protocol.TapoClient.HandshakeAsync(ITapoCredentialIdentity identity, CancellationToken cancellationToken) in /_/src/Smdn.TPSmartHomeDevices.Tapo/Smdn.TPSmartHomeDevices.Tapo.Protocol/TapoClient.Authentication.cs:line 121
   at Smdn.TPSmartHomeDevices.Tapo.Protocol.TapoClient.AuthenticateAsyncCore(ITapoCredentialIdentity identity, ITapoCredentialProvider credential, CancellationToken cancellationToken) in /_/src/Smdn.TPSmartHomeDevices.Tapo/Smdn.TPSmartHomeDevices.Tapo.Protocol/TapoClient.Authentication.cs:line 36
   at Smdn.TPSmartHomeDevices.Tapo.TapoDevice.EnsureSessionEstablishedAsyncCore(CancellationToken cancellationToken) in /_/src/Smdn.TPSmartHomeDevices.Tapo/Smdn.TPSmartHomeDevices.Tapo/TapoDevice.cs:line 401
   at Smdn.TPSmartHomeDevices.Tapo.TapoDevice.SendRequestAsyncCore[TRequest,TResponse,TResult](TRequest request, Func`2 composeResult, CancellationToken cancellationToken) in /_/src/Smdn.TPSmartHomeDevices.Tapo/Smdn.TPSmartHomeDevices.Tapo/TapoDevice.cs:line 474
   at Smdn.TPSmartHomeDevices.Tapo.TapoDevice.<SendRequestAsync>g__SendRequestAsyncCore|39_0[TRequest,TResponse](TRequest req, CancellationToken ct) in /_/src/Smdn.TPSmartHomeDevices.Tapo/Smdn.TPSmartHomeDevices.Tapo/TapoDevice.cs:line 430
   at Program.<>c__DisplayClass4_0.<<Main>b__3>d.MoveNext() in C:\Users\Err0CZE\source\repos\L900_Ovladani_1\Program.cs:line 102
--- End of stack trace from previous location ---
   at CommandLine.ParserResultExtensions.WithParsedAsync[T](ParserResult`1 result, Func`2 action)
   at Program.Main(String[] args) in C:\Users\Err0CZE\source\repos\L900_Ovladani_1\Program.cs:line 70
   at Program.<Main>(String[] args)

Configuration

No response

Other information

No response

smdn commented 1 year ago

Thanks for the report and sorry for the late reply!

Tapo's new firmware introduces a new protocol, and that makes it impossible to operate with the old protocol. I'm planning to port and support the new protocol.

However, it may be necessary to change the license of the package by the porting. Additionally, I am working on other tasks right now, so it may take a while.

smdn commented 1 year ago

Thank you for waiting! I have just released Smdn.TPSmartHomeDevices.Tapo 2.0.0-preview1.

This version includes support for operating with new firmware. Please update the NuGet package reference and try it! (2.0.0-preview1 is not shown on NuGet Gallery because the NuGet package server is currently degrading, but we will be able to see it soon.)

It will work without any code changes, but I recommend that you read this usage example. https://github.com/smdn/Smdn.TPSmartHomeDevices/blob/main/examples/Smdn.TPSmartHomeDevices.Tapo/SelectProtocol/Program.cs

In addition, please be aware that the license is changed to GPLv3 from this version.