Pepeunit Framework
INFO
Each library is a client Framework for working with Pepeunit.
The goal of the Framework is to simplify development of new Units by providing:
- core functionality for integration with Pepeunit
- utilities for managing the application main loop
Feature set
- Built‑in MQTT client:
- bulk subscription to topics based on schema.json
- bulk publishing to topics based on schema.json
- Built‑in REST client:
- download update archive
- download env.json
- download schema.json
- set state storage
- get state storage
- get a list of Units by a list of UnitNode.uuid values
- get
InputUnitNodes for a givenOutputUnitNode
- Receiving and correctly handling standard Pepeunit MQTT commands
- Sending and generating Unit state
- Functionality for working with schema.json:
- dynamic updates
- search across all four topic types
- search topics by UnitNode.uuid or by full physical topic name
- Functionality for working with env.json:
- dynamic updates
- obtaining Unit.uuid from the token
- accessing any variable as an attribute of a settings class
- Logging functionality:
- Setting a custom update
handlerfor the Unit - Setting an
InputMQTT message handler - Setting an
OutputMQTT message handler - Ability to choose multiple update strategies
aes-gcm-256encryption with16/24/32‑byte keys (for manual use)- Main application loop control:
- start
- stop
- dynamic
handlerchanges
log.json
INFO
The Unit "black box" – stores the last N log entries regardless of network state.
Logs are stored in ndjson format, where each line separated by \n is a JSON object:
ndjson
{"create_datetime":"2025-11-12T19:43:53Z","level":"Info","text":"MQTT connected successfully"}
{"create_datetime":"2025-11-12T19:44:37Z","level":"Info","text":"MQTT client connected successfully"}
{"create_datetime":"2025-11-12T22:00:10Z","level":"Info","text":"Get base MQTT command: update/pepeunit"}
{"create_datetime":"2025-11-12T22:00:10Z","level":"Warning","text":"COMPILED_FIRMWARE_LINK is missing in update payload"}
{"create_datetime":"2025-11-12T23:00:10Z","level":"Info","text":"Get base MQTT command: update/pepeunit"}
{"create_datetime":"2025-11-12T23:00:10Z","level":"Warning","text":"COMPILED_FIRMWARE_LINK is missing in update payload"}
{"create_datetime":"2025-11-12T23:08:50Z","level":"Info","text":"Get base MQTT command: update/pepeunit"}
{"create_datetime":"2025-11-12T23:08:50Z","level":"Warning","text":"COMPILED_FIRMWARE_LINK is missing in update payload"}
{"create_datetime":"2025-11-12T23:25:41Z","level":"Info","text":"MQTT client connected successfully"}
{"create_datetime":"2025-11-12T23:25:41Z","level":"Info","text":"Connected to MQTT Broker"}
{"create_datetime":"2025-11-12T23:25:42Z","level":"Info","text":"Success subscribed to 4 topics"}The buffer capacity is controlled by the PU_MAX_LOG_LENGTH environment variable; new entries are appended at the end of the file, and old entries are removed from the beginning once their index from the end exceeds PU_MAX_LOG_LENGTH.
You can access this file physically (via device ports) or via the log_sync command.