CoAP Python Client
Install :
git clone https://github.com/gzsierra/pycoap/
In the file coapSender.py
, you have to edit one line:
request.opt.uri_host = '[INSERT_YOUR_SERVER_IP]'
If you want to send data to another specific endpoint, you can edit this line (DON'T FORGET TO ADD THE RESSOURCE IN SERVER SIDE) :
request.opt.uri_path = ("[INSERT_ORGANISATIONAL_FOLDER]", "[FINAL_ENDPOINT_NAME]")
python3 pycoap.py [FILENAME]
Install :
git clone https://github.com/gzsierra/pycoap/
In the file pyServer.py
, if you want to add more ressource, you have to add another line like this :
root.add_resource(('[INSERT_ORGANISATIONAL_FOLDER]', '[FINAL_ENDPOINT_NAME]'), BlockResource())
python3 pyServer.py
For installation of OpenHAB, please refer to the doc
Script needed pyGet.py
:
git clone https://github.com/gzsierra/pycoap/
Additional addon needed :
apt install openhab-addon-binding-exec
- File to edit 1
items/demo.items
, for more details, please refer to the doc :
Number coapsw1 "temp [%.1f °C]" (Temperature) {exec="<[/usr/bin/python3 /home/openhab/Documents/pycoap/pyGet.py:60000:REGEX((.*?))]"}
- File to edit 2
sitemap/demo.sitemap
:
sitemap demo label="Main Menu"
{
Frame label="CoAP" {
Text item=coapsw1
}
}
MIT