Custom iot:1 protocol
Project description
#IOT:1
My custom protocol for communication between devices at home.
It uses UPD and broadcast.
Messages are json strings.
## Message body:
{
"protocol": "iot:1",
"node": "Rpi-lcd-1",
"chip_id": "RpiB",
"event": "lcd.content",
"parameters: [
"content": "-(=^.^)"
],
"response": '',
"targets": [
"nodemcu-lcd-40x4"
]
}
- protocol: defines name, currently iot:1
- node: friendly node name like light-room-big or screen-one-kitchen
- chip_id: a unique device id
- event: event name like light.on or dispay
- parameters: array of parameters. like rows to display
- response: used when responding to request, ie returning toilet state
- targets: message targets by nde name. special keyword ALL for all nodes in network
## functions
### Message(node, chip_id=None)
Create instance of class. Node is a node name, chip_id if blank will be generated
### prepare_message(data=None)
Returns empty message dictionary. If data is passed it copy values from it.
### decode_message(string)
Decode json string to dict message. Validates protocol and targets.
Return None on failure
My custom protocol for communication between devices at home.
It uses UPD and broadcast.
Messages are json strings.
## Message body:
{
"protocol": "iot:1",
"node": "Rpi-lcd-1",
"chip_id": "RpiB",
"event": "lcd.content",
"parameters: [
"content": "-(=^.^)"
],
"response": '',
"targets": [
"nodemcu-lcd-40x4"
]
}
- protocol: defines name, currently iot:1
- node: friendly node name like light-room-big or screen-one-kitchen
- chip_id: a unique device id
- event: event name like light.on or dispay
- parameters: array of parameters. like rows to display
- response: used when responding to request, ie returning toilet state
- targets: message targets by nde name. special keyword ALL for all nodes in network
## functions
### Message(node, chip_id=None)
Create instance of class. Node is a node name, chip_id if blank will be generated
### prepare_message(data=None)
Returns empty message dictionary. If data is passed it copy values from it.
### decode_message(string)
Decode json string to dict message. Validates protocol and targets.
Return None on failure
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
iot_message-0.1.0.tar.gz
(2.9 kB
view hashes)
Built Distribution
Close
Hashes for iot_message-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55d7ecee3e337297035a4acbbcdce334526809446c38bbf29d1a739308a807ae |
|
MD5 | 9e72a74ee0f24ff798a7121734601633 |
|
BLAKE2b-256 | 43c7d24a0a563b430f81effb70b5a099a03832b2ba8b8bfe9519e449e2da841a |