@alteriom/mqtt-schema 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +228 -174
- package/dist/cjs/schemas/control_response.schema.json +15 -15
- package/dist/cjs/schemas/envelope.schema.json +16 -16
- package/dist/cjs/schemas/firmware_status.schema.json +17 -17
- package/dist/cjs/schemas/gateway_info.schema.json +21 -21
- package/dist/cjs/schemas/gateway_metrics.schema.json +26 -26
- package/dist/cjs/schemas/mqtt_v1_bundle.json +14 -14
- package/dist/cjs/schemas/sensor_data.schema.json +33 -33
- package/dist/cjs/schemas/sensor_heartbeat.schema.json +14 -14
- package/dist/cjs/schemas/sensor_status.schema.json +14 -14
- package/dist/cjs/schemas/validation_rules.md +44 -44
- package/dist/esm/schemas/control_response.schema.json +15 -15
- package/dist/esm/schemas/envelope.schema.json +16 -16
- package/dist/esm/schemas/firmware_status.schema.json +17 -17
- package/dist/esm/schemas/gateway_info.schema.json +21 -21
- package/dist/esm/schemas/gateway_metrics.schema.json +26 -26
- package/dist/esm/schemas/mqtt_v1_bundle.json +14 -14
- package/dist/esm/schemas/sensor_data.schema.json +33 -33
- package/dist/esm/schemas/sensor_heartbeat.schema.json +14 -14
- package/dist/esm/schemas/sensor_status.schema.json +14 -14
- package/dist/esm/schemas/validation_rules.md +44 -44
- package/package.json +10 -4
@@ -1,33 +1,33 @@
|
|
1
|
-
{
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
3
|
-
"$id": "https://schemas.alteriom.io/mqtt/v1/sensor_data.schema.json",
|
4
|
-
"title": "Sensor Data Message v1",
|
5
|
-
"allOf": [{"$ref": "envelope.schema.json"}],
|
6
|
-
"type": "object",
|
7
|
-
"required": ["sensors"],
|
8
|
-
"properties": {
|
9
|
-
"sensors": {
|
10
|
-
"type": "object",
|
11
|
-
"minProperties": 1,
|
12
|
-
"additionalProperties": {
|
13
|
-
"type": "object",
|
14
|
-
"required": ["value"],
|
15
|
-
"properties": {
|
16
|
-
"value": {"type": ["number", "integer"]},
|
17
|
-
"unit": {"type": "string"},
|
18
|
-
"raw_value": {"type": ["number", "integer"]},
|
19
|
-
"calibrated_value": {"type": ["number", "integer"]},
|
20
|
-
"quality_score": {"type": "number", "minimum": 0, "maximum": 1},
|
21
|
-
"name": {"type": "string"},
|
22
|
-
"location": {"type": "string"},
|
23
|
-
"additional_data": {"type": "object"}
|
24
|
-
},
|
25
|
-
"additionalProperties": false
|
26
|
-
}
|
27
|
-
},
|
28
|
-
"battery_level": {"type": "integer", "minimum": 0, "maximum": 100},
|
29
|
-
"signal_strength": {"type": "integer", "minimum": -200, "maximum": 0},
|
30
|
-
"additional": {"type": "object"}
|
31
|
-
},
|
32
|
-
"additionalProperties": true
|
33
|
-
}
|
1
|
+
{
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
3
|
+
"$id": "https://schemas.alteriom.io/mqtt/v1/sensor_data.schema.json",
|
4
|
+
"title": "Sensor Data Message v1",
|
5
|
+
"allOf": [{"$ref": "envelope.schema.json"}],
|
6
|
+
"type": "object",
|
7
|
+
"required": ["sensors"],
|
8
|
+
"properties": {
|
9
|
+
"sensors": {
|
10
|
+
"type": "object",
|
11
|
+
"minProperties": 1,
|
12
|
+
"additionalProperties": {
|
13
|
+
"type": "object",
|
14
|
+
"required": ["value"],
|
15
|
+
"properties": {
|
16
|
+
"value": {"type": ["number", "integer"]},
|
17
|
+
"unit": {"type": "string"},
|
18
|
+
"raw_value": {"type": ["number", "integer"]},
|
19
|
+
"calibrated_value": {"type": ["number", "integer"]},
|
20
|
+
"quality_score": {"type": "number", "minimum": 0, "maximum": 1},
|
21
|
+
"name": {"type": "string"},
|
22
|
+
"location": {"type": "string"},
|
23
|
+
"additional_data": {"type": "object"}
|
24
|
+
},
|
25
|
+
"additionalProperties": false
|
26
|
+
}
|
27
|
+
},
|
28
|
+
"battery_level": {"type": "integer", "minimum": 0, "maximum": 100},
|
29
|
+
"signal_strength": {"type": "integer", "minimum": -200, "maximum": 0},
|
30
|
+
"additional": {"type": "object"}
|
31
|
+
},
|
32
|
+
"additionalProperties": true
|
33
|
+
}
|
@@ -1,14 +1,14 @@
|
|
1
|
-
{
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
3
|
-
"$id": "https://schemas.alteriom.io/mqtt/v1/sensor_heartbeat.schema.json",
|
4
|
-
"title": "Sensor Heartbeat v1",
|
5
|
-
"type": "object",
|
6
|
-
"required": ["schema_version", "device_id", "device_type", "timestamp"],
|
7
|
-
"properties": {
|
8
|
-
"schema_version": {"type": "integer", "const": 1},
|
9
|
-
"device_id": {"type": "string", "minLength": 1, "maxLength": 64, "pattern": "^[A-Za-z0-9_-]+$"},
|
10
|
-
"device_type": {"type": "string", "enum": ["sensor", "gateway"]},
|
11
|
-
"timestamp": {"type": "string", "format": "date-time"}
|
12
|
-
},
|
13
|
-
"additionalProperties": true
|
14
|
-
}
|
1
|
+
{
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
3
|
+
"$id": "https://schemas.alteriom.io/mqtt/v1/sensor_heartbeat.schema.json",
|
4
|
+
"title": "Sensor Heartbeat v1",
|
5
|
+
"type": "object",
|
6
|
+
"required": ["schema_version", "device_id", "device_type", "timestamp"],
|
7
|
+
"properties": {
|
8
|
+
"schema_version": {"type": "integer", "const": 1},
|
9
|
+
"device_id": {"type": "string", "minLength": 1, "maxLength": 64, "pattern": "^[A-Za-z0-9_-]+$"},
|
10
|
+
"device_type": {"type": "string", "enum": ["sensor", "gateway"]},
|
11
|
+
"timestamp": {"type": "string", "format": "date-time"}
|
12
|
+
},
|
13
|
+
"additionalProperties": true
|
14
|
+
}
|
@@ -1,14 +1,14 @@
|
|
1
|
-
{
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
3
|
-
"$id": "https://schemas.alteriom.io/mqtt/v1/sensor_status.schema.json",
|
4
|
-
"title": "Sensor Status v1",
|
5
|
-
"allOf": [{"$ref": "envelope.schema.json"}],
|
6
|
-
"type": "object",
|
7
|
-
"required": ["status"],
|
8
|
-
"properties": {
|
9
|
-
"status": {"type": "string", "enum": ["online", "offline", "updating", "error"]},
|
10
|
-
"battery_level": {"type": "integer", "minimum": 0, "maximum": 100},
|
11
|
-
"signal_strength": {"type": "integer", "minimum": -200, "maximum": 0}
|
12
|
-
},
|
13
|
-
"additionalProperties": true
|
14
|
-
}
|
1
|
+
{
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
3
|
+
"$id": "https://schemas.alteriom.io/mqtt/v1/sensor_status.schema.json",
|
4
|
+
"title": "Sensor Status v1",
|
5
|
+
"allOf": [{"$ref": "envelope.schema.json"}],
|
6
|
+
"type": "object",
|
7
|
+
"required": ["status"],
|
8
|
+
"properties": {
|
9
|
+
"status": {"type": "string", "enum": ["online", "offline", "updating", "error"]},
|
10
|
+
"battery_level": {"type": "integer", "minimum": 0, "maximum": 100},
|
11
|
+
"signal_strength": {"type": "integer", "minimum": -200, "maximum": 0}
|
12
|
+
},
|
13
|
+
"additionalProperties": true
|
14
|
+
}
|
@@ -1,44 +1,44 @@
|
|
1
|
-
# Validation Rules (Operational Layer)
|
2
|
-
|
3
|
-
This file captures dynamic / contextual validation that is OUTSIDE pure structural JSON Schema constraints.
|
4
|
-
|
5
|
-
## Timing & Rate
|
6
|
-
- Future timestamp drift: reject if > 5s ahead of server reference.
|
7
|
-
- Heartbeat interval recommended 30s; backend may rate-limit <10s.
|
8
|
-
- Sensor data soft min 30s unless negotiated high-frequency mode.
|
9
|
-
|
10
|
-
## Heartbeat Firmware Version Exception
|
11
|
-
- Only heartbeat topic may omit `firmware_version` when unchanged.
|
12
|
-
- All other topics require the field.
|
13
|
-
|
14
|
-
## Forbidden / Drop Conditions
|
15
|
-
| Reason | Condition |
|
16
|
-
|--------|----------|
|
17
|
-
| missing_fields | Required base fields absent (heartbeat firmware exception applied). |
|
18
|
-
| invalid_timestamp | Non-ISO 8601 / unparseable timestamp. |
|
19
|
-
| deprecated_keys | Usage of forbidden alias keys (f, fw, ver, version, u, up, rssi). |
|
20
|
-
| invalid_sensor_entry | Sensor object missing `value` key. |
|
21
|
-
| future_drift | Timestamp too far in future (>5s). |
|
22
|
-
| out_of_range | battery_level not 0-100 OR quality_score not 0-1. |
|
23
|
-
| invalid_numeric | Non-numeric where numeric expected. |
|
24
|
-
| spec_violation | Generic fallback after failed internal validation. |
|
25
|
-
|
26
|
-
## Sensor Object Semantics
|
27
|
-
- `value` REQUIRED.
|
28
|
-
- `unit`, `raw_value`, `calibrated_value`, `quality_score`, `name`, `location`, `additional_data` OPTIONAL.
|
29
|
-
- If `quality_score` present must be 0.0–1.0 inclusive.
|
30
|
-
|
31
|
-
## Metrics Constraints
|
32
|
-
- Gateway metrics MUST appear under `metrics` (never at top-level).
|
33
|
-
- Required minimal metric: `uptime_s`.
|
34
|
-
|
35
|
-
## Firmware Update Status
|
36
|
-
- `status` must be one of: pending, downloading, flashing, verifying, rebooting, completed, failed.
|
37
|
-
- `progress_pct` (if present) must be 0–100.
|
38
|
-
|
39
|
-
## Extensibility
|
40
|
-
- Unknown top-level keys tolerated (future evolution) except if they collide with any deprecated alias or reserved future keys announced in CHANGELOG.
|
41
|
-
|
42
|
-
## Versioning
|
43
|
-
- Current `schema_version`: 1
|
44
|
-
- Additions remain optional; breaking changes introduce new schema set.
|
1
|
+
# Validation Rules (Operational Layer)
|
2
|
+
|
3
|
+
This file captures dynamic / contextual validation that is OUTSIDE pure structural JSON Schema constraints.
|
4
|
+
|
5
|
+
## Timing & Rate
|
6
|
+
- Future timestamp drift: reject if > 5s ahead of server reference.
|
7
|
+
- Heartbeat interval recommended 30s; backend may rate-limit <10s.
|
8
|
+
- Sensor data soft min 30s unless negotiated high-frequency mode.
|
9
|
+
|
10
|
+
## Heartbeat Firmware Version Exception
|
11
|
+
- Only heartbeat topic may omit `firmware_version` when unchanged.
|
12
|
+
- All other topics require the field.
|
13
|
+
|
14
|
+
## Forbidden / Drop Conditions
|
15
|
+
| Reason | Condition |
|
16
|
+
|--------|----------|
|
17
|
+
| missing_fields | Required base fields absent (heartbeat firmware exception applied). |
|
18
|
+
| invalid_timestamp | Non-ISO 8601 / unparseable timestamp. |
|
19
|
+
| deprecated_keys | Usage of forbidden alias keys (f, fw, ver, version, u, up, rssi). |
|
20
|
+
| invalid_sensor_entry | Sensor object missing `value` key. |
|
21
|
+
| future_drift | Timestamp too far in future (>5s). |
|
22
|
+
| out_of_range | battery_level not 0-100 OR quality_score not 0-1. |
|
23
|
+
| invalid_numeric | Non-numeric where numeric expected. |
|
24
|
+
| spec_violation | Generic fallback after failed internal validation. |
|
25
|
+
|
26
|
+
## Sensor Object Semantics
|
27
|
+
- `value` REQUIRED.
|
28
|
+
- `unit`, `raw_value`, `calibrated_value`, `quality_score`, `name`, `location`, `additional_data` OPTIONAL.
|
29
|
+
- If `quality_score` present must be 0.0–1.0 inclusive.
|
30
|
+
|
31
|
+
## Metrics Constraints
|
32
|
+
- Gateway metrics MUST appear under `metrics` (never at top-level).
|
33
|
+
- Required minimal metric: `uptime_s`.
|
34
|
+
|
35
|
+
## Firmware Update Status
|
36
|
+
- `status` must be one of: pending, downloading, flashing, verifying, rebooting, completed, failed.
|
37
|
+
- `progress_pct` (if present) must be 0–100.
|
38
|
+
|
39
|
+
## Extensibility
|
40
|
+
- Unknown top-level keys tolerated (future evolution) except if they collide with any deprecated alias or reserved future keys announced in CHANGELOG.
|
41
|
+
|
42
|
+
## Versioning
|
43
|
+
- Current `schema_version`: 1
|
44
|
+
- Additions remain optional; breaking changes introduce new schema set.
|
@@ -1,15 +1,15 @@
|
|
1
|
-
{
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
3
|
-
"$id": "https://schemas.alteriom.io/mqtt/v1/control_response.schema.json",
|
4
|
-
"title": "Control / Command Response v1",
|
5
|
-
"allOf": [{"$ref": "envelope.schema.json"}],
|
6
|
-
"type": "object",
|
7
|
-
"required": ["status"],
|
8
|
-
"properties": {
|
9
|
-
"command": {"type": "string"},
|
10
|
-
"status": {"type": "string", "enum": ["ok", "error"]},
|
11
|
-
"message": {"type": "string"},
|
12
|
-
"result": {"type": ["object", "array", "string", "number", "boolean", "null"]}
|
13
|
-
},
|
14
|
-
"additionalProperties": true
|
15
|
-
}
|
1
|
+
{
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
3
|
+
"$id": "https://schemas.alteriom.io/mqtt/v1/control_response.schema.json",
|
4
|
+
"title": "Control / Command Response v1",
|
5
|
+
"allOf": [{"$ref": "envelope.schema.json"}],
|
6
|
+
"type": "object",
|
7
|
+
"required": ["status"],
|
8
|
+
"properties": {
|
9
|
+
"command": {"type": "string"},
|
10
|
+
"status": {"type": "string", "enum": ["ok", "error"]},
|
11
|
+
"message": {"type": "string"},
|
12
|
+
"result": {"type": ["object", "array", "string", "number", "boolean", "null"]}
|
13
|
+
},
|
14
|
+
"additionalProperties": true
|
15
|
+
}
|
@@ -1,16 +1,16 @@
|
|
1
|
-
{
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
3
|
-
"$id": "https://schemas.alteriom.io/mqtt/v1/envelope.schema.json",
|
4
|
-
"title": "Alteriom MQTT Base Envelope v1",
|
5
|
-
"type": "object",
|
6
|
-
"required": ["schema_version", "device_id", "device_type", "timestamp", "firmware_version"],
|
7
|
-
"properties": {
|
8
|
-
"schema_version": {"type": "integer", "const": 1},
|
9
|
-
"device_id": {"type": "string", "minLength": 1, "maxLength": 64, "pattern": "^[A-Za-z0-9_-]+$"},
|
10
|
-
"device_type": {"type": "string", "enum": ["sensor", "gateway"]},
|
11
|
-
"timestamp": {"type": "string", "format": "date-time"},
|
12
|
-
"firmware_version": {"type": "string", "minLength": 1, "maxLength": 40},
|
13
|
-
"hardware_version": {"type": "string", "maxLength": 80}
|
14
|
-
},
|
15
|
-
"additionalProperties": true
|
16
|
-
}
|
1
|
+
{
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
3
|
+
"$id": "https://schemas.alteriom.io/mqtt/v1/envelope.schema.json",
|
4
|
+
"title": "Alteriom MQTT Base Envelope v1",
|
5
|
+
"type": "object",
|
6
|
+
"required": ["schema_version", "device_id", "device_type", "timestamp", "firmware_version"],
|
7
|
+
"properties": {
|
8
|
+
"schema_version": {"type": "integer", "const": 1},
|
9
|
+
"device_id": {"type": "string", "minLength": 1, "maxLength": 64, "pattern": "^[A-Za-z0-9_-]+$"},
|
10
|
+
"device_type": {"type": "string", "enum": ["sensor", "gateway"]},
|
11
|
+
"timestamp": {"type": "string", "format": "date-time"},
|
12
|
+
"firmware_version": {"type": "string", "minLength": 1, "maxLength": 40},
|
13
|
+
"hardware_version": {"type": "string", "maxLength": 80}
|
14
|
+
},
|
15
|
+
"additionalProperties": true
|
16
|
+
}
|
@@ -1,17 +1,17 @@
|
|
1
|
-
{
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
3
|
-
"$id": "https://schemas.alteriom.io/mqtt/v1/firmware_status.schema.json",
|
4
|
-
"title": "Firmware Update Status v1",
|
5
|
-
"allOf": [{"$ref": "envelope.schema.json"}],
|
6
|
-
"type": "object",
|
7
|
-
"required": ["status"],
|
8
|
-
"properties": {
|
9
|
-
"event": {"type": "string"},
|
10
|
-
"from_version": {"type": "string"},
|
11
|
-
"to_version": {"type": "string"},
|
12
|
-
"status": {"type": "string", "enum": ["pending", "downloading", "flashing", "verifying", "rebooting", "completed", "failed"]},
|
13
|
-
"progress_pct": {"type": "number", "minimum": 0, "maximum": 100},
|
14
|
-
"error": {"type": ["string", "null"]}
|
15
|
-
},
|
16
|
-
"additionalProperties": true
|
17
|
-
}
|
1
|
+
{
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
3
|
+
"$id": "https://schemas.alteriom.io/mqtt/v1/firmware_status.schema.json",
|
4
|
+
"title": "Firmware Update Status v1",
|
5
|
+
"allOf": [{"$ref": "envelope.schema.json"}],
|
6
|
+
"type": "object",
|
7
|
+
"required": ["status"],
|
8
|
+
"properties": {
|
9
|
+
"event": {"type": "string"},
|
10
|
+
"from_version": {"type": "string"},
|
11
|
+
"to_version": {"type": "string"},
|
12
|
+
"status": {"type": "string", "enum": ["pending", "downloading", "flashing", "verifying", "rebooting", "completed", "failed"]},
|
13
|
+
"progress_pct": {"type": "number", "minimum": 0, "maximum": 100},
|
14
|
+
"error": {"type": ["string", "null"]}
|
15
|
+
},
|
16
|
+
"additionalProperties": true
|
17
|
+
}
|
@@ -1,21 +1,21 @@
|
|
1
|
-
{
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
3
|
-
"$id": "https://schemas.alteriom.io/mqtt/v1/gateway_info.schema.json",
|
4
|
-
"title": "Gateway Info v1",
|
5
|
-
"allOf": [{"$ref": "envelope.schema.json"}],
|
6
|
-
"type": "object",
|
7
|
-
"properties": {
|
8
|
-
"mac_address": {"type": "string", "pattern": "^[0-9A-Fa-f:]{17}$"},
|
9
|
-
"ip_address": {"type": "string", "format": "ipv4"},
|
10
|
-
"capabilities": {
|
11
|
-
"type": "object",
|
12
|
-
"properties": {
|
13
|
-
"max_nodes": {"type": "integer", "minimum": 0},
|
14
|
-
"supports_mesh": {"type": "boolean"},
|
15
|
-
"firmware_update": {"type": "boolean"}
|
16
|
-
},
|
17
|
-
"additionalProperties": true
|
18
|
-
}
|
19
|
-
},
|
20
|
-
"additionalProperties": true
|
21
|
-
}
|
1
|
+
{
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
3
|
+
"$id": "https://schemas.alteriom.io/mqtt/v1/gateway_info.schema.json",
|
4
|
+
"title": "Gateway Info v1",
|
5
|
+
"allOf": [{"$ref": "envelope.schema.json"}],
|
6
|
+
"type": "object",
|
7
|
+
"properties": {
|
8
|
+
"mac_address": {"type": "string", "pattern": "^[0-9A-Fa-f:]{17}$"},
|
9
|
+
"ip_address": {"type": "string", "format": "ipv4"},
|
10
|
+
"capabilities": {
|
11
|
+
"type": "object",
|
12
|
+
"properties": {
|
13
|
+
"max_nodes": {"type": "integer", "minimum": 0},
|
14
|
+
"supports_mesh": {"type": "boolean"},
|
15
|
+
"firmware_update": {"type": "boolean"}
|
16
|
+
},
|
17
|
+
"additionalProperties": true
|
18
|
+
}
|
19
|
+
},
|
20
|
+
"additionalProperties": true
|
21
|
+
}
|
@@ -1,26 +1,26 @@
|
|
1
|
-
{
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
3
|
-
"$id": "https://schemas.alteriom.io/mqtt/v1/gateway_metrics.schema.json",
|
4
|
-
"title": "Gateway Metrics v1",
|
5
|
-
"allOf": [{"$ref": "envelope.schema.json"}],
|
6
|
-
"type": "object",
|
7
|
-
"required": ["metrics"],
|
8
|
-
"properties": {
|
9
|
-
"metrics": {
|
10
|
-
"type": "object",
|
11
|
-
"required": ["uptime_s"],
|
12
|
-
"properties": {
|
13
|
-
"uptime_s": {"type": "integer", "minimum": 0},
|
14
|
-
"cpu_usage_pct": {"type": "number", "minimum": 0, "maximum": 100},
|
15
|
-
"memory_usage_pct": {"type": "number", "minimum": 0, "maximum": 100},
|
16
|
-
"temperature_c": {"type": "number"},
|
17
|
-
"connected_devices": {"type": "integer", "minimum": 0},
|
18
|
-
"mesh_nodes": {"type": "integer", "minimum": 0},
|
19
|
-
"packet_loss_pct": {"type": "number", "minimum": 0, "maximum": 100},
|
20
|
-
"data_throughput_kbps": {"type": "number", "minimum": 0}
|
21
|
-
},
|
22
|
-
"additionalProperties": true
|
23
|
-
}
|
24
|
-
},
|
25
|
-
"additionalProperties": true
|
26
|
-
}
|
1
|
+
{
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
3
|
+
"$id": "https://schemas.alteriom.io/mqtt/v1/gateway_metrics.schema.json",
|
4
|
+
"title": "Gateway Metrics v1",
|
5
|
+
"allOf": [{"$ref": "envelope.schema.json"}],
|
6
|
+
"type": "object",
|
7
|
+
"required": ["metrics"],
|
8
|
+
"properties": {
|
9
|
+
"metrics": {
|
10
|
+
"type": "object",
|
11
|
+
"required": ["uptime_s"],
|
12
|
+
"properties": {
|
13
|
+
"uptime_s": {"type": "integer", "minimum": 0},
|
14
|
+
"cpu_usage_pct": {"type": "number", "minimum": 0, "maximum": 100},
|
15
|
+
"memory_usage_pct": {"type": "number", "minimum": 0, "maximum": 100},
|
16
|
+
"temperature_c": {"type": "number"},
|
17
|
+
"connected_devices": {"type": "integer", "minimum": 0},
|
18
|
+
"mesh_nodes": {"type": "integer", "minimum": 0},
|
19
|
+
"packet_loss_pct": {"type": "number", "minimum": 0, "maximum": 100},
|
20
|
+
"data_throughput_kbps": {"type": "number", "minimum": 0}
|
21
|
+
},
|
22
|
+
"additionalProperties": true
|
23
|
+
}
|
24
|
+
},
|
25
|
+
"additionalProperties": true
|
26
|
+
}
|
@@ -1,14 +1,14 @@
|
|
1
|
-
{
|
2
|
-
"$comment": "Convenience bundle referencing all v1 schema artifact filenames for tooling discovery.",
|
3
|
-
"version": 1,
|
4
|
-
"schemas": {
|
5
|
-
"envelope": "envelope.schema.json",
|
6
|
-
"sensor_data": "sensor_data.schema.json",
|
7
|
-
"sensor_heartbeat": "sensor_heartbeat.schema.json",
|
8
|
-
"sensor_status": "sensor_status.schema.json",
|
9
|
-
"gateway_info": "gateway_info.schema.json",
|
10
|
-
"gateway_metrics": "gateway_metrics.schema.json",
|
11
|
-
"firmware_status": "firmware_status.schema.json",
|
12
|
-
"control_response": "control_response.schema.json"
|
13
|
-
}
|
14
|
-
}
|
1
|
+
{
|
2
|
+
"$comment": "Convenience bundle referencing all v1 schema artifact filenames for tooling discovery.",
|
3
|
+
"version": 1,
|
4
|
+
"schemas": {
|
5
|
+
"envelope": "envelope.schema.json",
|
6
|
+
"sensor_data": "sensor_data.schema.json",
|
7
|
+
"sensor_heartbeat": "sensor_heartbeat.schema.json",
|
8
|
+
"sensor_status": "sensor_status.schema.json",
|
9
|
+
"gateway_info": "gateway_info.schema.json",
|
10
|
+
"gateway_metrics": "gateway_metrics.schema.json",
|
11
|
+
"firmware_status": "firmware_status.schema.json",
|
12
|
+
"control_response": "control_response.schema.json"
|
13
|
+
}
|
14
|
+
}
|
@@ -1,33 +1,33 @@
|
|
1
|
-
{
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
3
|
-
"$id": "https://schemas.alteriom.io/mqtt/v1/sensor_data.schema.json",
|
4
|
-
"title": "Sensor Data Message v1",
|
5
|
-
"allOf": [{"$ref": "envelope.schema.json"}],
|
6
|
-
"type": "object",
|
7
|
-
"required": ["sensors"],
|
8
|
-
"properties": {
|
9
|
-
"sensors": {
|
10
|
-
"type": "object",
|
11
|
-
"minProperties": 1,
|
12
|
-
"additionalProperties": {
|
13
|
-
"type": "object",
|
14
|
-
"required": ["value"],
|
15
|
-
"properties": {
|
16
|
-
"value": {"type": ["number", "integer"]},
|
17
|
-
"unit": {"type": "string"},
|
18
|
-
"raw_value": {"type": ["number", "integer"]},
|
19
|
-
"calibrated_value": {"type": ["number", "integer"]},
|
20
|
-
"quality_score": {"type": "number", "minimum": 0, "maximum": 1},
|
21
|
-
"name": {"type": "string"},
|
22
|
-
"location": {"type": "string"},
|
23
|
-
"additional_data": {"type": "object"}
|
24
|
-
},
|
25
|
-
"additionalProperties": false
|
26
|
-
}
|
27
|
-
},
|
28
|
-
"battery_level": {"type": "integer", "minimum": 0, "maximum": 100},
|
29
|
-
"signal_strength": {"type": "integer", "minimum": -200, "maximum": 0},
|
30
|
-
"additional": {"type": "object"}
|
31
|
-
},
|
32
|
-
"additionalProperties": true
|
33
|
-
}
|
1
|
+
{
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
3
|
+
"$id": "https://schemas.alteriom.io/mqtt/v1/sensor_data.schema.json",
|
4
|
+
"title": "Sensor Data Message v1",
|
5
|
+
"allOf": [{"$ref": "envelope.schema.json"}],
|
6
|
+
"type": "object",
|
7
|
+
"required": ["sensors"],
|
8
|
+
"properties": {
|
9
|
+
"sensors": {
|
10
|
+
"type": "object",
|
11
|
+
"minProperties": 1,
|
12
|
+
"additionalProperties": {
|
13
|
+
"type": "object",
|
14
|
+
"required": ["value"],
|
15
|
+
"properties": {
|
16
|
+
"value": {"type": ["number", "integer"]},
|
17
|
+
"unit": {"type": "string"},
|
18
|
+
"raw_value": {"type": ["number", "integer"]},
|
19
|
+
"calibrated_value": {"type": ["number", "integer"]},
|
20
|
+
"quality_score": {"type": "number", "minimum": 0, "maximum": 1},
|
21
|
+
"name": {"type": "string"},
|
22
|
+
"location": {"type": "string"},
|
23
|
+
"additional_data": {"type": "object"}
|
24
|
+
},
|
25
|
+
"additionalProperties": false
|
26
|
+
}
|
27
|
+
},
|
28
|
+
"battery_level": {"type": "integer", "minimum": 0, "maximum": 100},
|
29
|
+
"signal_strength": {"type": "integer", "minimum": -200, "maximum": 0},
|
30
|
+
"additional": {"type": "object"}
|
31
|
+
},
|
32
|
+
"additionalProperties": true
|
33
|
+
}
|
@@ -1,14 +1,14 @@
|
|
1
|
-
{
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
3
|
-
"$id": "https://schemas.alteriom.io/mqtt/v1/sensor_heartbeat.schema.json",
|
4
|
-
"title": "Sensor Heartbeat v1",
|
5
|
-
"type": "object",
|
6
|
-
"required": ["schema_version", "device_id", "device_type", "timestamp"],
|
7
|
-
"properties": {
|
8
|
-
"schema_version": {"type": "integer", "const": 1},
|
9
|
-
"device_id": {"type": "string", "minLength": 1, "maxLength": 64, "pattern": "^[A-Za-z0-9_-]+$"},
|
10
|
-
"device_type": {"type": "string", "enum": ["sensor", "gateway"]},
|
11
|
-
"timestamp": {"type": "string", "format": "date-time"}
|
12
|
-
},
|
13
|
-
"additionalProperties": true
|
14
|
-
}
|
1
|
+
{
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
3
|
+
"$id": "https://schemas.alteriom.io/mqtt/v1/sensor_heartbeat.schema.json",
|
4
|
+
"title": "Sensor Heartbeat v1",
|
5
|
+
"type": "object",
|
6
|
+
"required": ["schema_version", "device_id", "device_type", "timestamp"],
|
7
|
+
"properties": {
|
8
|
+
"schema_version": {"type": "integer", "const": 1},
|
9
|
+
"device_id": {"type": "string", "minLength": 1, "maxLength": 64, "pattern": "^[A-Za-z0-9_-]+$"},
|
10
|
+
"device_type": {"type": "string", "enum": ["sensor", "gateway"]},
|
11
|
+
"timestamp": {"type": "string", "format": "date-time"}
|
12
|
+
},
|
13
|
+
"additionalProperties": true
|
14
|
+
}
|
@@ -1,14 +1,14 @@
|
|
1
|
-
{
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
3
|
-
"$id": "https://schemas.alteriom.io/mqtt/v1/sensor_status.schema.json",
|
4
|
-
"title": "Sensor Status v1",
|
5
|
-
"allOf": [{"$ref": "envelope.schema.json"}],
|
6
|
-
"type": "object",
|
7
|
-
"required": ["status"],
|
8
|
-
"properties": {
|
9
|
-
"status": {"type": "string", "enum": ["online", "offline", "updating", "error"]},
|
10
|
-
"battery_level": {"type": "integer", "minimum": 0, "maximum": 100},
|
11
|
-
"signal_strength": {"type": "integer", "minimum": -200, "maximum": 0}
|
12
|
-
},
|
13
|
-
"additionalProperties": true
|
14
|
-
}
|
1
|
+
{
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
3
|
+
"$id": "https://schemas.alteriom.io/mqtt/v1/sensor_status.schema.json",
|
4
|
+
"title": "Sensor Status v1",
|
5
|
+
"allOf": [{"$ref": "envelope.schema.json"}],
|
6
|
+
"type": "object",
|
7
|
+
"required": ["status"],
|
8
|
+
"properties": {
|
9
|
+
"status": {"type": "string", "enum": ["online", "offline", "updating", "error"]},
|
10
|
+
"battery_level": {"type": "integer", "minimum": 0, "maximum": 100},
|
11
|
+
"signal_strength": {"type": "integer", "minimum": -200, "maximum": 0}
|
12
|
+
},
|
13
|
+
"additionalProperties": true
|
14
|
+
}
|