Skip to main content

Config.json Schema Reference

Config.json lives at the project root and is the single source of truth for all runtime behaviour.
OSContext auto-detects it by walking up from __file__ until the file is found.


Top-level Keys

KeyTypeDefaultDescription
VERSIONstring"1.0.0"Protocol version string
assigned_iduint324294967295Device ID. 4294967295 (MAX_UINT32) is the sentinel for unassigned. Never use it as a real ID.
device_idstring"UNKNOWN"Human-readable node identifier used in sensor payloads

OpenSynaptic_Setting

High-level feature toggles.

"OpenSynaptic_Setting": {
"Server_Core": true,
"Node_Core": true,
"Client_Core": true
}
KeyTypeDefaultEffect
Server_CorebooltrueEnable server-side ID allocation and packet reception
Node_CorebooltrueEnable node-mode (data generation + transmission)
Client_CorebooltrueEnable client handshake / ID request
default_mediumstring"UDP"Fallback transport medium used by dispatch() when no medium is specified

Server_Core

Configuration for the built-in UDP server.

"Server_Core": {
"port": 8080,
"host": "0.0.0.0",
"Start_ID": 1,
"End_ID": 4294967294
}
KeyTypeDefaultDescription
portint8080UDP listen port
hoststring"0.0.0.0"Bind address
Start_IDint1First ID in the allocatable pool
End_IDint4294967294Last ID in the allocatable pool

Client_Core

Server endpoint for the client handshake.

"Client_Core": {
"server_host": "localhost",
"server_port": 8080
}

Node_Core

Node identity and sub-pool configuration.

"Node_Core": {
"node_id": "",
"template_id": "",
"pool": 0,
"Start_ID": 0,
"End_ID": 0
}

RESOURCES

All resource paths, transporter registries, and driver configurations.

"RESOURCES": {
"root": "OS_library/opensynaptic_core/",
"registry": "data/device_registry/",
"symbols": "data/symbols.json",

"transporters_status": { "<name>": true|false },
"transport_status": { "<name>": true|false },
"physical_status": { "<name>": true|false },
"application_status": { "<name>": true|false },

"transport_config": { "<name>": { ... } },
"physical_config": { "<name>": { ... } },
"application_config": { "<name>": { ... } },
"service_plugins": { "<plugin>": { ... } }
}

Sub-keys

KeyTypeDescription
rootstring (path)Library root directory (relative to project root)
registrystring (path)Device registry base directory
symbolsstring (path)Compiled OS symbol table (data/symbols.json)
prefixesstring (path)Prefix definition file (alternative to symbols)
transporters_statusmapLegacy merged mirror used by CLI/tooling compatibility. Keep lowercase keys. This map is synchronized from layer-specific maps.
transport_statusmapActive transport-layer enable map (UDP, TCP, QUIC, lwIP, uIP)
physical_statusmapActive physical-layer enable map (UART, RS-485, CAN, LoRa, Bluetooth)
application_statusmapActive application-layer enable map (MQTT, Matter, Zigbee, and app drivers)
transport_configmap-of-dictsPer-driver config dicts for transport layer
physical_configmap-of-dictsPer-driver config dicts for physical layer
application_configmap-of-dictsPer-driver config dicts for application layer
service_pluginsmap-of-dictsService plugin runtime config defaults (auto-managed by plugin registry)

service_plugins example

transporters_status compatibility note:

  • Treat application_status, transport_status, and physical_status as authoritative.
  • TransporterManager keeps transporters_status as a merged compatibility view.
"service_plugins": {
"tui": {
"enabled": true,
"mode": "manual",
"default_section": "identity",
"default_interval": 2.0
},
"web_user": {
"enabled": true,
"mode": "manual",
"host": "127.0.0.1",
"port": 8765,
"auto_start": false,
"management_enabled": true,
"auth_enabled": false,
"admin_token": "",
"read_only": false,
"writable_config_prefixes": [
"RESOURCES.service_plugins",
"RESOURCES.application_status",
"RESOURCES.transport_status",
"RESOURCES.physical_status",
"RESOURCES.application_config",
"RESOURCES.transport_config",
"RESOURCES.physical_config",
"engine_settings"
],
"expose_sections": ["identity", "transport", "plugins", "pipeline", "config", "users"],
"ui_enabled": true,
"ui_theme": "router-dark",
"ui_layout": "sidebar",
"ui_refresh_seconds": 3,
"ui_compact": false
},
"dependency_manager": {
"enabled": true,
"mode": "manual",
"auto_repair": false
},
"env_guard": {
"enabled": true,
"mode": "manual",
"auto_start": true,
"auto_install": false,
"max_history": 100,
"install_commands": [],
"resource_library_json_path": "data/env_guard/resources.json",
"status_json_path": "data/env_guard/status.json"
}
}

env_guard uses local JSON files only (no HTTP endpoint):

  • resource_library_json_path: resource download/install rules (resources.json)
  • status_json_path: runtime issues/attempt history (status.json)

physical_config examples

"physical_config": {
"uart": { "port": "UART0", "baudrate": 115200 },
"rs485": { "port": "COM1", "baudrate": 9600 },
"can": { "can_id": 291 },
"lora": { "baudrate": 9600, "timeout": 2 },
"bluetooth": { "protocol": "udp", "host": "127.0.0.1", "port": 5454, "timeout": 2.0 }
}

transport_config examples

"transport_config": {
"udp": {},
"tcp": {},
"quic": { "port": 4433, "timeout": 2.0, "insecure": true }
}

application_config examples

"application_config": {
"mqtt": {
"host": "broker.hivemq.com",
"port": 1883,
"topic": "os/sensors/raw",
"client_id": "OpenSynapticNode"
},
"matter": {
"protocol": "tcp",
"host": "127.0.0.1",
"port": 5540,
"timeout": 2.0
},
"zigbee": {
"protocol": "udp",
"host": "127.0.0.1",
"port": 6638,
"timeout": 2.0
}
}

engine_settings

Pipeline behaviour and precision controls.

"engine_settings": {
"core_backend": "pycore",
"global_secret_key": "2B",
"precision": 4,
"lock_threshold": 3,
"active_standardization": true,
"active_compression": true,
"active_collapse": true,
"sharding_level": 3,
"skip_on_error": true,
"allow_nonlinear_prefix": false,
"time_precision": 4,
"epoch_base": 0,
"use_ms": true,
"zero_copy_transport": true,
"transmit_batch": {
"enabled": true,
"max_items": 16,
"window_ms": 1.0,
"adaptive": {
"enabled": true,
"history_size": 256,
"tune_every_batches": 32,
"target_tail_ms": 30.0,
"window_ms_min": 0.5,
"window_ms_max": 6.0,
"max_items_min": 4,
"max_items_max": 64
}
}
}
KeyTypeDefaultEffect
core_backendstring"pycore"Core plugin selector used by CoreManager ("pycore" or "rscore"). Can also be overridden by OPENSYNAPTIC_CORE.
global_secret_keystring"2B"Shared secret used for packet signing
precisionint4Number of Base62 decimal places for sensor values
lock_thresholdint3Number of successful sends before switching from FULL to DIFF strategy
active_standardizationbooltrueEnable the UCUM normalisation stage
active_compressionbooltrueEnable the Base62 compression stage
active_collapsebooltrueEnable binary packet collapsing (template diff)
sharding_levelint3Registry shard depth
skip_on_errorbooltrueContinue pipeline on non-fatal errors instead of raising
allow_nonlinear_prefixboolfalseAllow non-SI prefix chains during normalisation
time_precisionint4Decimal places for timestamp compression
epoch_baseint0Epoch offset (seconds) subtracted from UNIX timestamps before compression
use_msbooltrueStore timestamps in milliseconds
zero_copy_transportbooltrueUse memoryview pass-through in the send path instead of materializing to bytes. Set to false for legacy rollback.
transmit_batch.enabledbooltrueEnable batch aggregation in transmit_fast() / transmit_batch() for rscore core
transmit_batch.max_itemsint16Flush batch immediately when queue reaches this many items
transmit_batch.window_msfloat1.0Time window before forced batch flush (milliseconds)

engine_settings.transmit_batch.adaptive

Adaptive tuner for long-tail control (p99.99) based on recent compress_ms + fuse_ms batch tails.

KeyTypeDefaultEffect
enabledbooltrueEnable automatic tuning of max_items / window_ms
history_sizeint256Number of recent batches kept for tail estimation
tune_every_batchesint32Run one tuning step after this many flushed batches
target_tail_msfloat30.0Target fused tail (compress_ms + fuse_ms) in ms
window_ms_minfloat0.5Lower bound for adaptive window
window_ms_maxfloat6.0Upper bound for adaptive window
max_items_minint4Lower bound for adaptive batch size
max_items_maxint64Upper bound for adaptive batch size

security_settings

Packet validation and session security.

"security_settings": {
"time_sync_threshold": 1000000,
"drop_on_crc16_failure": true,
"secure_session_expire_seconds": 86400
}
KeyTypeDefaultEffect
time_sync_thresholdint1000000Minimum acceptable UNIX timestamp; packets with older timestamps are treated as unsynced
drop_on_crc16_failurebooltrueDrop packets whose CRC-16 does not match
secure_session_expire_secondsint86400Session key TTL in seconds (24 h)

payload_switches

Fine-grained control over which fields are included in each encoded packet.

"payload_switches": {
"DeviceId": true,
"DeviceStatus": true,
"Timestamp": true,
"SubTemplateId": true,
"SensorId": true,
"SensorStatus": true,
"PhysicalAttribute": false,
"NormalizedValue": true,
"GeohashId": false,
"SupplementaryMessage": true,
"ResourceUrl": false
}

Setting a field to false omits it from every packet, reducing bandwidth at the cost of that data field.


storage

Logging, SQL backend, and backup configuration.

"storage": {
"directory": "os_log",
"registry_sharding": true,
"sql": {
"enabled": false,
"dialect": "sqlite",
"driver": { "path": "data/opensynaptic.db" }
},
"standard_backup": {
"enable": true,
"filename": "os_log/physics_fact_backup.jsonl"
},
"compressed_backup": {
"enable": true,
"filename": "os_log/os_protocol_backup.os"
}
}
KeyTypeDefaultEffect
directorystring"os_log"Log output directory
registry_shardingbooltrueSplit device registry across subdirectories (id[0:2]/id[2:4]/)
sql.enabledboolfalseEnable SQL export via DatabaseManager
sql.dialectstring"sqlite""sqlite", "mysql", or "postgresql"
sql.driver.pathstringSQLite file path
standard_backup.enablebooltrueAppend raw fact dicts to a JSONL file
compressed_backup.enablebooltrueAppend raw binary packets to an .os file

automation

Code generation helpers.

"automation": {
"cpp_header": "os_symbols.hpp"
}
KeyTypeDescription
cpp_headerstringOutput path for the C++ symbol header generated by the library harvester

Editing Config at Runtime

Use the CLI commands to safely modify Config.json without manual file editing:

# View a section
python -u src/main.py config-show --config Config.json --section engine_settings

# Read a specific key
python -u src/main.py config-get --config Config.json --key engine_settings.precision

# Write a typed value
python -u src/main.py config-set --config Config.json --key engine_settings.precision --value 6 --type int

# Enable a transporter
python -u src/main.py transporter-toggle --config Config.json --name udp --enable