Giter VIP home page Giter VIP logo

haaska's Introduction

Hi there 👋

I'm Mike, a software developer focussing on C# and Xamarin.Forms.

  • 💬 I talk a lot about C# and Xamarin.Forms. I might also talk about technologies like Azure Functions. .NET Core, NodeJS, Python in an interview if you get me going!
  • 📕 I have a blog about software development, home automation and side projects https://mikegrant.org.uk
  • 📫 How to reach me: @mike_grant_ or Go Here
  • ⚡ Fun fact: I ❤️ 🐶s

📕 Latest Blog Posts

haaska's People

Contributors

anthonylavado avatar auchter avatar bassclarinetl2 avatar blankenshipz avatar dale3h avatar dependabot-preview[bot] avatar fluver avatar gitter-badger avatar inverse avatar jeroenterheerdt avatar keatontaylor avatar kuruoujou avatar lanseuo avatar mike-grant avatar mikefez avatar puppetcoder avatar rcloran avatar rhooper avatar robbiet480 avatar stjohnjohnson avatar trisk avatar u1f35c avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

haaska's Issues

405: Method Not Allowed

I'm getting this error 405: Method Not Allowed when testing my skill

405 Client Error: Method Not Allowed for url: https://ha.domain.ca/api/alexa/smart_home: HTTPError
Traceback (most recent call last):
  File "/var/task/haaska.py", line 109, in event_handler
    return ha.post('alexa/smart_home', event, wait=True).json()
  File "/var/task/haaska.py", line 63, in post
    r.raise_for_status()
  File "/var/task/requests/models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 405 Client Error: Method Not Allowed for url: https://ha.domain.ca/api/alexa/smart_home

i'm using a long lived token

Error when testing Lambda

SO I did everything I needed to do according to the setup page. But now I'm stuck testing the lambda function...

I get following error:

{
"errorMessage": "Expecting value: line 6 column 18 (char 316)",
"errorType": "JSONDecodeError",
"stackTrace": [
[
"/var/task/haaska.py",
104,
"event_handler",
"config = Configuration('config.json')"
],
[
"/var/task/haaska.py",
76,
"init",
"self._json = json.load(f)"
],
[
"/var/lang/lib/python3.6/json/init.py",
299,
"load",
"parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)"
],
[
"/var/lang/lib/python3.6/json/init.py",
354,
"loads",
"return _default_decoder.decode(s)"
],
[
"/var/lang/lib/python3.6/json/decoder.py",
339,
"decode",
"obj, end = self.raw_decode(s, idx=_w(s, 0).end())"
],
[
"/var/lang/lib/python3.6/json/decoder.py",
357,
"raw_decode",
"raise JSONDecodeError("Expecting value", s, err.value) from None"
]
]
}

For the test I just copied the example from the testing page here.
Tested it without filling in the token and with the token. Same error.

my config.json looks like this:

{
"url": "https://********.duckdns.org/api",
"bearer_token": "here-is-a-token",
"debug": false,
"ssl_verify": true,
"ssl_client": [cert.pem]
}

I copied the certificate into the config folder.

Is there anything I may ave done wrong here?

HTTPError "404 Client Error: Not Found for url: https://****:8123/api/alexa/smart_home",

I'm not sure if this is the correct way to ask for help. I used a older version of haaska by you, mike-grant, and everything were working fine. However, when I added a switch to home assistant alexa stopped finding devices (and I could not control the other devices with alexa). Thus, I tried the new updated version and now I get a error when using the following test event. Furthermore, alexa does not find any devices.

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

Det error is as follows:

{
  "errorMessage": "404 Client Error: Not Found for url: https://***:8123/api/alexa/smart_home",
  "errorType": "HTTPError",
  "stackTrace": [
    [
      "/var/task/haaska.py",
      108,
      "event_handler",
      "return ha.post('alexa/smart_home', event, wait=True).json()"
    ],
    [
      "/var/task/haaska.py",
      62,
      "post",
      "r.raise_for_status()"
    ],
    [
      "/var/task/requests/models.py",
      935,
      "raise_for_status",
      "raise HTTPError(http_error_msg, response=self)"
    ]
  ]
}

Not able to discover any devices

When I test the lambda function I get this as a result that seems like its working fine....

{
  "event": {
    "header": {
      "messageId": "364b3dde-c85f-4349-9408-19f6f2802e39",
      "name": "Discover.Response",
      "namespace": "Alexa.Discovery",
      "payloadVersion": "3"
    },
    "payload": {
      "endpoints": [
        {
          "additionalApplianceDetails": {},
          "capabilities": [
            {
              "interface": "Alexa.PowerController",
              "properties": {
                "proactivelyReported": false,
                "retrievable": true,
                "supported": [
                  {
                    "name": "powerState"
                  }
                ]
              },
              "type": "AlexaInterface",
              "version": "3"
            }
          ],
          "description": "group.upstairs",
          "displayCategories": [
            "OTHER"
          ],
          "endpointId": "group#upstairs",
          "friendlyName": "Upstairs",
          "manufacturerName": "Home Assistant"
        },
        {
          "additionalApplianceDetails": {},
          "capabilities": [
            {
              "interface": "Alexa.PowerController",
              "properties": {
                "proactivelyReported": false,
                "retrievable": true,
                "supported": [
                  {
                    "name": "powerState"
                  }
                ]
              },
              "type": "AlexaInterface",
              "version": "3"
            }
          ],
          "description": "group.downstairs",
          "displayCategories": [
            "OTHER"
          ],
          "endpointId": "group#downstairs",
          "friendlyName": "Downstairs",
          "manufacturerName": "Home Assistant"
        },
        {
          "additionalApplianceDetails": {},
          "capabilities": [
            {
              "interface": "Alexa.PowerController",
              "properties": {
                "proactivelyReported": false,
                "retrievable": true,
                "supported": [
                  {
                    "name": "powerState"
                  }
                ]
              },
              "type": "AlexaInterface",
              "version": "3"
            }
          ],
          "description": "switch.bedroom_lamp_1",
          "displayCategories": [
            "SWITCH"
          ],
          "endpointId": "switch#bedroom_lamp_1",
          "friendlyName": "Bedroom Lamp 1",
          "manufacturerName": "Home Assistant"
        },
        {
          "additionalApplianceDetails": {},
          "capabilities": [
            {
              "interface": "Alexa.PowerController",
              "properties": {
                "proactivelyReported": false,
                "retrievable": true,
                "supported": [
                  {
                    "name": "powerState"
                  }
                ]
              },
              "type": "AlexaInterface",
              "version": "3"
            }
          ],
          "description": "switch.bedroom_lamp_2",
          "displayCategories": [
            "SWITCH"
          ],
          "endpointId": "switch#bedroom_lamp_2",
          "friendlyName": "Bedroom Lamp 2",
          "manufacturerName": "Home Assistant"
        },
        {
          "additionalApplianceDetails": {},
          "capabilities": [
            {
              "interface": "Alexa.PowerController",
              "properties": {
                "proactivelyReported": false,
                "retrievable": true,
                "supported": [
                  {
                    "name": "powerState"
                  }
                ]
              },
              "type": "AlexaInterface",
              "version": "3"
            }
          ],
          "description": "group.all_switches",
          "displayCategories": [
            "OTHER"
          ],
          "endpointId": "group#all_switches",
          "friendlyName": "all switches",
          "manufacturerName": "Home Assistant"
        },
        {
          "additionalApplianceDetails": {},
          "capabilities": [
            {
              "interface": "Alexa.PowerController",
              "properties": {
                "proactivelyReported": false,
                "retrievable": true,
                "supported": [
                  {
                    "name": "powerState"
                  }
                ]
              },
              "type": "AlexaInterface",
              "version": "3"
            }
          ],
          "description": "switch.office_lamp_1",
          "displayCategories": [
            "SWITCH"
          ],
          "endpointId": "switch#office_lamp_1",
          "friendlyName": "Office Lamp 1",
          "manufacturerName": "Home Assistant"
        }
      ]
    }
  }
}

I've linked the skill with my account successfully, but I don't seem to see the lambda function getting called when I initiate discovery on my phone.

How do I test this starting with the Alexa skill in the developer web page? I am not sure how to narrow down the problem.

No devices found

@anthonylavado you have been really helpful. perhaps you can help me on this one too?

So far, the test returns no errors. I can enable the skill and link the account in the Alexa app. However, it couldn't discover any devices. I'm using HA 0.62.1 and I have this in my HA config...

alexa:
  flash_briefings:
    default:
      - title: Default Flash Briefing
        text: >
          {{ states('sensor.alexa_flash_briefing') }}
  smart_home:
    filter:
      include_entities:
        - fan.ceiling_fan
        - fan.fan
        - fan.play_room_fan
        - fan.wall_fan
        - fan.bedroom_fan
        - group.dining

Since the documentation is quite outdated, I find it quite confusing.

May I know do I need to add haaska_hidden: false in customize section in HA?

Thanks in advance.

Error with lambda

When I test the lambda I get this error :
Function Logs:
START RequestId: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX Version: $LATEST
'header': KeyError
Traceback (most recent call last):
File "/var/task/haaska.py", line 660, in event_handler
name = event['header']['name']
KeyError: 'header'

What can be happening ?
Help please

Smart Home payload v2 works, v3 doesn't

Hi,

I have setup the skill and lambda function and all is working fine, however, I have to select v2 as the smart home payload and not v3 is that correct?

screen shot 2018-09-01 at 15 55 11

Thanks,
Matt

build haaska using docker: no such option: --system

When using this command to build per the readme:

docker build -t haaska . && docker run -v "$PWD":/usr/src/app haaska

I end up with:

Successfully tagged haaska:latest
mkdir -p build
cp haaska.py config/config.json.sample config/config.json build
pip install --system -t build requests

Usage:
  pip install [options] <requirement specifier> [package-index-options] ...
  pip install [options] -r <requirements file> [package-index-options] ...
  pip install [options] [-e] <vcs project url> ...
  pip install [options] [-e] <local project path> ...
  pip install [options] <archive url/path> ...

no such option: --system
make: *** [haaska.zip] Error 2
Makefile:16: recipe for target 'haaska.zip' failed

Any thoughts on what's going wrong? Thank you!

How to exclude what Alexa can do

I would like Alexa to only CLOSE the garage door and not have the ability to open it (unless it can pop up a confirm on my phone/smart watch - but that is for another day). How do I exclude that opening ability?

Lambda Test Failed

So I am having an issue that I have not seen mentioned yet when testing my Lambda function.

I am getting the following errors from Amazon:

This is the result:

 {
   "errorMessage": "401 Client Error: Unauthorized for url: https://{Public_URL}/api/alexa/smart_home",
   "errorType": "HTTPError",
   "stackTrace": [
     [
       "/var/task/haaska.py",
       108,
       "event_handler",
       "return ha.post('alexa/smart_home', event, wait=True).json()"
     ],
     [
       "/var/task/haaska.py",
       62,
       "post",
       "r.raise_for_status()"
     ],
     [
       "/var/task/requests/models.py",
       939,
       "raise_for_status",
       "raise HTTPError(http_error_msg, response=self)"
     ]
   ]
 }

This is the Amazon log output:

START RequestId: 077120e9-9039-11e8-83f3-a15fbdabfa96 Version: $LATEST
401 Client Error: Unauthorized for url: https://{PUBLIC_URL/api/alexa/smart_home: HTTPError
Traceback (most recent call last):
  File "/var/task/haaska.py", line 108, in event_handler
    return ha.post('alexa/smart_home', event, wait=True).json()
  File "/var/task/haaska.py", line 62, in post
    r.raise_for_status()
  File "/var/task/requests/models.py", line 939, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://{PUBLIC_URL}/api/alexa/smart_home
 
END RequestId: 077120e9-9039-11e8-83f3-a15fbdabfa96
REPORT RequestId: 077120e9-9039-11e8-83f3-a15fbdabfa96	Duration: 549.55 ms	Billed Duration: 600 ms 	Memory Size: 128 MB	Max Memory Used: 31 MB	

This is the relevant Home Assistant log:

2018-07-25 13:24:27 WARNING (MainThread) [homeassistant.components.http.auth] Please change to use bearer token access /api/alexa/smart_home

2018-07-25 13:24:27 WARNING (MainThread) [homeassistant.components.http.ban] Login attempt or request with invalid authentication from 54.152.59.58

2018-07-25 13:24:27 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=persistent_notification, service=create, service_data=title=Login attempt failed, message=Login attempt or request with invalid authentication from 54.152.59.58, notification_id=http-login, service_call_id=23219184785616-9>
 
2018-07-25 13:24:27 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=persistent_notification.httplogin, old_state=<state persistent_notification.httplogin=notifying; title=Login attempt failed, message=Login attempt or request with invalid authentication from 12.52.94.170 @ 2018-07-25T13:24:18.459097-05:00>, new_state=<state persistent_notification.httplogin=notifying; title=Login attempt failed, message=Login attempt or request with invalid authentication from 54.152.59.58 @ 2018-07-25T13:24:18.459097-05:00

This is the code in my test event:

{
  "directive": {
    "header": {
      "namespace": "Alexa.Discovery",
      "name": "Discover",
      "payloadVersion": "3",
      "messageId": "1bd5d003-31b9-476f-ad03-71d471922820"
    },
    "payload": {
      "scope": {
        "type": "BearerToken",
        "token": "access-token-from-skill"
     }
    }
  }
}

I am using the new auth system in HA, if that makes a difference. I also do have my API password set and verified it matched what the config.json had before compiling and uploading.

I need some guidance on where to go from here.

EDIT: Forgot to add that I am on the latest 0.74.1 version of HA.

Use Download ZIP/Ensure 'make' sets permissions

As discovered in #20, if someone clones the repository, then the files (namely haaska.py) will have the wrong permissions.

Git creates files with rw-r--r-- (644), where Lambda needs permission to execute. In my testing, the default permissions included with a "download" of the file rwx-r-xr-x (755) seems to work.

I propose two solutions to this issue, that are not mutually exclusive.

  1. Change the install docs to recommend using "Download ZIP" rather than cloning the repository.
    This is the best/fastest change, that will ensure success for most people. The files will be downloaded with the correct permissions, and everything should work.

  2. Change the makefile to set the correct permissions.
    In the build step, we should add a chmod to ensure everything has the right permission before it gets zipped up.

SSL verification failure

Hi,

i followed the guide and I registered correctly the skill for Alexa , but if I test the lambda I get:
'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed

if i disable the ssl verify in config it works...but It's not a good idea.

any idea?

I've been using letsencrypt cert on my server.

Marco

Max retries exceeded with url: /api/alexa/smart_home

Hello,

Sorry to bother you with this issue but I have tried everything and have no wtf I have this error when I execute the test snippet. Please help, my brain hurts!

  • haaska skill language is English (UK).
  • Lambda region is Ireland.
  • Endpoint: arn:aws:lambda:eu-west-1:amazonID:function:haaska
  • Client ID/Client Secret/Redirect URLs configured.
  • Skill ID entered in function
  • Haaska Config:
{
  "url": "https://hass.mydomain.com/api",
  "bearer_token": "my_token",
  "debug": false,
  "ssl_verify": false,
  "ssl_client": []
}
  • Hass config:
alexa:
  smart_home:
    entity_config:
      light.living_room:
        name: Ceiling
      light.reading:
        name: Reading
      light.bathroom_lights:
        name: Ceiling
      light.bedroom_main:
        name: Ceiling
      light.bedroom_strip:
        name: Headboard
etc.

Error:

{
  "errorMessage": "HTTPSConnectionPool(host='hass.mydomain.com', port=443): Max retries exceeded with url: /api/alexa/smart_home (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7faa2be26f60>: Failed to establish a new connection: [Errno -2] Name or service not known',))",
  "errorType": "ConnectionError",
  "stackTrace": [
    [
      "/var/task/haaska.py",
      109,
      "event_handler",
      "return ha.post('alexa/smart_home', event, wait=True).json()"
    ],
    [
      "/var/task/haaska.py",
      62,
      "post",
      "timeout=(None, read_timeout))"
    ],
    [
      "/var/task/requests/sessions.py",
      572,
      "post",
      "return self.request('POST', url, data=data, json=json, **kwargs)"
    ],
    [
      "/var/task/requests/sessions.py",
      524,
      "request",
      "resp = self.send(prep, **send_kwargs)"
    ],
    [
      "/var/task/requests/sessions.py",
      637,
      "send",
      "r = adapter.send(request, **kwargs)"
    ],
    [
      "/var/task/requests/adapters.py",
      516,
      "send",
      "raise ConnectionError(e, request=request)"
    ]
  ]
}

climate domains not discovered

Everything is discovered perfectly except my climate entities. Is this a bug?

Additionally, I have tried exposing my temperature sensors and to my surprise it was discovered successfully. However, I am not sure how to ask Alexa to read out the sensor value. Any suggestion?

Haaska Connection Error

Hi,
I ran the test code from the wiki and got the following result:

{
  "errorMessage": "401 Client Error: Unauthorized for url: http://domain:8123/api/alexa/smart_home",
  "errorType": "HTTPError",
  "stackTrace": [
    [
      "/var/task/haaska.py",
      109,
      "event_handler",
      "return ha.post('alexa/smart_home', event, wait=True).json()"
    ],
    [
      "/var/task/haaska.py",
      63,
      "post",
      "r.raise_for_status()"
    ],
    [
      "/var/task/requests/models.py",
      940,
      "raise_for_status",
      "raise HTTPError(http_error_msg, response=self)"
    ]
  ]
}

Here is the Home Assistant log:
Login attempt or request with invalid authentication from 34.201.31.210

Here is my config:

{
  "url": "http:/domain:8123/api",
  "bearer_token": "token",
  "debug": false,
  "ssl_verify": false,
  "ssl_client": []
}

Here is my Home Aassistant configuration.yaml:

 auth_providers:
   - type: homeassistant
   - type: legacy_api_password
alexa:
  smart_home:

I am running 0.79.3, the api_password is the same as the bearer_token.

To-do

A list of controllers that i'm planning on implementing in the near future, if anyone has any others that they'd like implementing then just comment below and I'll look at adding them

  • PowerController
  • BrightnessController
  • PercentageController
  • ColorTemperatureController
  • TemperatureSensor
  • ThermostatController

Assert payloadVersion ==3 / KeyError: 'directive'

Brand new to haaska, been figuring it out/configuring all day. I'm using Hassio so (to my knowledge) can't debug this issue much further (wish i could add print statements to 'smart_home.py' to see what is going on.

Basically I have Alexa + Lambda + Built-in Hassio Alexa web service communicating but getting the following error ....

2018-03-25 19:14:23 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 381, in start
    resp = await self._request_handler(request)
  File "/usr/lib/python3.6/site-packages/aiohttp/web_app.py", line 310, in _handle
.............
  File "/usr/lib/python3.6/site-packages/homeassistant/components/alexa/smart_home.py", line 624, in post
    hass, self.smart_home_config, message)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/alexa/smart_home.py", line 632, in async_handle_message
    assert message[API_DIRECTIVE][API_HEADER]['payloadVersion'] == '3'
KeyError: 'directive'

I get the above Error in "home-assistant.log" when I "Discover Devices" from my iPhone/Alexa App.

Which appears to me like haaska/lambda is sending some other payloadVersion than expected '3' (in Home Assistant's Alexa code ... I could be wrong, like i said, newb here)

When i do a Lambda Configure Test Event and give it the following:

  "directive": {
    "header": {
      "namespace": "Alexa.Discovery",
      "name": "Discover",
      "payloadVersion": "3",
      "messageId": "1bd5d003-31b9-476f-ad03-71d471922820"
    },
    "payload": {
      "scope": {
        "type": "BearerToken",
        "token": "access-token-from-skill"
      }
    }
  }
}

I do see (in Lambda "Function Code" "Execution Results" all my Hassio devices so I think I'm REALLY Close ... is this a known bug or anyone have ideas how to solve? Thanks in advance

"Climate" not recognized

Hello
New to haaska but i was able to set it up and seems to be working more or less.

Hass.io: 0.65.6
haaska: 0.4
Working: Scripts, Scenes, Automation, switches, media players, TV
Not Working: Climate

I am having troubles with my climate control. Hasska does not see any climate at all during the discovery session tested directly through Lambda.

I have (2GIG / Zwave). thermostat. I added a manual thermostat. Both of them are not detected by haaska.

I do not get any errors in the logs.

Anyone having the same problem?
Do we have any steps i can take for debugging?

Thanks.
K

Discovery directive: I get all my devices excluding all Climate.
{
"directive": {
"header": {
"namespace": "Alexa.Discovery",
"name": "Discover",
"payloadVersion": "3",
"messageId": "1bd5d003-31b9-476f-ad03-71d471922820"
},
"payload": {
"scope": {
"type": "BearerToken",
"token": "access-token-from-skill"
}
}
}
}

instructions

seems instructions are kinda outdated. Developer Console @ https://developer.amazon.com i dont have any "Apps & Services"... also its unclear how and where i should get bearer token. any help?

Contact and Motion Sensor API Update?

looking for a little direction here on whether you plant to or are even interested in adding features to Haaska as Amazon adds them... to plan ahead for my installations

I built door open/closed and deadbolt sensors integrated with HomeAssistant that this contact and motion sensor update API would "voice enable" with Alexa

https://developer.amazon.com/blogs/alexa/post/bda9d70c-2f0d-454d-9939-2eb82868cf35/announcing-contact-and-motion-sensor-apis-and-integration-into-alexa-routines-adding-new-home-automation-features-for-customers-and-new-opportunities-for-smart-home-developers

and

https://developer.amazon.com/docs/smarthome/state-reporting-for-a-smart-home-skill.html

And, of course, I'm happy to help with any beta testing if you do plan to add these capabilities to haaska
My HA config is here: https://github.com/packetbrain/HAConfig with the door/lock configs in sensor.yaml

Thanks for the work you have done!

Explain why devices are wrong/missing

We need to update the documentation to explain what Haaska's role is in connecting user's Home Assistant devices to Alexa.

Essentially:

  • Haaska is just a Lambda proxy for the Alexa Voice Service and gets/sends requests to Home Assistant

  • All the device integrations are handled in the "smart_home.py" file in Home Assistant

  • If a device doesn't appear (e.g. climate/thermostat device), it is because the support is not finished/added in Home Assistant yet

  • If a device shows up as the wrong type, it is because Alexa does not have a matching category, so it falls back to "switch" (e.g. cover/door devices)

  • We should find what the best practices are for submitting requests to Home Assistant, and gently direct users that way

Question: Readme and skill-configuration still up to date?

Hi there, thanks for your work!

I cant get my alexa skill working. I believe i followed every single step of the readme and the linked AWS tutorial. My skill shows up, i click on "Konto verknüpfen" (connect to account) and got ask to give permissions to access my profile. After that i only get an error message that something gone wrong and that i have to try it later.

I set up the skill multiple times but get the same error.

Any ideas?

Thermostat setting transactions are executed but error out at the end: "The thermostat is not responding"

I implemented this skill - Discovery and switches work fine - but I did run in to a little issue with the thermostat (ecobee).

Via the alexa app I can see and set the temperature, no issues. I can also query the temperature setting and that also works.

But when I ask alexa to set the temperature to any value via voice (Alexa set the thermostat to 24 degrees), I immediately get “I am not quite sure what went wrong”, or sometimes “the thermostat is not responding”.

However, the strange thing is that the setting in the thermostat does get changed immediately in every case, so the command actually works perfectly. But for some reason alexa thinks the transactions are not completing.

This only happens with Thermostat. My other devices are OK. The older Hasska (v2 payload) never showed this kind of problem.

I see no errors or warnings in the HA log at all, and the thermostat is actually set to the requested value. I tried removing and re-adding the skill, re-linking it, etc, no change, there is always the message at the end ('something went wrong', or 'thermostat not responding')

I noticed that the behavior of the haaska v3 "glue" is now to acknowledge the transaction immediately without waiting for HA to respond, (commit in June 24). Could this be causing the problem? either the response is too fast or in the case of thermostats it is missing some information that HA is sending.

I tried to obtain a lambda function trace to look at the signalling back and forth but couldn't figure that out.

If you can point me to a working haaska v3 release prior to the behavior change, that waits and forwards HA's response back to the skill, maybe the error will go away, I can try it and report back results.

Also I can provide any other info you may need.

Lambda Test Fail: Expecting Property Name Enclosed in Double Quotes

I ran the Lambda test but it ends up failing.

Response:
{
"errorMessage": "Expecting property name enclosed in double quotes: line 5 column 1 (char 76)",
"errorType": "JSONDecodeError",
"stackTrace": [
[
"/var/task/haaska.py",
103,
"event_handler",
"config = Configuration('config.json')"
],
[
"/var/task/haaska.py",
75,
"init",
"self._json = json.load(f)"
],
[
"/var/lang/lib/python3.6/json/init.py",
299,
"load",
"parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)"
],
[
"/var/lang/lib/python3.6/json/init.py",
354,
"loads",
"return _default_decoder.decode(s)"
],
[
"/var/lang/lib/python3.6/json/decoder.py",
339,
"decode",
"obj, end = self.raw_decode(s, idx=_w(s, 0).end())"
],
[
"/var/lang/lib/python3.6/json/decoder.py",
355,
"raw_decode",
"obj, end = self.scan_once(s, idx)"
]
]
}

Request ID:
"4220bb83-aaf9-11e8-b59c-ff979af5e237"

Function Logs:
START RequestId: 4220bb83-aaf9-11e8-b59c-ff979af5e237 Version: $LATEST
Expecting property name enclosed in double quotes: line 5 column 1 (char 76): JSONDecodeError
Traceback (most recent call last):
File "/var/task/haaska.py", line 103, in event_handler
config = Configuration('config.json')
File "/var/task/haaska.py", line 75, in init
self._json = json.load(f)
File "/var/lang/lib/python3.6/json/init.py", line 299, in load
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
File "/var/lang/lib/python3.6/json/init.py", line 354, in loads
return _default_decoder.decode(s)
File "/var/lang/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/var/lang/lib/python3.6/json/decoder.py", line 355, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 5 column 1 (char 76)

END RequestId: 4220bb83-aaf9-11e8-b59c-ff979af5e237
REPORT RequestId: 4220bb83-aaf9-11e8-b59c-ff979af5e237 Duration: 4.73 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 30 MB

Lambda error with test

I have this error in lambda:
Function result:

"errorMessage": "'header'",
  "errorType": "KeyError",
  "stackTrace": [
     [
       "/var/task/haaska.py",
       660,
       "event_handler",
       "name = event['header']['name']"
     ]
   ]
}

Log output:

START RequestId: ecb6a464-ddbd-11e8-830e-41eea83581b5 Version: $LATEST
'header': KeyError
Traceback (most recent call last):
  File "/var/task/haaska.py", line 660, in event_handler
    name = event['header']['name']
KeyError: 'header'

END RequestId: ecb6a464-ddbd-11e8-830e-41eea83581b5
REPORT RequestId: ecb6a464-ddbd-11e8-830e-41eea83581b5	Duration: 10.01 ms	Billed Duration: 100 ms 	Memory Size: 128 MB	Max Memory Used: 32 MB	

This is my test event:

{
  "directive": {
    "header": {
      "namespace": "Alexa.Discovery",
      "name": "Discover",
      "payloadVersion": "2",
      "messageId": "1bd5d003-31b9-476f-ad03-71d471922820"
    },
    "payload": {
      "scope": {
        "type": "BearerToken",
        "token": "access-token-from-skill"
      }
    }
  }
}

I tried both with payloadVersion 2 and 3, after changing that in the skill.
Here is my config.json:

{
  "url": "https://xxxxxxxxxx/api",
  "password": "xxxxxxxxxx",
  "ssl_verify": false,
  "expose_by_default": true,
  "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": true
}

Perhaps I should mention that my HA (0.81.2) is on https and port 44444
I don't have a clue as where I have to look to get this working...

Thanks.
Frank.

make haaska.zip fail

I'm stuck at make command. so far, these are the steps i took...

  1. sudo apt-get install git zip python-pip
  2. git clone https://github.com/mike-grant/haaska.git
  3. cd haaska/config
  4. mv config.json.sample config.json
  5. sudo nano config.json
  6. key in the URL and password
  7. cd ..
  8. make

it gives this error...

Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 360, in run
    prefix=options.prefix_path,
  File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 247, in move_wheel_files
    prefix=prefix,
  File "/usr/lib/python2.7/dist-packages/pip/locations.py", line 153, in distutils_scheme
    i.finalize_options()
  File "/usr/lib/python2.7/distutils/command/install.py", line 289, in finalize_options
    raise DistutilsOptionError("can't combine user with prefix, "
DistutilsOptionError: can't combine user with prefix, exec_prefix/home, or install_(plat)base
Makefile:10: recipe for target 'haaska.zip' failed
make: *** [haaska.zip] Error 2

please advice. thanks.

SSL certificate needed?

Does this adapter require to setup an SSL certificate on our local installation or does it use websockets like the HASS cloud?

Security risk/opening ports needed?

I have not yet tried haaska, but it looks very promising.
However it is unclear to me how my alexa echo dot communicates to HomeAssistant/Haaska.

  • Does this communication happen locally on my home network between my echo dot and HA/Haaska, or does it communicate through Amazon’s servers on the internet?
  • Do I have to expose my HomeAssistant to the internet in order for Haaska to work?
  • Would I also need to open up ports on my router or is no configuration at the router side needed?
  • How would I actually expose my HomeAssitant instance to the internet in a save way, knowing that I use samba share to edit my config files of HomeAssistant?

Sorry for all these questions, still getting to know Haaska and not still sure about the working.
I hope someone will be willing to help me and answer my (probably) dumb questions..

Thanks in advance!

Rename to allow discovery?

Hey @mike-grant! I've been following the activity on the v3 branch, and it looks like you've come a long way.

To help the discovery of this adapter once you've got it completed (or are willing to let most use it), have you considered renaming it?

Right now, as a fork, searching for haaska only reveals the original project. GitHub sort of "hides" forks behind the fork list. If you rename the project, the fork relationship will be removed, and you'll be discoverable as a result.

No control options for Media Player

Hello,

Many thanks for your Work. I've set up haaska as per the Wiki. All my devices have been discovered but I have no control over Media Player devices. I've listed them in display_categories: TV in Alexa HA Config section but they appear in Alexa without type and no control.

Looking at the bellow link about Smart Home Skills for Entertainment Devices there is support for

Turn things on and off, Change the channel on a device, Change the input of a playback device, Control the playback of device; fast forward, rewind and pause Change the volume in incremental steps, Change the volume to anywhere on a continuous range.

https://developer.amazon.com/docs/smarthome/build-smart-home-skills-for-entertainment-devices.html

Many thanks for your help

No devices Found

I have configured correctly the lambda function, and when I make a test with the config from the instructions is success.

This is my config.json:
{ "url": "https://homeassistantpage.duckdns.org/api", "bearer_token":token_created_from_homeassistant_profile", "debug": true, "ssl_verify": "ca-certificates.crt", "ssl_client": [] }
I tried with ssl_verify: false and true with same result.

This is the log from Lambda:

{'header': {'namespace': 'Alexa.Discovery', 'name': 'Discover', 'payloadVersion': '3', 'messageId': '1bd5d003-31b9-476f-ad03-71d471922820'}, 'payload': {'scope': {'type': 'BearerToken', 'token': 'access-token-from-skill'}}}} [DEBUG] 2018-10-31T19:01:24.67Z 5c4edb46-dd3f-11e8-a0c9-9f35b80dd18d Starting new HTTPS connection (1): homeassistantpage.duckdns.org:443 [DEBUG] 2018-10-31T19:01:24.704Z 5c4edb46-dd3f-11e8-a0c9-9f35b80dd18d https://homehomeassistantpage.duckdns.org:443 "POST /api/alexa/smart_home HTTP/1.1" 200 1599

I can add the Home Skill, but doesn't detect any device. I have redid three times, and same

Documentation Tasks?

I plan on trying to set up the V3 branch this weekend, and will be documenting my experience along the way.

Do you have any changes you're already planning for the documentation? I can submit a PR after I've worked on it a bit if you'd like.

Can home assistant control smarthome devices?

Is it possible for a home assistant script to reach out through alexa or whatever to control smart home devices?
For example, I have a floor lamp that can be controlled by alexa or a phone app, but I want to be able to control it from home assistant.
It seems amazon has gone to extraordinary lengths to make smarthome devices operate one way only.

haaska test failed

in my lambda haaska function, i created this test...

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

When I run the test, the result is failed. This is in the error log...

'directive': KeyError
Traceback (most recent call last):
  File "/var/task/haaska.py", line 1003, in event_handler
    directive = event['directive']
KeyError: 'directive'

Please help.

AWS costs

This is probably a silly question.

I just want to confirm that I didn't configure anything wrongly.
But I configured Haaska the other day. Set up the skill, set up the lambda function. All is done and all is working.

I signed-up for a free tier AWS account. However I am noticing that AWS is starting to bill me. It's just pennies. From what I understand from their billing dashboard they are charging me for bandwidth.

Is this expected? Or did I configure something wrong?
(This is not a real Haaska issue I am aware)

Haaska Support for Cover Component

It is unclear from the documentation if Haaska supports cover components. I have the following cover component defined in my HA config file:

cover:

  • platform: template
    covers:
    garage_door:
    friendly_name: "Shades"
    open_cover:
    service: switch.turn_on
    data:
    entity_id: switch.bank_of_shades
    close_cover:
    service: switch.turn_off
    data:
    entity_id: switch.bank_of_shades
    stop_cover:
    service: switch.turn_off
    data:
    entity_id: switch.stop_all_shades

HA thinks this is a cover and allows me to operate it like a cover. Also, the device that shows up in the Alexa app has a type of "Door". However, when I say "Alexa open shades", Alexa says "Shades doesn't support that". However, if I say "Alexa turn on shades" that works. It is like haaska is somehow converting the cover component to a switch component.

Task timed out after 3.00 seconds when testing Lambda

Hey guys! First let me thank you for your work!

I am quite a newbie with Alexa Skills and here's my issue: when testing the lambda I am having the message "Task timed out after 3.00 seconds" every time, whatever I try. It seems that nothing is actually happening in the back ground.
The points where I am not sure are: 1) did not set a SSL for my endpoint (which is http://ipaddr:port/) as said here and 2) in the test I put "token": "access-token-from-skill" because well... I cannot find the token (I understand that is fetches it with the token URI provided).
I have triple checked everything else.
Sorry if I am missing something obvious but I am lost...
Thanks

New Auth Providers

According to the Dev Blog, new Auth Providers are going to be introduced in the future. This means that eventually the API Password that we use to communicate with HA's Smart Home v3 API will become a legacy feature.

In order to be supported by the new system, we will have to use OAuth2.

We'll have to look at how this can be implemented in the skill, in addition to allowing for automatic token refreshes.

can't get past this error when running test: "errorMessage": "Unable to import module 'haaska'"

The AWS log is below. I deleted and recreated it a second time and got the same results.

The error listed first "errorMessage": "Unable to import module 'haaska'"

detailed logs from amazon:

04:45:37 START RequestId: 66c3d855-93b3-11e8-8cad-910fc8f1f1de Version: $LATEST
04:45:37 Unable to import module 'haaska': No module named '_cffi_backend'
04:45:37 END RequestId: 66c3d855-93b3-11e8-8cad-910fc8f1f1de
04:45:37 REPORT RequestId: 66c3d855-93b3-11e8-8cad-910fc8f1f1de	Duration: 0.59 ms	Billed Duration: 100 ms Memory Size: 128 MB	Max Memory Used: 48 MB
04:51:33 START RequestId: 3b5da7db-93b4-11e8-a001-9f6dcd299493 Version: $LATEST
04:51:33 Unable to import module 'haaska': No module named '_cffi_backend'
04:51:33 END RequestId: 3b5da7db-93b4-11e8-a001-9f6dcd299493
04:51:33 REPORT RequestId: 3b5da7db-93b4-11e8-a001-9f6dcd299493	Duration: 4.25 ms	Billed Duration: 100 ms Memory Size: 128 MB	Max Memory Used: 48 MB

Information

Hi @mike-grant! It looks like you’ve updated the code here to work with v3.

How’s the progress? Do you think it’s in a usable state?

AWS Region

Does it matter which region I use in AWS. Some guides same N. Virginia and others say the region in which your account is created. I have all my lambda working but Alexa cannot find any devices.

500 Server Error: Internal Server Error for url: http://****:8123/api/alexa/smart_home

Not able to get past the Lambda test.

HA: 0.64

START RequestId: 26 Version: $LATEST
[DEBUG]	2018-02-28T20:30:01.563Z	26	calling alexa/smart_home with {'header': {'payloadVersion': '2', 'namespace': 'Alexa.ConnectedHome.Discovery', 'name': 'DiscoverAppliancesRequest', 'messageId': 'F8'}, 'payload': {'accessToken': '1'}}
[DEBUG]	2018-02-28T20:30:01.565Z	26	Starting new HTTP connection (1): *****
[DEBUG]	2018-02-28T20:30:01.926Z	267	http://****:8123 "POST /api/alexa/smart_home HTTP/1.1" 500 141
500 Server Error: Internal Server Error for url: http://****:8123/api/alexa/smart_home: HTTPError
Traceback (most recent call last):
  File "/var/task/haaska.py", line 108, in event_handler
    return ha.post('alexa/smart_home', event, wait=True).json()
  File "/var/task/haaska.py", line 62, in post
    r.raise_for_status()
  File "/var/task/requests/models.py", line 935, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: http://***:8123/api/alexa/smart_home

END RequestId: 2
REPORT RequestId: 26	Duration: 381.95 ms	Billed Duration: 400 ms 	Memory Size: 128 MB	Max Memory Used: 29 MB	


500 Server Error: Internal Server Error for url: http://****:8123/api/alexa/smart_home: HTTPError
  smart_home:
    filter:
      include_domains:
        - alert
        - automation
        - cover
        - fan
        - group
        - input_boolean
        - light
        - media_player
        - scene
        - script
        - switch
Error handling request
3:31 PM components/alexa/smart_home.py (ERROR)

Device no response

I switched from auchter/haaska to this branch. And updated the payload to v3.
I disabled and re-enabled the skill and linked again to my account.
It successfully discover all my HA devices, but none of them response to the command.

"Echo, turn off the door light"
"Door light is not responding"
"Echo, turn off the homeAC"
"HomeAc is not responding"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.