Identity Example
gkapellmann opened this issue · 5 comments
Following this note: "Please note that the identity and key must be generated first using the security token on the back of the device."
Doing so with a python lib is easy, but is there a way to do this with CoAPnet?
If so, could you point me in the right direction to do so?
Thank you!
Hi,
I made this with a simple test Console App where I put all the required calls and noted the response afterwards.
You can surely do everything required with COAPnet.
You basically need to follow this instructions: home-assistant/core#10252
Instead of using the coap-client application you can send the same requests with COAPnet.
Best regards
Christian
OK, so can you help me understand this, its literally this command the one I am having trouble to interpret:
coap-client -m post -u "Client_identity" -k "SECURITY_CODE" -e '{"9090":"IDENTITY"}' "coaps://IP_ADDRESS:5684/15011/9063"
It clearly is a POST type, but I am assuming this has to happen before this:
var connectOptions = new CoapClientConnectOptionsBuilder()
.WithHost(address)
.WithPort(5684)
.WithDtlsTransportLayer(o => o.WithPreSharedKey(myID, secretKey))
.Build();
await coapClient.ConnectAsync(connectOptions, CancellationToken.None);
so my problem here is how to put in the POST the address and the "Client_identity", I am clearly miss understanding something, so my POST command so far is like this:
var request = new CoapRequestBuilder()
.WithMethod(CoapRequestMethod.Post)
.WithPath("15011/9063")
.WithQuery(GatewayCode)
.WithPayload("{"9090":"" + Identity + ""}")
.Build();
var response = await theClient.RequestAsync(request, CancellationToken.None).ConfigureAwait(false);
What am I missing?
Thank you in advance!
Hello @chkr1011 , I was wondering if you could give me some guidance here, I am still stuck with it.
Your code looks fine to me. I also used it to communicate with TRADFRI devices. My code is here:
CoAPnet/Source/CoAP.TestClient/Program.cs
Line 59 in 3433938
Right! I was locating the Query in the wrong place.
Thank you for your help!