Comments (25)
@esabea - Ok. I will be testing this myself tonight.
I normally use it with SSL Verify false, so I will try turning that on with my certificate too.
do not worry ... I have managed to solve the simplest way in the world, repeating everything from the beginning!
from haaska.
@jaburges See this other issue: #59
from haaska.
Hey mike, Thanks for the reply! I get 404 for the API and 405 for api/alexa/smart_home. I don’t understand why api would throw a 404... any ideas? Thanks!
…
On 28 Oct 2018, at 07:39, Anthony Lavado @.***> wrote: @chimpy Hey there. If you go to "https://haas.mydomain.com/api/" (obviously with your actual domain in there), do you get anything back? It should be a "401: Unauthorized". Similarly, if you manually browse to "https://haas.mydomain.com/api/alexa/smart_home", you should get a "405: Method Not Allowed". — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
so been messing around with this. Check 3 things:
- the URL matches your EXTERNAL url http://blah.domain.suffix/api (you may need port 8123)
- if you need port 8123 in your URL make sure you have port forwarding for that port
- check if both cloud alexa and alexa smart_home are both enabled
- if you use !include to split out your config - put all the alexa contents in the config.yaml
Anyway hope this helps someone who finds it
from haaska.
@chimpy Hey there.
If you go to "https://haas.mydomain.com/api/" (obviously with your actual domain in there), do you get anything back? It should be a "401: Unauthorized".
Similarly, if you manually browse to "https://haas.mydomain.com/api/alexa/smart_home", you should get a "405: Method Not Allowed".
from haaska.
from haaska.
@chimpy Hey there again. (As a note, this is Anthony, not Mike. I handle most of the issues, as well as write the Documentation and Wiki).
Unfortunately, I'm not sure where the issue could be in API giving you the 404. It certainly means that that there's a communication issue somewhere, and this is why the Lambda function is having trouble. It needs to be able to reach that page as well in order to login.
I would start by double checking all your port forwards/instructions and go from there.
from haaska.
@anthonylavado Apologies for that...was replying by mail and just got up :/
What's weird is that all my other stuff is working: Homekit, Google Assistant, LIFX, Lightify, Xiaomi. It's all working with no problems. Apart from the Lambda function. This is on 0.81 btw. Apart from creating a LLAT for the new auth system to work, is there anything else I should have done?
Thanks again.
from haaska.
@anthonylavado Ah sorry! I was entering hass.domain.com/api - without the slash. hass.domain.com/api/ gives me back a 401 as you say it should.
Again, to resume:
/api/ gives 401.
/api/alexa/smart_home gives 405.
from haaska.
@chimpy I’m really sorry, but I don’t know where to go further from here. https is definitely the way to go, and the Haaska code adds the slash for you, so it looks like you’ve done everything correctly.
My last two thoughts:
- Do you need a port number for Home Assistant? My URL for example: “https://myhass.example.com:8123/api”
- Can your HA install be reached from the internet? If not, you might need to add port forwarding on your router (but it sounds like this is working already)
from haaska.
Hi there,
I'm getting the same in the test output.
Now I use synology which uses a reverse proxy (just an inbuilt NGINX).
I can browse to http://HA_URL/api/ and get 401 unauthorized and i'm getting unauthorized attempt from local IP (but not anything in the log from AWS).
I use a wild card cert in the Synology reverse proxy - which leads me to wonder as this request isnt coming from the expected URL that the cert is tied to NGINX isnt allowing it through.
Apologies, i'm not great with certs - just enough to get HA running on a custom domain with a wildcard.
Which cert file is needed, and where would the best place be to put it (and referenced in the config.json)
appreciate any help!
from haaska.
thanks @anthonylavado my apologies (i've been trying to troubleshoot and assumed it was something it wasnt)
I'm a little confused by the difference between alexa cloud and alexa.
Cloud:
cloud:
alexa:
filter:
[stuff]
Alexa:
alexa:
smart_home:
filter:
[stuff]
I get 404 on the http://URL/api/alexa/smart_home/
is there anyway to troubleshoot whether the issue is cloud, my edge/perimeter or HA itself?
from haaska.
@jaburges - For Haaska, you must use the Smart Home API, which is the second example you listed. The one that begins with alexa:
.
The cloud one is only for when you use the official, paid cloud connector from Nabu Casa/Home Assistant.
Once the Smart Home API is in your config, the API URL (“.../api/alexa/smart_home”) should show error 405. Once that is working, then Haaska can discover your devices and work.
Let me know if I can help with anything else 😄
from haaska.
Thats the thing - i have enabled the latter, and not getting 405. (and also big thanks for your help with this).
I'm just rebuilding to see if using https://URL/api and the ssl verify with the cert will solve it, but I cant help coming back to the fact that i'm not getting 405 using the URL.
I'm using a public hosted URL with a wildcard cert (as use subdomains for specific services) - forwards to public IP on router, router port forwards to synology box, NGINX reverse proxy forwards to specific ports (as the services are in docker containers) from specific subdomains. ie
HA.URL.com [80] > public IP [80] > synologyIP [80] > NGINX synology [8123] (same deal for 443)
any other way to check if smart_home api is functioning? GET or POST to it directly?
from haaska.
@jaburges - Trying to load the page is the same as doing a GET, so if that isn’t working, it’s definitely a communication issue somewhere along the way. Is there any way you can try loading the URL with the internal IP address for Home Assistant?
from haaska.
ok think i've found it. in moving from alexa / cloud to alexa / smart_home i used
alexa: !include dir/alexa.yaml
i've noticed that some HA components are fussy (or i'm simply not formulating it correctly in the file.yaml)
moving this directly to the config.yaml the test passes.
now to move it to https:// with the cert
thanks again for the help!
from haaska.
sorry.....I have this error and I do not know how to solve it (I have tried many things already ...)
My config.json is this
{
"url": "https://myhost/api",
"bearer_token": "My Long-Lived token",
"debug": true,
"ssl_verify": true,
"ssl_client": "fullchain.pem" -> ssl_certificate of configuration.yaml (located in the same directory of config.json)
}
this is muy "test" of lambda function
{
"directive": {
"header": {
"namespace": "Alexa.Discovery",
"name": "Discover",
"payloadVersion": "3",
"messageId": "1bd5d003-31b9-476f-ad03-71d471922820"
},
"payload": {
"scope": {
"type": "BearerToken",
"token": "My Long-Lived token"
}
}
}
}
and this is the results when I execute
Response:
{
"errorMessage": "HTTPSConnectionPool(host='[myhost]', port=443): Max retries exceeded with url: /api/alexa/smart_home (Caused by SSLError(SSLError(336265225, '[SSL] PEM lib (_ssl.c:3309)'),))",
"errorType": "SSLError",
"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",
514,
"send",
"raise SSLError(e, request=request)"
]
]
}
Request ID:
"1051387e-de9d-11e8-bc7b-81abac981004"
Function Logs:
START RequestId: 1051387e-de9d-11e8-bc7b-81abac981004 Version: $LATEST
[DEBUG] 2018-11-02T12:44:40.1Z 1051387e-de9d-11e8-bc7b-81abac981004 calling alexa/smart_home with {'directive': {'header': {'namespace': 'Alexa.Discovery', 'name': 'Discover', 'payloadVersion': '3', 'messageId': '1bd5d003-31b9-476f-ad03-71d471922820'}, 'payload': {'scope': {'type': 'BearerToken', 'token': '[my token]'}}}}
[DEBUG] 2018-11-02T12:44:40.3Z 1051387e-de9d-11e8-bc7b-81abac981004 Starting new HTTPS connection (1): [myhost]:443
HTTPSConnectionPool(host='[myhost]', port=443): Max retries exceeded with url: /api/alexa/smart_home (Caused by SSLError(SSLError(336265225, '[SSL] PEM lib (_ssl.c:3309)'),)): SSLError
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 62, in post
timeout=(None, read_timeout))
File "/var/task/requests/sessions.py", line 572, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/var/task/requests/sessions.py", line 524, in request
resp = self.send(prep, **send_kwargs)
File "/var/task/requests/sessions.py", line 637, in send
r = adapter.send(request, **kwargs)
File "/var/task/requests/adapters.py", line 514, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='[myhost]', port=443): Max retries exceeded with url: /api/alexa/smart_home (Caused by SSLError(SSLError(336265225, '[SSL] PEM lib (_ssl.c:3309)'),))
END RequestId: 1051387e-de9d-11e8-bc7b-81abac981004
REPORT RequestId: 1051387e-de9d-11e8-bc7b-81abac981004 Duration: 258.31 ms Billed Duration: 300 ms Memory Size: 128 MB Max Memory Used: 29 MB
and the last.....the configuration.yaml is
alexa:
smart_home:
filter:
include_entities:
- light.xxxxx
- sensor.xxxx
entity_config:
light.xxxxx
name: name of light
description: description of light
display_categories: LIGHT
sensor.xxxxx:
name: name of sensor
description: description of sensor
display_categories: TEMPERATURE_SENSOR
Can help me?
from haaska.
@esabea - Hey there! Use cert.pem
instead of fullchain.pem
.
from haaska.
@esabea - Hey there! Use
cert.pem
instead offullchain.pem
.
nothing .... the result is the same "Max retries exceeded with url: /api/alexa/smart_home"
from haaska.
@esabea - If you go to the URL in a web browser (“https://myhost/api”), what message do you get?
If you go to the smart_home API (“https://myhost/api/alexa/smart_home”), what message do you get?
from haaska.
405: Method Not Allowed
from haaska.
if I use this config.json
{ "url": "https://[myhost]/api", "bearer_token": "[long token]", "debug": true, "ssl_verify": false, "ssl_client": [] }
I view a Login attempt in HA UI from a IP (Amazon)
I checked that the token is correct doing this
curl -X GET \ https://[myhost]/api/error/all \ -H 'Authorization: Bearer [token]'
and this if it works
from haaska.
@esabea - Ok. I will be testing this myself tonight.
I normally use it with SSL Verify false, so I will try turning that on with my certificate too.
from haaska.
Thanks to all who troubleshooted in this thread. Apologies to @chimpy as it got a bit cluttered.
Closing for now. If anyone needs help, please open a new issue.
from haaska.
Until today all working great. But today I decided to buy a new router (fritz box 7530). I've set same SSID, same password, same statics ip... And lambda test get error like this post. What can be the problem?
Update:
After a couple of try, with a router fritz box 7530,i get it working with appending 8123:
{
"url": "https://xxx.duckdns.org:8123/api",
"bearer_token": "yourtoken",
"debug": false,
"ssl_verify": true,
"ssl_client": []
}
from haaska.
Hi @itajackass,
It’s usually best to make a new issue. I’ll open one now.
from haaska.
Related Issues (20)
- IPV6 connection HOT 1
- Skill can't find devices HOT 1
- Make failed
- core-2022.2.6 HOT 1
- “Unable to import module ‘lambda_function’” HOT 4
- Upgrade to Python 3.9 HOT 8
- 404 Client Error HOT 2
- Help with 401 Error with Haaska integration HOT 1
- get_url method breaking some URLs HOT 1
- 502 bad gateway going through NGINS reverse proxy
- tts not working HOT 2
- Linking Alexa Skills Kit to Login With Amazon scope incorrect HOT 1
- IPv6 support HOT 1
- I'm having an issue HOT 1
- SKILL_DISABLED_EXCEPTION after enabling proactive events HOT 1
- Address family not supported by protocol
- Wiki step #5 & #6 ?
- The wiki documentation is outdated HOT 1
- smart_home: still working? HOT 1
- Linking Skill I get 404:not found HOT 1
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 haaska.