CSharpTradFriLibrary
CSharpTradFriLibrary copied to clipboard
[BUG] - GenerateAppSecret is not working
Describe the bug For some reason, when I run these three lines:
string applicationName = "UnitTestApp";
TradfriController controller = new TradfriController("HomeTradfri", "10.0.0.16");
var appSecret = await controller.GenerateAppSecret("**************", applicationName);
I get a "Object null" exception in "GenerateAppSecret", but the exception doesnt give anything else of information.
Expected behavior I would expect to get a "TradfriAuth" object as an asnwer.
Screenshots
The problem is, the _coapClient is null.
I think the Problem sits here:
Class: TradfriController Method: GenerateAppSecret
Instead of: var ep = new DTLSClientEndPoint(authKey); ep.Start();
It should be:
var ep = new DTLSClientEndPoint(authKey);
(Implementation as CoapImplementation)._coapClient = new CoapClient(new Uri($"coaps://{_gatewayIp}"))
{
EndPoint = ep
};
ep.Start();
The equal code runs in ConnectAppKey and in ConnectPSK