obgm / libcoap

A CoAP (RFC 7252) implementation in C
Other
790 stars 422 forks source link

Communicating with Sengled Hub #358

Open rcpilotp51 opened 5 years ago

rcpilotp51 commented 5 years ago

My sengled hub is a zigbee device. I was wondering how I would communicate with it. The first issue I am having is that my hub ip cant be found by the mac address. the case says xxxx...02, the app says xxxx...02, but the network scan reveals xxxx...03 - that Ip is not working with coap commands. (that isnt for here i guess)

Lets say, once i get the the correct IP - Does anyone know if it works with DTLS? and if the "serial number" is the k "security key"

Trying to make a little touchscreen interface and this is the last piece of the puzzle so any help would be appreciated!!

THANKS

rcpilotp51 commented 5 years ago

according to this pdf it uses TLSv1.2 protocol between smart phone and the hub. Does that help?

https://deepblue.lib.umich.edu/bitstream/handle/2027.42/139706/49698122_ECE_699_Masters_Thesis_Denko_Michael.pdf?sequence=1&isAllowed=y

PAGE 11

mrdeep1 commented 5 years ago

I do not know the device, but if it is using CoAP over TLS (the article refers to TCP), you need to build a client with OpenSSL or GnuTLS support and then run

coap-client coaps+tcp://.well-known/core

and take it from there.

This will use certificates, but there should be no need to define certificates for the client.

rcpilotp51 commented 5 years ago

I would love to know more. Do you know of any examples I can try? Or maybe elaborate on the above?

mrdeep1 commented 5 years ago

Not knowing the product, I cannot help you any more. If coap-client coaps+tcp://.well-known/core works (i.e it is a device running coaps as the protocol over tcp), then that will tell you what is available on the device.

https://libcoap.net/doc/reference/4.2.0/man_coap-client.html tells you more about the coap-client.

rcpilotp51 commented 5 years ago

Thanks a lot. I will give it a try

rcpilotp51 commented 5 years ago

@mrdeep1 I guess not... the above command plus some from the resource you listed aren't returning anything. How does the Amazon Alexa app see it then? Can I just mimic that somehow?

obgm commented 5 years ago

@rcpilotp51 How do you know that the device even talks CoAP with the Alexa app? A quick web search did not reveal useful information that indicated CoAP usage. Maybe its MQTT or something?