Comments (13)
Hello,
I suggest implementing Alexa payload v3 (audio-visual devices) in a separate project.
As far as I understand, the message format isn't compatible, and v3 doesn't support smart home devices, such as thermostats.
I tried to edit the code to support v3 devices, and the discovery works ok, but there is some logic that needs to be added to support such devices and their control messages.
One of the problems is that one device supports several capabilities (different tags in OpenHAB model), but for OpenHAB you need to configure separate items for each capability.
from openhab-alexa.
I'm not sure what you mean by payload "v3" or why we would need a separate project, we use the smart home skill api described here https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/smart-home-skill-api-reference
from openhab-alexa.
I mean Alexa API for entertainment devices:
https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/building-smart-home-skills-for-entertainment-devices
There is a difference between v2 and v3 payloads, according to the documentation.
This version is selected when creating a skill:
https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/steps-to-create-a-smart-home-skill
That's why I suggested making a separate project to support entertainment devices and new messages to control them.
from openhab-alexa.
I see, to use v3 you need to enable it in the skill. But from my limited testing it seems that enabling v3 still allows v2 messages, so we can support both with the same skill. Now, our tagging setup would need to be more complex to support this, the only "grouping" of items to support multiple commands we have is for thermostats, but I don't want to continue that pattern as its complex and hard for users to setup. But we need something similar for an entertainment device. I have an idea for this that I need to prototype and get some feedback on.
from openhab-alexa.
Could you please elaborate on "enabling v3 still allows v2 messages"?
As far as I can see, the format of request changes with v3, and such commands as dimming of lights, etc. are not in the entertainment specification.
There is also a thread on stackoverflow, though not too much info:
https://stackoverflow.com/questions/45594813/alexa-smart-home-skill-api-v2-v3-compatibility-reference
And yes, it would be very nice to have an easier way to support multiple commands for one entertainment device.
Actually, seems that it would be possible for one script to support both v2 and v3 messages, though it could make it more complex.
from openhab-alexa.
So, its interesting, the v3 skill controls all my devices that were added with the v2 skill, but I think thats more by accident on Amazon's part, as there is no way to add those devices through discovery if the skill uses v3. Also it looks like amazon has updated their FAQ about this:
Can I build one skill that supports entertainment devices, video content and other smart home devices such as locks, lights or thermostats?
No. You currently need to build three skills: one that supports entertainment devices, one that supports video content, and one that supports other device types.
So while I think we can have one code base, you are correct we will need to have multiple alexa "apps" to enable the different functionality.
from openhab-alexa.
Too bad it can not be combined. I was really hoping for openhab to control all my devices with this skill in the future.
Isnt there any other way? For example building a custom skill or so? As far as i understand you can add any action to a custom skill as long as you supply an interaction model which holds the commands like change channel or so.
Itsmore complex, i know, but you aldo have more freedom and can support more devices. I'm really interested in helping out and working on this together if others are also interested.
from openhab-alexa.
Amazon updated their implementation and documentation.
Here is Migration Guide from v2 to v3:
https://developer.amazon.com/docs/smarthome/smart-home-skill-migration-guide.html
from openhab-alexa.
I just played around a bit with v3 payload and a smart home custom skill and i have a fake smart socket and a fake smart tv in my fake discovery and both get detected and i can control both, so yes it is possible to control entertainment devices and other devices in the same skill, i can confirm this now. Also Thermostats and so on are supported:
https://developer.amazon.com/de/docs/device-apis/alexa-thermostatcontroller.html
There is even a Wake-on-Lan controller that works on the local network:
https://developer.amazon.com/de/docs/device-apis/alexa-wakeonlancontroller.html
I just followed this guide:
https://developer.amazon.com/de/docs/smarthome/steps-to-build-a-smart-home-skill.html#register-as-an-amazon-developer-and-create-the-skill
And i enhanced the discovery with this:
{
"endpointId": "demo_id",
"manufacturerName": "Smart Device Company",
"friendlyName": "Bedroom Outlet",
"description": "Smart Device Switch",
"displayCategories": ["SWITCH"],
"cookie": {
"key1": "arbitrary key/value pairs for skill to reference this endpoint.",
"key2": "There can be multiple entries",
"key3": "but they should only be used for reference purposes.",
"key4": "This is not a suitable place to maintain current endpoint state."
},
"capabilities":
[
{
"type": "AlexaInterface",
"interface": "Alexa",
"version": "3"
},
{
"interface": "Alexa.PowerController",
"version": "3",
"type": "AlexaInterface",
"properties": {
"supported": [{
"name": "powerState"
}],
"retrievable": true
}
}
]
},
{
"endpointId": "demo_id2",
"manufacturerName": "Smart Device Company2",
"friendlyName": "Bedroom TV",
"description": "Smart TV",
"displayCategories": ["TV"],
"cookie": {
"key1": "arbitrary key/value pairs for skill to reference this endpoint.",
"key2": "There can be multiple entries",
"key3": "but they should only be used for reference purposes.",
"key4": "This is not a suitable place to maintain current endpoint state."
},
"capabilities":
[
{
"type": "AlexaInterface",
"interface": "Alexa",
"version": "3"
},
{
"interface": "Alexa.ChannelController",
"version": "3",
"type": "AlexaInterface",
"properties": {
"supported": [{
"name": "channel"
}],
"retrievable": true
}
},
{
"interface": "Alexa.PowerController",
"version": "3",
"type": "AlexaInterface",
"properties": {
"supported": [{
"name": "powerState"
}],
"retrievable": true
}
}
]
}
So like i said a smart socket and a tv are discovered. Then i added this in the handler:
else if (request.directive.header.namespace === 'Alexa.ChannelController') {
log("DEBUG:", "Channel Request", JSON.stringify(request));
handleChannelControl(request, context);
}
And when i say switch channel on bedroom tv to 1 it prints this message:
{
"directive": {
"header": {
"namespace": "Alexa.ChannelController",
"name": "ChangeChannel",
"payloadVersion": "3",
"messageId": "babee974-75ea-487d-ab50-6305c47b64b1",
},
"endpoint": {
"endpointId": "demo_id2",
"cookie": {
"key1": "arbitrary key/value pairs for skill to reference this endpoint.",
"key2": "There can be multiple entries",
"key3": "but they should only be used for reference purposes.",
"key4": "This is not a suitable place to maintain current endpoint state."
}
},
"payload": {
"channel": {
"number": "1"
},
"channelMetadata": {}
}
}
}
So it definitely should be possible to add all devices openhab supports into one skill.
from openhab-alexa.
@SamuelBrucksch is this still working for you? Till the day before yesterday I had no problems at all with the V3 branch, but since then I am experiencing the problem, that the PlaybackController is not working anymore for my category="TV" item. Alexa is always responding that "no enabled Video Skill with such functionality" could be found.
from openhab-alexa.
I did not try it in the last few days. Will check this evening and let you know if i can find the time.
from openhab-alexa.
@SamuelBrucksch like most of the time, it was an user error = my fault. Sorry for the noise and thanks for responding! Cheers
from openhab-alexa.
the v3 skill implements the added entertainment functions, closing.
from openhab-alexa.
Related Issues (20)
- feature request: support personal profiles HOT 3
- Thermostat Setpoints Not Allowed Above 100 Degrees HOT 3
- Arabic Language Support HOT 2
- Window Covering Rollershutter Item No Control Page in Alexa App HOT 1
- missing several display categories HOT 2
- Window Covering Rollershutter percentage values are inverted HOT 1
- Cooking Device Capabilities Support
- Dimmer percentage commands broken HOT 2
- Support remote video player interface HOT 2
- Television device not discovered if Channel item type is string HOT 4
- Adding transitional states to Custom Semantic Catalog HOT 2
- Can say "Light On" but not "Fan Medium" in an Alexa group without full thing name "Bedroom Fan Medium" HOT 2
- Keep getting [Error]: CliError: The CloudFormation deploy failed for Alexa region "default": Access Denied HOT 6
- AlexaSkillFunction[AWS::Lambda::Function] CREATE_FAILED HOT 1
- MainUI How To Examples
- "message": "Required parameter(s) missing in the request." HOT 4
- The Command "Stop" does not stop the Rollershutter in German HOT 1
- Television.Channel - Mapping names to number not working HOT 1
- devices discovery is terminated without new devices HOT 3
- Fail to deploy (skill not found) HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openhab-alexa.