Skip to content
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

FYI: I'm working on a V3 smart home skill #54

Closed
csowada opened this issue Nov 30, 2017 · 70 comments
Closed

FYI: I'm working on a V3 smart home skill #54

csowada opened this issue Nov 30, 2017 · 70 comments
Assignees

Comments

@csowada
Copy link

csowada commented Nov 30, 2017

Hello,

I' m started to port the alex skill to V3. It's currently more just for fun to see how Alexa and AWS works. But maybe it is useful. I will add the fork to github next days.

@Stefan39135
Copy link

how far along you are, I would be very pleased if there were a V3 support.

@nat38
Copy link

nat38 commented Dec 13, 2017

would love to use the V3!

@W6HBR
Copy link

W6HBR commented Dec 17, 2017

FYI - I went to setup my own OpenHAB skill today and it seems Amazon no longer allows you to create a V2 skill. It's listed as deprecated and only the V3 option is enabled.

Fortunately I had some older V2 skills defined that I no longer needed and I was able to rename and repurpose one of those for OpenHAB usage.

@sipvoip
Copy link

sipvoip commented Jan 3, 2018

Any update on this? I also would like to move to v3

@digitaldan
Copy link
Collaborator

I have a v3 version in dev right now, I'm shooting for a PR by the end of next week.

@sipvoip
Copy link

sipvoip commented Jan 3, 2018 via email

@wladwnt
Copy link

wladwnt commented Jan 3, 2018

For those who need a new v2 skill: you still can select payload v2 with one trick. The selection v2 is just deactivated in html. It is possible to change html (DOM) on the fly in the browser and enable v2 selection.
If you use firefox (other browsers have similar tools), use right click (mouse) on the v2 select box, then in the pop-up menu select "examine element (Q)" (or similar item, I have it in german, not sure how it is written in english). Then you can edit html code. You have to find disabled="disabled" as a tag property and delete it. Than you can select v2. The save button will probably not be available but when you click next, the developer console will prompt to save.

@sipvoip
Copy link

sipvoip commented Jan 3, 2018 via email

@sipvoip
Copy link

sipvoip commented Jan 13, 2018

Any update?

@alfredkrohmer
Copy link

alfredkrohmer commented Jan 21, 2018

Question for discussion: Would it maybe make sense to implement a minimal Lambda function for forwarding all incoming Alexa requests directly to OpenHAB? I implemented this in the last few days on my own (before I even saw that this OpenHAB Alexa skill is usable without an OpenHAB cloud account) and managed to voice-control my thermostats (through MQTT -> homegear). An OpenHAB addon could receive the requests on a special API endpoint. This way, the Lambda function would also be decoupled from the OpenHAB version you use (in case APIs etc. change).

@digitaldan
Copy link
Collaborator

digitaldan commented Jan 23, 2018

@sipvoip Sorry, I got caught up for the last 2 weeks upgrading our openhab cloud infrastructure, finally finished that yesterday. So, i'm back on this starting today, not sure when I will have an update, but I hope soon, this release will also enable better grouping of items which i'm excited about, for example if you have a stereo (OH group) with multiple items (power, input, volume, etc..) this will let you map multiple items to a single alexa name, so I can say "turn stereo up" (volume) , or "turn stereo off" (power) and "stereo" will know which items to route to.

@digitaldan
Copy link
Collaborator

@devkid I guess you could do that, but I'm not sure what that would accomplish, and since this does work directly against a OH (no oh cloud required), you would be duplicating effort. I think using open API"s is much preferable to having to create custom endpoints that must be maintained and tested.

@velaar
Copy link

velaar commented Jan 23, 2018

@digitaldan And does support for English-Canada come with V3? #55

@digitaldan
Copy link
Collaborator

And does support for English-Canada come with
That can come now, we had an issue with our configuration that failing review for this and another region, I'm hoping to clear that up this week as well.

@alfredkrohmer
Copy link

I think using open API"s is much preferable to having to create custom endpoints that must be maintained and tested.

But the current situation is the same, isn't it? You need to maintain and test the Lambda function (which is basically an endpoint for Alexa and translates Alexa requests into OpenHAB requests). By converting the Lambda function into a simple forwarder, you could implement that translation logic directly in OpenHAB. The advantage would be that, if some OpenHAB APIs were supposed to be changed, you can change the Alexa addon in the same breath. (I just want to discuss this, if you like, not push anything :)

@digitaldan
Copy link
Collaborator

, if some OpenHAB APIs were supposed to be changed

I think that is not an issue, API compatibility is critical, otherwise our clients would cease to work, and we can't ask thousands of users to change their integrations b/c we want to break our API's for some reason. The API's have been compatible back to the 1.0 days, we have added more functionality and additional API's, but they work backwards, so i think there would need to be another benefit.

I see your point about putting most of the logic in OH, and not having some in lambda and some in OH, its definitely another way of looking at it and I could see some interesting things that could be done. Maybe thats the right approach for the custom skill api?

My goal with this project is to have the lambda only translate requests between alexa and OH models and not have any real business logic in it, so keep it as light weight as possible.

This was referenced Feb 4, 2018
@Flole998
Copy link
Member

Is there a repo for this fork yet? Or any other way to stay updated? Or is this dead?

@digitaldan
Copy link
Collaborator

I have a v3 skill working, but have not committed anything yet, I'm trying to get some time free to do so, but life is not cooperating at the moment.

@Flole998
Copy link
Member

Alright awesome, thanks for the update. Are there any new functions like lock/garage door and media control support?

@BenCanada
Copy link

We are stuck here in Canada with no OH skill available to us. :(

@idkpmiller
Copy link

Of all the main skills I use on Alexa, openhab and Plex are the last two I am waiting for.

I understand Canada, Australia and New Zealand are all waiting. What happened with India did it get it already?

@tulamidan
Copy link

@digitaldan I'd be very curious to get my hands on that skill. It seems like the little trick to get a v2 skill activated does not work anymore.

@digitaldan
Copy link
Collaborator

I have V3 working! Just working out the bugs and cleaning up

https://github.com/digitaldan/openhab-alexa/tree/v3

@jsetton
Copy link
Collaborator

jsetton commented Mar 6, 2018

Thanks @digitaldan. I just did a quick successful test with discovering devices. The first thing to note for the folks who will be testing this, is that you will need to change the AWS Runtine value in your env file to nodejs 6.10 as some of the array functions aren't supported in nodejs 4.3.

--- a/env_sample
+++ b/env_sample
@@ -9,7 +9,7 @@ AWS_HANDLER=index.handler
 AWS_MEMORY_SIZE=512
 AWS_TIMEOUT=15
 AWS_DESCRIPTION=openHAB Alexa Smart Home Skill  (development)
-AWS_RUNTIME=nodejs4.3
+AWS_RUNTIME=nodejs6.10
 AWS_VPC_SUBNETS=
 AWS_VPC_SECURITY_GROUPS=
 EXCLUDE_GLOBS="event.json"

@digitaldan
Copy link
Collaborator

That and a few other things :-) I started updating the readme, but its far from complete. I have introduced a new tagging structure to match the much more comprehensive feature set available in v3, although v2 tags still work (see the v2 conversion function). I am just implementing temperature scale right now for temp sensors and thermostats.

@jsetton
Copy link
Collaborator

jsetton commented Mar 7, 2018

Thanks for the update. I was about to implement the temperature scale as I noticed the Fahrenheit scaling was not supported while doing some additional testing :-)

Regarding the device categories, I saw that you are using the device capabilities to determine them compared to using the tag defined in OH in v2. I am afraid this will lead to device incorrectly setup. For example, a roller shutter item will be defined as a light using that logic and therefore, will be included when interacting with lights in an alexa-enabled controlled group. Same problem for a switch item controlling a light as it won't be defined as a light and excluded from that feature. Maybe it is something that it is handled by the new tagging structure you mentioned?

@digitaldan
Copy link
Collaborator

I have an updated README with more details on item configuration if people are interested
https://github.com/digitaldan/openhab-alexa/blob/v3/README.md#item-configuration

@blackcatoz
Copy link

@jsetton thanks. I’m not running my own instance. Setup LWA last night and edited config but still didn’t have any luck. So this morning i’ve Just been trying ‘random’ things. Reset back to LWA now but back to getting the error ‘We were unable to link (skill name) at this time’. Will keep pushing on. Alexa will not beat me!! Checking keys again to make sure I’ve not mixed them up...

@Clifford-Foster
Copy link

@blackcatoz what option did you select on the Alexa skill permissions page for "Request users to access resources and capabilities"? The current V3 code doesn't handle authorizations correctly if you select 'yes'. This was pointed out to me recently after I had to add code to handle this (I inadvertently selected yes as it seemed like a good idea :)

@jsetton
Copy link
Collaborator

jsetton commented May 22, 2018

digitaldan#3 (comment) 😄

@blackcatoz
Copy link

Thanks Clifford. I did have it enabled. I did disable it earlier, account successfully linked, but couldn’t discover any device. Unlinked then had all sorts of OAuth errors. Got account linked again, but not seeing any devices yet... my mission continues... Alexa will not beat me...!!!

@Clifford-Foster
Copy link

Are your items showing on OpenHAB Cloud (assuming you aren’t going direct to your OH server)? If not, then keen to see what your .env and config files for Alexa are.

@blackcatoz
Copy link

Items are showing in OpenHAB cloud. Confirmed the Lambda function is working by running tests on function, (can switch lights on and off and do a successful device discovery direct from function test) but the skill isn’t bringing those devices into the Alexa App. Created a new skill and linked, but no joy.
Next step is a second instance of OpenHAB and a new OpenHAB cloud account with basic items. I can’t break too much in production environment - Mrs already got cranky about the heating turning off and not starting up again on a restart....oops...

@Clifford-Foster
Copy link

I was running my own OpenHab Cloud instance so it was easy for me to debug as I could check log files. I have shut it down now and changing the Alexa skill to point directly to a reverse proxy running at my house. Was having problems with my ISP (Optus) as they were blocking port 80, which made it difficult to get a SSL certificate installed.

@jsetton
Copy link
Collaborator

jsetton commented May 22, 2018

@blackcatoz if you haven't already, check the Lambda function logs in Cloudwatch. The skill is pretty chatty. So you should be able to see where the point of failure is.

@blackcatoz
Copy link

blackcatoz commented May 22, 2018

@jsetton was looking at them. The only things showing up were the test calls from the lambda function, nothing from the skill.

I did however just get one step closer, just deployed a function to us-west-2, and I can see device discovery from the app in the logs now. Devices aren’t showing up in app yet, but we getting closer... further tinkering tomorrow...

@Clifford-Foster
Copy link

Should have pointed that out. You need to deploy into Oregon for Australia to work according to the docs.

@blackcatoz
Copy link

All good @clifford. Lots of reading done where I discovered it.
Query though, is it normal for the AlexaDiscovery in the Lambda function to take 18-24 seconds to run? I do have a few items, but not that many, and probably around 25 items tagged for HomeKit. I’ll de-tag some and try again. Does the Alexa app get bored and time-out, hence not finding my devices?

@Clifford-Foster
Copy link

Clifford-Foster commented May 23, 2018

The time is about right. Why are you tagging for Homekit?

The tagging should be something like
Switch LightSwitch "Light Switch" {alexa="PowerController.powerState"}

@blackcatoz
Copy link

blackcatoz commented May 23, 2018

Cool. Well if that time is right there must be something else still going on.

Existing items tagged for HomeKit as I’ve had HomeKit & Siri integration working for sometime. But Alexa ‘in da house’ now. Not going to be buying Apple’s overpriced speaker thing... but I can’t remove HomeKit tags on all items yet as I need to have an operating system for The Executive Direction of Household Operations....

I have tried items with and without HomeKit tags along with the Alexa tags still nothing....

spun up a new VM as a test system. Will continue to test on that, not upsetting standard operations...

@Clifford-Foster
Copy link

Clifford-Foster commented May 23, 2018

What do you see in CloudWatch in response to the "Alexa.Discovery" message?

Have you tried to created a Test Item like the example that I showed above? Does that get discovered?

@blackcatoz
Copy link

CloudWatch logs shows successful discovery of devices from MyOpenHAB, but thinking about it, i guess I should see a send back to the Skill...

@blackcatoz
Copy link

Update: mild success. After a new seperate install of OH2.2 release and new MyOH cloud account, I’ve successfully discovered a single item. However, that single item would only be discovered if it had HomeKit tags, not v3 Alexa tags...

I’ve verified correct function version uploaded. Discovery.Response shows Payload.Endpoints as v3.

I’ll continue to poke around, and add my existing prod items files into dev environment.

@Clifford-Foster
Copy link

You need OH2.3 snapshot (I think) for V3 tags to work.

@blackcatoz
Copy link

blackcatoz commented May 24, 2018

Thanks Clifford. Tried 2.3 snapshot, no go. Clearly I’m missing something somewhere for v3 tags to work...
Even going directly to myOH/rest/items does not show the Alexa tags, so of course the App not going to find it, nor show up my n CloudWatch.
Are there def no other prerequisites that I need?
Running out of things to look at before I say Alexa wins and wait for an official release...

edit: I need my own my OH cloud instance...that’s the only piece left...guess that doesn’t do v3 yet...

edit2: as for not discovering all my devices in my live environment, if I removed 90% of them and add them back slowly, doing a discovery in between addition, they all get discovered.

@Clifford-Foster
Copy link

Clifford-Foster commented May 24, 2018

2.3 is definitely required. In the ReadMe it says

NEW Alexa Version 3 API syntax (v3)
Version 3 of the Alex Skill API introduces a more rich and complex set of features that required a change in how items are configured by using the new metadata feature introduced in openaHAB 2.3 (Currently only available via nightly build).
Version 2 tags are still supported and are converted internally to V3 metadata

I used to run my own OH Cloud instance and it does work with V3 (and Alexa). I have removed this now and go straight to a reverse proxy. It's still there in EC2, just inactive. I could create an AMI for you.

@blackcatoz
Copy link

Thanks for your support Clifford. Happy to finally have Alexa in control. Yeah, missed that bit. Too focused on the setup section I guess...
For the time being, I’ll stick with the v2 setup using myOH, as I believe running my own instance, either way it’s configured, will break my mobile push notifications. But it is something I do want to do in the future.

Thanks again.

@thedolt
Copy link

thedolt commented Jun 9, 2018

@blackcatoz are you using your own cloud connector instance? If not, you would need to use Login with Amazon to mimic the OAuth2 account linking process and add your myopenhab username:password in the config.js. Once this is setup, you would get an Amazon account approval page during the account linking process.

@jsetton Hey, you mentioned this in a previous post a couple of weeks ago. I wanted to see if you could point me to a resource that could help me setup the Alexa skill so that it I don't have to use LWA and can instead use my cloud connector that I'm running at home. I'm not sure if there's an OAUTH2 server that is running out of the box with openhab-cloud, and I can't find any documentation regarding such a setup. I started to install Ory Hydra to use as an OAUTH2/OpenIDConnect server, but I had to put that on hold because it seemed like there wasn't detailed enough instructions on how to secure it with SSL. I'll continue, of course, if there's nothing available with openhab-cloud. What I'm looking for are the values to plug into the Security Provider information on the Alexa skill account linking section.

Any help would be appreciated.

Cheers,

John H

@jsetton
Copy link
Collaborator

jsetton commented Jun 10, 2018

I'm not sure if there's an OAUTH2 server that is running out of the box with openhab-cloud

@thedolt Based on the overview of the openhab-cloud, I would expect it to be integrated although I unfortunately never setup my own instance. So I can't comment much on this. I would recommend asking/checking the community forum on that topic.

@broyuken
Copy link

Hey all, been watching this for a while. Any idea when the official release will happen in the Alexa skill store? I’m still using the old one but would love some of these new features. If it’s not gonna be released for a while I’ll do the manual install.

@codeaholics
Copy link

I'm also wondering the same thing. It would be awesome to get this live.

@CWempe
Copy link

CWempe commented Sep 26, 2018

Any news?

Or is this already done?

The documentation is saying:

Channels which are tagged "CurrentTemperature" but NOT part of a thermostat group will be exposed as a Temperature item in Alexa and can be asked what their current value is ("Alex what is the upstairs temperature? ")

https://www.openhab.org/docs/ecosystem/alexa/#general-configuration-instructions

But it is not working fo rme yet.
openHAB 2.4.M3

@staehler
Copy link

Yes, would be really nice to see this new V3 skill. I'm keen on some new features :-)
Keep on going. Thanks a lot!

@dastrix80
Copy link

2.3 is definitely required. In the ReadMe it says

NEW Alexa Version 3 API syntax (v3)
Version 3 of the Alex Skill API introduces a more rich and complex set of features that required a change in how items are configured by using the new metadata feature introduced in openaHAB 2.3 (Currently only available via nightly build).
Version 2 tags are still supported and are converted internally to V3 metadata

I used to run my own OH Cloud instance and it does work with V3 (and Alexa). I have removed this now and go straight to a reverse proxy. It's still there in EC2, just inactive. I could create an AMI for you.

Hi Clifford, I run my own OH2 Cloud instance, can you lend a fellow Aussie a hand to setup V3 with it? :)

@SamuelBrucksch
Copy link

SamuelBrucksch commented Dec 6, 2018

Hi,

i'm currently trying to get a Dimmer Light to work.

My Item:

Dimmer IndirektesLicht "Indirektes Licht" <light> ["Lighting"] { channel="tradfri:0100:mygateway:WohnzimmerLicht:brightness" }

The Discovery:

{
  "endpointId": "IndirektesLicht",
  "manufacturerName": "openHAB",
  "friendlyName": "Indirektes Licht",
  "description": "Dimmer IndirektesLicht via openHAB",
  "displayCategories": ["LIGHT"],
  "cookie": {
    "propertyMap": "{\"PowerController\":{\"powerState\":{\"parameters\":{},\"itemName\":\"IndirektesLicht\"},\"categories\":[\"LIGHT\"]},\"BrightnessController\":{\"brightness\":{\"parameters\":{},\"itemName\":\"IndirektesLicht\"},\"categories\":[\"LIGHT\"]}}"
  },
  "capabilities": [
    {
      "type": "AlexaInterface",
      "interface": "Alexa",
      "version": "3"
    },
    {
      "type": "AlexaInterface",
      "interface": "Alexa.PowerController",
      "version": "3",
      "properties": {
        "supported": [
          {
            "name": "powerState"
          }
        ],
        "proactivelyReported": false,
        "retrievable": true
      }
    },
    {
      "type": "AlexaInterface",
      "interface": "Alexa.BrightnessController",
      "version": "3",
      "properties": {
        "supported": [
          {
            "name": "brightness"
          }
        ],
        "proactivelyReported": false,
        "retrievable": true
      }
    }
  ]
}

This looks right to me so far.

This json sent from lambda editor as test works:

{
    "directive": {
        "header": {
            "namespace": "Alexa.BrightnessController",
            "name": "SetBrightness",
            "payloadVersion": "3",
            "messageId": "yyyyyyyyy",
            "correlationToken": "xxxxxxxxxxx"
        },
        "endpoint": {
            "scope": {
                "type": "BearerToken",
                "token": "xxxxxxxx"
            },
            "endpointId": "IndirektesLicht",
            "cookie": {
                "propertyMap": "{\"PowerController\":{\"powerState\":{\"parameters\":{},\"itemName\":\"IndirektesLicht\"},\"categories\":[\"LIGHT\"]},\"BrightnessController\":{\"brightness\":{\"parameters\":{},\"itemName\":\"IndirektesLicht\"},\"categories\":[\"LIGHT\"]}}"
            }
        },
        "payload": {
            "brightness": 80
        }
    }
}

However when i say Alexa, dim indirektes licht to 20% nothing happens. I do not even get a log for an incoming request, so it looks like this does not really come in as a directive. Any Ideas what this could be?

Are there still some problems with capabilities maybe? Or is this working for you?

I get the same when i use the new notation:

Dimmer Licht "Hubert" {alexa="PowerController.powerState,BrightnessController.brightness" [category="LIGHT"]}

Switch Hubert On/Off works
Dim Hubert to 20% does not.


Seems to work dirdctly from alexa, but not from the simulator in the developer console. Any ideas why?

@digitaldan
Copy link
Collaborator

Hi all, i am going to close this in favor of #123 , if you are interested in beta testing the skill , leave a comment over there and we can coordinate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests