pulzr-net-zephyr
A Zephyr module that makes an application a Pulzr Net IP device, over the MQTT 5 binding of device protocol v0.
It is an abstraction layer: it connects the device to the network and knows
nothing about what the device is. What every field, event, command and setting
means, and how it is shown, is the device type’s package (device.json,
commands.json), which reaches Pulzr Net from the device’s repository. The
firmware is built from the same files: the generator keeps only the tables the
device runs by and the package hash it reports as state.package.
- Enrollment: a P-256 key generated in PSA and kept in secure storage, a CSR, one HTTPS call with a code from the console. The certificate, the broker’s CA chain and the assertion key go into the settings subsystem. The device is known by the default interface’s MAC, the one a gateway’s LAN sees, so an application with a second port sets the default first.
- Adoption: with no code, while not enrolled, the device announces itself
to its default router:
POST https://<router>/api/announcewith its MAC, a CSR, the hardware and the package hash, every 5 minutes or the router’sretryAfter(CONFIG_PKZ_ANNOUNCE, on by default). A PulzrOS gateway lists it when the sender is that MAC on its LAN; an org admin adopts it in the console, and the next announce is answered as enrollment is. The CSR’s key stays the same until then, so only that device can use the certificate. The TLS checks no certificate: a CSR goes up and a certificate comes down. A router that refuses or has no announce is asked again after an hour. - The session: MQTT 5 over TLS with the device certificate, the EUI as
client id, the will, keepalive, and backoff across
conn_mgrinterface events. - Readings:
pkz_report()with deadband and heartbeat fromdevice.json, batched intoupmessages in CBOR. - Store and forward: every
upandeventgoes through an FCB partition the application names, so nothing is lost while the network is away.seqsurvives reboots. - Events:
pkz_event(), andPKZ_ZBUS_EVENT_LISTENER()for an application already on zbus. - State and settings: retained, republished on change. Settings live in the settings subsystem and are checked against the package’s schema.
- Commands:
PKZ_COMMAND_DEFINE(). The SDK refusesremote: falsecommands and everything while the remote switch is off, before the handler runs, and drops requests that expired. Built in:settings.set,ota.offer,cert.renew,cert.install,shell.exec. - Firmware:
ota.offerdownloads in range requests into the secondary slot, checks size and SHA-256, and leaves pre-flight, the safe reboot and confirmation to the application. MCUboot rolls back an image that is not confirmed. - The web UI:
pkz_http_authorize()takesX-Parkeze-Assertion(ES256, this device’s EUI, unexpired) or the local password, and says which. - Shell:
pkz status,pkz enroll <code>,pkz send <field> <value>. - Modbus bridge (optional): the Modbus units on the device’s own RS-485 or Modbus TCP buses, reported to Pulzr the way a PulzrOS gateway’s pulzr-edge reports its own. See Modbus bridge.
The source is at github.com/pulzar-net/pulzr-net-zephyr. Apache-2.0.