Battery sensor
An individual battery charge sensor reporting 0–100 percent.
https://hometruth.ai/schemas/battery-sensor · BatterySensorDocument
Instances
No devices currently use this schema.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://hometruth.ai/schemas/battery-sensor",
"title": "Battery sensor",
"description": "One battery charge sensor owned by a device. Values are percentages from 0 to 100.",
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"name": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"schemaId": {
"const": "https://hometruth.ai/schemas/battery-sensor"
},
"kind": {
"const": "battery"
},
"unit": {
"const": "%"
},
"state": {
"type": "object",
"additionalProperties": false,
"properties": {
"availability": {
"enum": [
"online",
"offline",
"degraded",
"unknown"
]
},
"detail": {
"type": "string",
"maxLength": 500
},
"observedAt": {
"type": "string",
"format": "date-time"
},
"value": {
"type": "number",
"minimum": 0,
"maximum": 100
},
"source": {
"type": "string",
"maxLength": 100
}
},
"required": [
"availability"
],
"dependentRequired": {
"value": [
"observedAt"
]
},
"allOf": [
{
"if": {
"properties": {
"availability": {
"const": "online"
}
},
"required": [
"availability"
]
},
"then": {
"properties": {
"value": {},
"observedAt": {}
},
"required": [
"value",
"observedAt"
]
}
},
{
"if": {
"properties": {
"availability": {
"enum": [
"offline",
"unknown"
]
}
},
"required": [
"availability"
]
},
"then": {
"not": {
"properties": {
"value": {}
},
"required": [
"value"
]
}
}
}
]
}
},
"required": [
"id",
"name",
"schemaId",
"kind",
"unit",
"state"
]
}