From 50368b7d9b430d673f2283abae9d92bfe8f2c782 Mon Sep 17 00:00:00 2001 From: helviojr <30601040+helviojr@users.noreply.github.com> Date: Sun, 14 Jun 2020 23:09:40 -0300 Subject: [PATCH] WakeOnLANController Update in schema and new sample messages for including new WakeOnLANController capability (https://developer.amazon.com/en-US/docs/alexa/device-apis/alexa-wakeonlancontroller.html) --- .../Discovery/Discovery.response.json | 49 +++++ .../WakeOnLANController/DeferredResponse.json | 14 ++ .../PowerController.TurnOn.request.json | 20 +++ .../WakeOnLANController.response.event.json | 35 ++++ .../WakeOnLANController/WakeUp.event.json | 35 ++++ validation_schemas/README.md | 1 + .../alexa_smart_home_message_schema.json | 169 ++++++++++++++++++ 7 files changed, 323 insertions(+) create mode 100644 sample_messages/WakeOnLANController/DeferredResponse.json create mode 100644 sample_messages/WakeOnLANController/PowerController.TurnOn.request.json create mode 100644 sample_messages/WakeOnLANController/WakeOnLANController.response.event.json create mode 100644 sample_messages/WakeOnLANController/WakeUp.event.json diff --git a/sample_messages/Discovery/Discovery.response.json b/sample_messages/Discovery/Discovery.response.json index 94952f2..ff5f485 100644 --- a/sample_messages/Discovery/Discovery.response.json +++ b/sample_messages/Discovery/Discovery.response.json @@ -678,6 +678,55 @@ } } ] + }, + { + "endpointId": "endpoint-010", + "manufacturerName": "Sample Manufacturer", + "friendlyName": "Computer", + "description": "010 Computer that need Wake On LAN to turn on", + "displayCategories": [ + "COMPUTER" + ], + "connections": [ + { + "type": "TCP_IP", + "macAddress": "00:11:22:AA:BB:33" + } + ], + "cookie": { + "detail1": "For simplicity, this is computer have only", + "detail2": "information to make possible wake on lan." + }, + "capabilities": [ + { + "type": "AlexaInterface", + "interface": "Alexa", + "version": "3" + }, + { + "type": "AlexaInterface", + "interface": "Alexa.WakeOnLANController", + "version": "3", + "properties": {}, + "configuration": { + "MACAddresses": ["00:11:22:AA:BB:33"] + } + }, + { + "type": "AlexaInterface", + "interface": "Alexa.PowerController", + "version": "3", + "properties": { + "supported": [ + { + "name": "powerState" + } + ], + "proactivelyReported": true, + "retrievable": true + } + } + ] } ] } diff --git a/sample_messages/WakeOnLANController/DeferredResponse.json b/sample_messages/WakeOnLANController/DeferredResponse.json new file mode 100644 index 0000000..8611fe6 --- /dev/null +++ b/sample_messages/WakeOnLANController/DeferredResponse.json @@ -0,0 +1,14 @@ +{ + "event": { + "header": { + "namespace": "Alexa", + "name": "DeferredResponse", + "payloadVersion": "3", + "messageId": "5f8a426e-01e4-4cc9-8b79-65f8bd0fd8a4", + "correlationToken": "dFMb0z+PgpgdDmluhJ1LddFvSqZ/jCc8ptlAKulUj90jSqg==" + }, + "payload": { + "estimatedDeferralInSeconds": 20 + } + } +} \ No newline at end of file diff --git a/sample_messages/WakeOnLANController/PowerController.TurnOn.request.json b/sample_messages/WakeOnLANController/PowerController.TurnOn.request.json new file mode 100644 index 0000000..ebb9b1f --- /dev/null +++ b/sample_messages/WakeOnLANController/PowerController.TurnOn.request.json @@ -0,0 +1,20 @@ +{ + "directive": { + "header": { + "namespace": "Alexa.PowerController", + "name": "TurnOn", + "payloadVersion": "3", + "messageId": "1bd5d003-31b9-476f-ad03-71d471922820", + "correlationToken": "dFMb0z+PgpgdDmluhJ1LddFvSqZ/jCc8ptlAKulUj90jSqg==" + }, + "endpoint": { + "scope": { + "type": "BearerToken", + "token": "access-token-from-skill" + }, + "endpointId": "endpoint-001", + "cookie": {} + }, + "payload": {} + } +} \ No newline at end of file diff --git a/sample_messages/WakeOnLANController/WakeOnLANController.response.event.json b/sample_messages/WakeOnLANController/WakeOnLANController.response.event.json new file mode 100644 index 0000000..b821c04 --- /dev/null +++ b/sample_messages/WakeOnLANController/WakeOnLANController.response.event.json @@ -0,0 +1,35 @@ +POST /v3/events HTTP/1.1 +Host: api.amazonalexa.com +Authorization: Bearer access-token-from-Amazon +Content-Type: application/json + +{ + "event": { + "header": { + "namespace": "Alexa", + "name": "Response", + "messageId": "2e2c312f-20c3-44ff-cc91-23bb133e5553", + "correlationToken": "dFMb0z+PgpgdDmluhJ1LddFvSqZ/jCc8ptlAKulUj90jSqg==", + "payloadVersion": "3" + }, + "endpoint": { + "scope": { + "type": "BearerToken", + "token": "access-token-from-Amazon" + }, + "endpointId": "endpoint-010" + }, + "payload": {} + }, + "context": { + "properties": [ + { + "namespace": "Alexa.PowerController", + "name": "powerState", + "value": "ON", + "timeOfSample": "2020-06-15T01:59:50.52Z", + "uncertaintyInMilliseconds": 500 + } + ] + } +} \ No newline at end of file diff --git a/sample_messages/WakeOnLANController/WakeUp.event.json b/sample_messages/WakeOnLANController/WakeUp.event.json new file mode 100644 index 0000000..e4d7a94 --- /dev/null +++ b/sample_messages/WakeOnLANController/WakeUp.event.json @@ -0,0 +1,35 @@ +POST /v3/events HTTP/1.1 +Host: api.amazonalexa.com +Authorization: Bearer access-token-from-Amazon +Content-Type: application/json + +{ + "event": { + "header": { + "namespace": "Alexa.WakeOnLANController", + "name": "WakeUp", + "messageId": "3e1b246e-10f3-3ff3-7c99-32aa123f43c3", + "correlationToken": "dFMb0z+PgpgdDmluhJ1LddFvSqZ/jCc8ptlAKulUj90jSqg==", + "payloadVersion": "3" + }, + "endpoint": { + "scope": { + "type": "BearerToken", + "token": "access-token-from-Amazon" + }, + "endpointId": "endpoint-010" + }, + "payload": {} + }, + "context": { + "properties": [ + { + "namespace": "Alexa.PowerController", + "name": "powerState", + "value": "OFF", + "timeOfSample": "2020-06-15T01:50:50.52Z", + "uncertaintyInMilliseconds": 500 + } + ] + } +} \ No newline at end of file diff --git a/validation_schemas/README.md b/validation_schemas/README.md index 6656aa5..bf38ee0 100644 --- a/validation_schemas/README.md +++ b/validation_schemas/README.md @@ -41,4 +41,5 @@ Alexa.Speaker Alexa.TemperatureSensor Alexa.ThermostatController Alexa.ToggleController +Alexa.WakeOnLANController ``` diff --git a/validation_schemas/alexa_smart_home_message_schema.json b/validation_schemas/alexa_smart_home_message_schema.json index ac778b6..c53fc75 100644 --- a/validation_schemas/alexa_smart_home_message_schema.json +++ b/validation_schemas/alexa_smart_home_message_schema.json @@ -2196,6 +2196,95 @@ } ] }, + { + "type": "object", + "allOf": [ + { + "required": [ + "interface", + "type", + "version", + "configuration", + ], + "type": "object", + "properties": { + "type": { + "pattern": "^[ a-zA-Z0-9_\\-=#;:?@&]+$", + "type": "string" + }, + "interface": { + "type": "string" + }, + "version": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "configuration": { + "type": "object", + "required": [ + "MACAddresses", + ], + "additionalProperties": false, + "properties": { + "MACAddresses": { + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { + "pattern": "^[0-9A-Fa-f:]+$", + "type": "string" + } + } + } + }, + "properties": { + "type": "object", + "additionalProperties": false + } + } + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "AlexaInterface" + ] + }, + "interface": { + "type": "string", + "enum": [ + "Alexa.WakeOnLANController" + ] + }, + "version": { + "oneOf": [ + { + "type": "string", + "enum": [ + "3" + ] + }, + { + "type": "integer", + "format": "int32", + "enum": [ + 3 + ] + } + ] + } + } + } + ] + }, { "type": "object", "allOf": [ @@ -8284,6 +8373,86 @@ } } }, + { + "description": "A WakeUp event for Alexa event gateway", + "type": "object", + "required": [ + "event" + ], + "additionalProperties": false, + "properties": { + "context": { + "$ref": "#/definitions/common/model.Context" + }, + "event": { + "type": "object", + "required": [ + "header", + "endpoint", + "payload" + ], + "additionalProperties": false, + "properties": { + "header": { + "type": "object", + "required": [ + "namespace", + "name", + "payloadVersion", + "messageId", + "correlationalToken" + ], + "additionalProperties": false, + "properties": { + "namespace": { + "type": "string", + "enum": [ + "Alexa.WakeOnLANController" + ] + }, + "name": { + "type": "string", + "enum": [ + "WakeUp" + ] + }, + "payloadVersion": { + "$ref": "#/definitions/common/model.PayloadVersion" + }, + "messageId": { + "$ref": "#/definitions/common/model.MessageId" + }, + "correlationToken": { + "$ref": "#/definitions/common/model.CorrelationToken" + } + } + }, + "endpoint": { + "type": "object", + "required": [ + "scope", + "endpointId" + ], + "additionalProperties": false, + "properties": { + "scope": { + "$ref": "#/definitions/common/model.Scope" + }, + "endpointId": { + "$ref": "#/definitions/common/model.EndpointId" + } + } + }, + "payload": { + "type": "object", + "properties": { + }, + "additionalProperties": false + } + } + } + } + }, { "description": "A DeferredResponse message for Alexa", "type": "object",