-
Notifications
You must be signed in to change notification settings - Fork 338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is this repo maintained ?? #164
Comments
I guess it's abandoned. Others also get no answers here. And I feel the samples as way to complicated and badly explained anyway. I wish a sample would show how I just can make simple REST API calls to my backend service. |
Hi I might be able to help as I have this working now. Where are you stuck? |
Thank you. I stuck nowhere. |
@StefanOltmann We have a few good Python and NodeJS samples that show how to build a Smart Home device that I can share. They are up to date, but they don't show how to make REST calls. They do show how to make calls to another service though (Amazon SQS), and you could easily adapt that to use Node's
Let me know if this helps |
@jbnunn Thank you, but I fear it does not help me. I'm looking for a minimal, clean and working sample in Java/Kotlin. The old samples here are hard to understand because of missing comments. The ones you provided are really big. As far as I understand is a request always represented as a JSON String and the answer also. I feel this could be parsed and handled pretty simple. What I want to build is something minimal to get the "Switch XY on/off" and "Set XY to XX%" requests into my network (to forward it to my KNX interface). Maybe it is only a forward of JSON to my server. Then I will not have to change the skill. Or as a cleaner solution I would like to generate REST calls from parsed JSON like this: I would build this skill myself and share it, but because the samples are either outdated, broken or overwhelming I don't see how to do it. Can you please build a minimal working Java sample for this use case? |
Hi @StefanOltmann, thanks for letting me know. We have a minimalI Java code sample that will show you the basics of setting up a smart home switch: https://github.com/alexa/skill-sample-java-smarthome-switch. I just ran through all the steps and built it, it works, so I think you'll be able to learn a lot from that. A few things to note:
Hope this helps, please let me know. |
I saw that before. This sample is not really minimalistic. For example it works with an Dynamo Database for unknown reason. And why do I need that AlexaResponse object? What does it do? And method names are somewhat unclear. Also with pascalcased names it's not good Java. Also no comments. I'm sorry to say that, but that sample code is really messy and left me puzzled about how things work and what I really need of it. For me it's also not just one smart home device. I want to expose all my devices trough this skill and Alexa to set values on it. Similar to the OpenHAB Skill which I want to replace in my case with something way easier, because that is a grown project. So I guess there could be a REST method for discovery that tells Alexa in a JSON string about all device ids, their names and kinds/types. Alexa can give back JSON strings representing the command. To avoid JSON parsing & building in code I would use the GSon library and have an actual object (as DTO) for each thing like DiscoveryEntry, SwitchCommand and so on... with default values and short explaination to each field via JavaDoc. And it should to the absolute necessary. Do not show off other technologies there. This confuses. Right now I want to understand what is the absolute minimal working code to do device discovery and handle Switch & Percentage Commands (the two most used in every home). When you bring in more things as the minimal stuff the cognitive complexity grows and it's to hard to learn from the sample because there is no clear picture anymore. Can you craft me a sample that's so easy? |
DynamoDB is used to store the state of the switch in this example, but you can do without it.
There are common message fields that are sent to and received from Alexa when Smart Home requests are invoked, and the AlexaResponse class provides helpers to format those messages. You could build your own based off of the Alexa Interface Messaging Guide, but the provided one wraps up everything quite nicely. At a minimum, a Smart Home skill should:
With the exception of the DynamoDB piece, the sample skill I referenced does all three of these, and is really the minimal code required to do this. Thank you for bringing up the coding style and lack of comments. Learning about the Smart Home skills can be complex, and not having good comments can be frustrating and make learning even harder. We're in the process of writing and applying style guides to our code samples--similar to this one for NodeJS--hopefully we can alleviate this frustration in the future. |
@jbnunn Thank you. I managed to get it working for my private smart home project. I'm thinking of building a small & clean sample app that shows how to call REST apis in Kotlin. I will prepare a pull request in the next days. |
@jbnunn It's done. :-) I created a clean and simple Kotlin version from scratch: Also I added a pull request for the original Java version to fix some of the most noticeable code style issues: I hope this will help people getting started with the Alexa Smart Home Skill. Mine is working in production now. 👍 |
Great to hear, thank you @StefanOltmann! |
@aszk Closing means "it's not maintained anymore", right? |
@StefanOltmann No, we will maintain this repository however we probably need to update many codes and pages. Please feel free to create new issues or contact me. |
@aszk What about my pull request? |
We generally don't accept pull request but we will check. I assume alexa-samples/skill-sample-java-smarthome-switch#7 |
Your Contributing.md says otherwise. |
Links don't work:
ALX316 - How to Build a Backend for an Alexa Smart Home Skill - This doesn't work and main others.
The text was updated successfully, but these errors were encountered: