Skip to main content

#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 display

  • parameters: array of parameters. like rows to display

  • response: used when responding to request, ie returning toilet state

  • targets: message targets node with this names. special keyword ALL for all nodes in network

## set node name or/and chip_id

Message.chip_id = 'miau'
Message.node_name = 'miau_too'

### Message()

Create new instance. It is automatically filled with chip_id and node_name if not set

### Message(string_message)

Creates message and fills with received data

input = """{"protocol": "iot:1", "node": "node_name", "chip_id": "aaa", "event": "channel.on", "parameters": {"channel": 0}, "response": "", "targets": ["node-north"]}"""
msg = factory.MessageFactory.create(input)

## functions

### set(dictionary)

msg = message.Message()
msg.set({
    'event': 'event.test',
    'parameters': {
        'is_x': '1'
    }
})

Fills message with params.

### send message

s.sendto(bytes(msg), address)

### get value

msg = message.Message()
msg.set({
    'event': 'event.test',
    'parameters': {
        'is_x': '1'
    }
})

print(msg['event'])

### AES encryptor

Uses AES-CBC with hmac signing. require: pip install pycryptodome

Cryptor takes four parameters:

def __init__(self, staticiv, ivkey, datakey, passphrase):
    self.staticiv = staticiv
    self.ivkey = ivkey
    self.datakey = datakey
    self.passphrase = passphrase

Usage:

from iot_message.cryptor.aes_sha1 import Cryptor as AES

Message.add_decoder(AES(
    'abcdef2345678901', '2345678901abcdef', '0123456789abcdef', 'mypassphrase'
))

Metadata

Release files for iot-message 1.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iot-message 1.2.1
File Size Uploaded Provenance Actions
iot_message-1.2.1.tar.gz 4.8 kB Without provenance Details for iot_message-1.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for iot-message 1.2.1
File Interpreter ABI Platform Actions
iot_message-1.2.1-py2.py3-none-any.whl Python 3, Python 2 none any Details for iot_message-1.2.1-py2.py3-none-any.whl

Total release size: 13.4 kB

Release files / iot_message-1.2.1.tar.gz

Download URL iot_message-1.2.1.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
058bd111a04cf54b746d2ed2b8a5226afa3fc1e983ccd9306b96de884ce27d9e
BLAKE2b-256 checksum
How to use checksums
d4375683e0c93244085658ce793f52efce37c05552466006f1254f8fa3c8a049
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.3

Release files / iot_message-1.2.1-py2.py3-none-any.whl

Download URL iot_message-1.2.1-py2.py3-none-any.whl
Size 8.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
e3bc7f206ac869789e27cfd49a9eeee8878109f4908c4c87a87194b4250b02aa
BLAKE2b-256 checksum
How to use checksums
ee110a6cf368fca9f15fb76139d3c910fc1023e87c6d7e503be9d0a3b3cd16ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.3

Security for iot-message 1.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page