Skip to content

device.new

The gateway’s own event: a device the gateway did not know contacted an endpoint and registered itself. The gateway emits it once, when it adds the device to its register: allowed when the endpoint’s new_devices is allow, pending when it is hold. An endpoint whose new_devices is refuse keeps no record of the device and emits nothing. A device registered through the API or hourctl gives no device.new. The envelope’s endpoint and package are the endpoint’s, and device is the device’s id.

Schema id: urn:houradvantage:events:3:device.new

Fields

FieldTypeRequiredDescription
device_idintegeryesThe gateway’s own number for the device in its register (the envelope’s device is the device’s id).
status"pending" \"allowed"yes
remote_ipstringyesWhere the device called from: its IP address over HTTP, “mqtt” over MQTT.
key_presented"none" \"unregistered"

Example

{
"device_id": 17,
"status": "pending",
"remote_ip": "192.0.2.10",
"key_presented": "none"
}

JSON Schema

device.new.json
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "urn:houradvantage:events:3:device.new",
"title": "device.new: data",
"description": "The gateway's own event: a device the gateway did not know contacted an endpoint and registered itself. The gateway emits it once, when it adds the device to its register: allowed when the endpoint's new_devices is allow, pending when it is hold. An endpoint whose new_devices is refuse keeps no record of the device and emits nothing. A device registered through the API or hourctl gives no device.new. The envelope's endpoint and package are the endpoint's, and device is the device's id.",
"type": "object",
"properties": {
"device_id": {
"type": "integer",
"description": "The gateway's own number for the device in its register (the envelope's device is the device's id)."
},
"status": {
"description": "Whether the device may talk to the gateway. allowed: its messages are taken in. pending: they are refused until someone allows it.",
"enum": [
"pending",
"allowed"
]
},
"remote_ip": {
"type": "string",
"description": "Where the device called from: its IP address over HTTP, \"mqtt\" over MQTT."
},
"key_presented": {
"description": "Whether the device presented a key on its first call: none, or unregistered (a key the gateway holds nothing for the device to check against; the key itself is never in the event). The device's key_presented says where it stands later. An allowed device that brought a key can be given it as its own (adopt_presented_key); a pending device's is held with it.",
"enum": [
"none",
"unregistered"
]
}
},
"required": [
"device_id",
"status",
"remote_ip"
],
"examples": [
{
"device_id": 17,
"status": "pending",
"remote_ip": "192.0.2.10",
"key_presented": "none"
}
]
}