Skip to content

schema_example.json

What is the purpose of schema_example.json?

This file is a contract between the Unit Developer and Pepeunit:

  1. The Unit Developer guarantees that the Unit implements the standard Pepeunit topics listed in schema_example.json: input_base_topic and output_base_topic.
  2. The Unit Developer guarantees that input_topic and output_topic work according to the description they provide in the Readme.
  3. Pepeunit guarantees correct interaction with the standard input_base_topic and output_base_topic topics.
  4. Pepeunit guarantees that it will maintain an up‑to‑date set of UnitNodes based on input_topic and output_topic specified by the developer in schema_example.json, for every Unit version.

Structure

json
{   
    "input_base_topic": [
        "update/pepeunit",
        "env_update/pepeunit",
        "schema_update/pepeunit",
        "log_sync/pepeunit",
        "reset/pepeunit"
    ],
    "output_base_topic": [
        "state/pepeunit",
        "log/pepeunit"
    ],
    "input_topic": [
        "set_fan_state/pepeunit"
    ],
    "output_topic": [
        "current_fan_speed_percentage/pepeunit",
        "current_temp/pepeunit"
    ]
}

There are exactly 4 topic types in schema_example.json:

Topic typeDescriptionDetails
input_base_topicStandard MQTT command topics the Unit can handleStandard MQTT commands
output_base_topicStandard data publication topics where the Unit can send dataStandard MQTT state topics
input_topicInput topics of the Unit Developer. Pepeunit uses them as templates to create Input UnitNodesDeveloper topics
output_topicOutput topics of the Unit Developer. Pepeunit uses them as templates to create Output UnitNodesDeveloper topics

INFO

When using client libraries for Micropython, ESP-IDF, Golang, or Python, you can include all topics from input_base_topic and output_base_topic; they will work correctly.

If you implement interaction with Pepeunit without using these libraries, you can leave only the topics you actually need for your Unit.

WARNING

When a Unit is created or its version changes, Pepeunit automatically creates missing and removes obsolete Input and Output UnitNodes according to schema_example.json.