Coder Social home page Coder Social logo

Identity Example about coapnet HOT 5 CLOSED

chkr1011 avatar chkr1011 commented on September 23, 2024
Identity Example

from coapnet.

Comments (5)

chkr1011 avatar chkr1011 commented on September 23, 2024

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

from coapnet.

gkapellmann avatar gkapellmann commented on September 23, 2024

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!

from coapnet.

gkapellmann avatar gkapellmann commented on September 23, 2024

Hello @chkr1011 , I was wondering if you could give me some guidance here, I am still stuck with it.

from coapnet.

chkr1011 avatar chkr1011 commented on September 23, 2024

Your code looks fine to me. I also used it to communicate with TRADFRI devices. My code is here:

var connectOptions = new CoapClientConnectOptionsBuilder()

from coapnet.

gkapellmann avatar gkapellmann commented on September 23, 2024

Right! I was locating the Query in the wrong place.

Thank you for your help!

from coapnet.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.