auchter / haaska

Home Assistant Alexa Skill Adapter
263 stars 61 forks source link

Process to upgrade to a new version #62

Open ctripodi opened 7 years ago

ctripodi commented 7 years ago

Hi, Looks like there are a lot of new features bearing in mind the last comments. I tryed to upgrade the version according to the item "Upgrading" but it does not work for me. I am really happy with this project and I am new on this. Can you please improve the procedure to upgrade to a new version? Can you please provide more details? For example, It is neccesary to upgrade in the HA server? or in the Amazon cloud? or both? Thanks a lot

auchter commented 7 years ago

Improving this documentation (and actually having a better concept of a "release") is on my TODO list.

In the mean time, generally updating is as simple as grabbing the latest code and running make deploy, or running make and manually uploading the resulting haaska.zip file to AWS Lambda. No changes to your HA server should be necessary.

azeroth12 commented 7 years ago

I tried to upgrade with these steps and can't get the new version to pass the test on the lambda side. My old zip file works fine, any ideas? Log:

START RequestId: 495e005c-5b83-11e7-85ce-51da321514a5 Version: $LATEST
type object 'allowed' has no attribute 'Control': AttributeError
Traceback (most recent call last):
  File "/var/task/haaska.py", line 660, in event_handler
    ha, payload)
  File "/var/task/haaska.py", line 289, in invoke
    obj = make_class(allowed)(namespace, name, ha, context)
AttributeError: type object 'allowed' has no attribute 'Control'

END RequestId: 495e005c-5b83-11e7-85ce-51da321514a5
REPORT RequestId: 495e005c-5b83-11e7-85ce-51da321514a5  Duration: 1.22 ms
trisk commented 7 years ago

@azeroth12 What does your config.json look like?

azeroth12 commented 7 years ago

Did a straight copy of the sample and just updated my info.

{
  "url": "https://[url]:8123/api",
  "password": "[pass]",
  "ssl_verify": false,
  "expose_by_default": false,
  "exposed_domains": [
    "alert",
    "automation",
    "climate",
    "cover",
    "fan",
    "group",
    "input_boolean",
    "input_slider",
    "light",
    "lock",
    "media_player",
    "scene",
    "script",
    "switch"
  ],
  "entity_suffixes": {
    "alert": "",
    "automation": "",
    "climate": "",
    "cover": "",
    "fan": "",
    "group": "Group",
    "input_boolean": "",
    "input_slider": "",
    "light": "",
    "lock": "",
    "media_player": "",
    "scene": "Scene",
    "script": "",
    "switch": ""
  },
  "debug": false
}
trisk commented 7 years ago

Hm, could be something weird on the Amazon end. Are you 1) using the latest change from the master branch and 2) have Smart Home as the only trigger for your Lambda function? A log with "debug": true might help explain what is going on.

@auchter It looks like the event namespace is appearing as "Control" instead of "Alexa.Control" here, have you ever seen this?

azeroth12 commented 7 years ago
  1. Yes, just double checked. Original was the zip from the master branch. Re-downloaded 0.3.1 just to make sure. 2. Yes only the one trigger.

Only weird thing I've seen is that the old zip file once uploaded has python 3 at the top of the code snipit. The new file has python 2.7. Not sure if that is anything... Lamda is still set up for 2.7 even though 3.6 is now an option (don't remember it from before).

azeroth12 commented 7 years ago

Not much different with debug...


START RequestId: 64ca298f-5b93-11e7-92e5-993ce9fb27f1 Version: $LATEST
[DEBUG] 2017-06-27T23:50:26.945Z    64ca298f-5b93-11e7-92e5-993ce9fb27f1    calling event handler for DiscoverAppliancesRequest, payload: {}
type object 'allowed' has no attribute 'Control': AttributeError
Traceback (most recent call last):
  File "/var/task/haaska.py", line 660, in event_handler
    ha, payload)
  File "/var/task/haaska.py", line 289, in invoke
    obj = make_class(allowed)(namespace, name, ha, context)
AttributeError: type object 'allowed' has no attribute 'Control'

END RequestId: 64ca298f-5b93-11e7-92e5-993ce9fb27f1
REPORT RequestId: 64ca298f-5b93-11e7-92e5-993ce9fb27f1  Duration: 1.15 ms
TheJulianJES commented 7 years ago

Same problem like @azeroth12 (fresh install)

azeroth12 commented 7 years ago

I've reverted back to the old version for now... haven't given this guy another go yet. Not really sure what the issue is...

azeroth12 commented 7 years ago

Nice to know I'm not alone with the problem.

TheJulianJES commented 7 years ago

Which version is working for you atm? The nest command is not working regardless of the server it seems.

azeroth12 commented 7 years ago

Doesn't have a version from what I can see, but based on the change log, seems like I'm running the original. 0.1.

TheJulianJES commented 7 years ago

The test seems to work fine with 0.2. (Failed with 0.3.1) I'm gonna test the skill now.

TheJulianJES commented 7 years ago

The error seems to be caused by https://github.com/auchter/haaska/commit/2b274b83e97935a335ab4cd48579868d98489d12 It works fine without the 'new event handler' for me.

azeroth12 commented 7 years ago

Removing that return stops the error on test, but doesn't seem to return any of my devices. Are you actually able to add ha entities to Alexa?

TheJulianJES commented 7 years ago

I actually took the source from 2.0 and added each commit except https://github.com/auchter/haaska/commit/2b274b83e97935a335ab4cd48579868d98489d12 manually.

azeroth12 commented 7 years ago

Gotcha using the revision right before that commit does work for me. Thanks! I guess any changes after 2b274b8 we'll be out of luck for now...

azeroth12 commented 7 years ago

Guh, we're stupid, I'm guessing you're doing the same thing I was. using that test script from the youtube video. Well in that commit (2b274b8) the class structure was reworked so the new test should be...

{
  "header": {
    "payloadVersion": "1",
    "namespace": "Alexa.ConnectedHome.Discovery",
    "name": "DiscoverAppliancesRequest"
  },
  "payload": {
    "accessToken": "whatever"
  }
}

Haaska works fine, all expected entites are coming into Alexa...

trisk commented 7 years ago

@azeroth12 Thanks, that clears things up. There's a stock smart home discovery request in the list of tests on the Lambda console itself, can you see if that still works for you?

azeroth12 commented 7 years ago

Yep sure does. It's basically the same thing.

{
  "header": {
    "payloadVersion": "2",
    "namespace": "Alexa.ConnectedHome.Discovery",
    "name": "DiscoverAppliancesRequest",
    "messageId": "F8752B11-69BB-4246-B923-3BFB27C06C7D"
  },
  "payload": {
    "accessToken": "1"
  }
}