alexa-samples / alexa-smarthome

Resources for Alexa Smart Home developers.
https://alexa.design/smarthome
Other
682 stars 336 forks source link

InputController - Discovery documentation #82

Closed madgeni closed 5 years ago

madgeni commented 6 years ago

Hi - the doc gives the example of: "inputs": [{ "name": "HDMI1", "friendlyNames": ["cable box", "cable"] }, { "name": "HDMI2", "friendlyNames": ["game system"] } ]

whilst the code sample shows: "properties": { "supported": [ { "name": "input" } ], "proactivelyReported": true, "retrievable": true }

Which is it?

madgeni commented 6 years ago

as a corollary, if i get Discovery working, and want to interact with the device - does it pass both name and the friendlynames array in the request?

madgeni commented 6 years ago

And does this work for devices that don't play video?

mikemaas-amazon commented 5 years ago

For your first question, it is both. The properties section reflects whether your capability definition supports proactive status updates or not. These are two distinct sections in the capability definition. Please refer to the Discovery capability documentation at https://developer.amazon.com/docs/device-apis/alexa-discovery.html#capability-object for a description and examples.

The documentation for InputController just doesn't show the optional proactivelyReported or retrieveable entries.

For your second question, the answer is no - only the EndpointId. For an example of what an InputController request looks like see: https://github.com/alexa/alexa-smarthome/blob/master/sample_messages/InputController/InputController.SelectInput.request.json

However, something to note is that your ability to pass cookies in requests that were set during discovery of the endpoint. This may be useful to you.

For your third question, the answer is yes. The interfaces are generic enough to be reused for many device types. For example, InputController could be used for a device such as an Audio Receiver that had input types but does not play video.

madgeni commented 5 years ago

Thanks for taking the time to write a great response - appreciate it. Is there a reason why I get an error where it tells me there's no video skill enabled? I'm using InputController for smart home devices which have multiple 'modes'

mikemaas-amazon commented 5 years ago

When you created your skill did you select the Smart Home or Video model? To verify, you can see what models the skill is using in the list of skills in the Alexa Developer console.

madgeni commented 5 years ago

It's a Smart Home model, does that stop it being used? If so, is there an alternative?

madgeni commented 5 years ago

Hi - does me using the Smart Home model preclude me from using InputController?

mikemaas-amazon commented 5 years ago

No, it should not.

madgeni commented 5 years ago

It's ok - definitely user error on this one :) Your original comment was perfect, and i'd just not implemented it correctly - thank you, and my bad.

madgeni commented 5 years ago

Hi - getting very mixed results with InputController - it often hears the right thing but completely ignores it. It seems to 'like' some device names, and not others (swimming pool ok, ceiling fan not ok) - and also some input names are totally ignored, or that the device can't use that. below is an example discovery - am i missing something? If i test the lambda with the request, it works fine.

{ "endpointId": "470", "manufacturerName": "Dummy", "friendlyName": "Ceiling Fan", "description": "Light/Switch", "cookie": { "switchis": "Selector", "WhatAmI": "setswitch", "cool": 0, "blow": 10, "chilled": 20 }, "displayCategories": [ "SWITCH" ], "capabilities": [ { "type": "AlexaInterface", "interface": "Alexa.InputController", "version": "3", "inputs": [ { "name": "Cool" }, { "name": "blow" }, { "name": "Chilled" } ], "properties": { "supported": [ { "name": "Cool" }, { "name": "blow" }, { "name": "Chilled" } ], "proactivelyReportable": false, "retrievable": true } }, ] }

mikemaas-amazon commented 5 years ago

For NLU questions (and really deeper support) please reach out to the forums at https://forums.developer.amazon.com/spaces/33/Alexa+Smart+Home+Skill+API.html, there are better support options there. Those particular names are very short and may just be difficult to detect. Additionally, the example you gave has homophones like "ceiling"/"sealing" - not sure what is going on though. You might need a ticket to be opened to dig deeper.

madgeni commented 5 years ago

Thanks Mike - posted there already - https://forums.developer.amazon.com/questions/180200/can-inputcontroller-be-used-for-non-video.html

mikemaas-amazon commented 5 years ago

Thanks, i'll see if someone can field your question. This forum won't get as many eyes.

madgeni commented 5 years ago

Appreciate that Mike :)

madgeni commented 5 years ago

Hey @mikemaas-amazon you're a dark horse! Just saw the announcement of Modes :)