So in your case you’re not using routines?
No I couldn’t get it to work. When I tried to create it in the Amazon console, It kept telling me it can not connect to the URL.
So i adapted it to Intents.
Yeah, that is one of the annoying side effects of flash briefings. They require https and do not support lets encrypt certificates
yes, how did you set it up? The ssl.
My solution was to use amazon lambda microservice API gateway. Using most of the instructions provided here:
However, I changed the lambda code to simply relay the message from HA.
from __future__ import print_function
import json
import urllib
import datetime
def respond(err, res=None):
return {
'statusCode': '400' if err else '200',
'body': json.dumps({
"uid": res['uid'],
"updateDate": res['updateDate'],
"titleText": res['titleText'],
"mainText": res['mainText'],
"redirectionUrl": "HOME-ASSISTANT-URL"
}),
'headers': {
'Content-Type': 'application/json',
},
}
def lambda_handler(event, context):
print(event)
print(context)
response = urllib.request.urlopen('https://HOME-ASSISTANT-URL/api/alexa/flash_briefings/alexa?api_password=password')
html=response.read()
rawdata = json.loads(html)
return respond(None, rawdata[0])
Hi Keaton, finally got a AWS account
Looking for some guidance
on our py code i pressume I have to change this:
“redirectionUrl”: “HOME-ASSISTANT-URL”
and
response = urllib.request.urlopen(‘https://HOME-ASSISTANT-URL/api/alexa/flash_briefings/alexa?api_password=password’)
ok Keaton, so yes. Changed that and the Lambda works!
now how do I add it to the amazon briefing console. If I pick Flash Briefing Api, there’s only URL option.
In the lambda instance under Triggers you should see something like this:
The invoke URL is what you need to provide in the flash briefing url in the alexa developer console. Also, see the tutorial instructions provided above.
Thank you very much. Got it working now.
Hi Im trying to get this work but having an issue hopefully you guys dont mind helping me with. I was trying to setup the flash briefing but ran into the not connecting because of my lets encrpyt cert.
So I found this thread and created another lambda function hoping to go that route. Im getting this when I try and access the invoke url. {“message”: “Internal server error”}
my ha config is: (just testing with something simple first)
alexa:
flash_briefings:
test:
- title: Who is watching Plex?
text: "{{states('sensor.plex_template')}}"
This is the function code:
from __future__ import print_function
import json
import urllib
import datetime
def respond(err, res=None):
return {
'statusCode': '400' if err else '200',
'body': json.dumps({
"uid": res['uid'],
"updateDate": res['updateDate'],
"titleText": res['titleText'],
"mainText": res['mainText'],
"redirectionUrl": "https://xxx.xxx.xxx/"
}),
'headers': {
'Content-Type': 'application/json',
},
}
def lambda_handler(event, context):
print(event)
print(context)
response = urllib.request.urlopen('https://xxx.xxx.xxx/api/alexa/flash_briefings/alexa?api_password=stayout12!')
html=response.read()
rawdata = json.loads(html)
return respond(None, rawdata[0])
Im thinking this might be wrong but idk what to use?
"redirectionUrl": "https://xxx.xxx.xxx/"
I would really like to add it as a flash briefing, its just not possible with lets encrpypt at all?
thank youuuu!!!
When I use the flash briefing way, if I take the url for the flash briefing and put it into a browser i get what amazon should be getting. So the hang up is due to the cert for sure?
thank you so much for sharing this. i feel this is much better than the official instruction. now it works with let’s encrypt SSL.
Can someone confirm if the Official Alexa Flash Briefing is working?
I’m geting an “401 - Unaurhorized” error when I try to open the URL: “https://YOUR_HOST/api/alexa/flash_briefings/BRIEFING_ID?api_password=YOUR_API_PASSWORD”.
Any my legacy API_PASSWORD is correct and working fine to access the UI.
Im unsing HA 0.102.1
are you sure that the legacy API_PASSWORD is working?
because a lot of users already mentioned that it isnt working anymore since release 101, HA took out the deprecated api password as i heard.
Yes. It is still working if it is added as an auth_providers type (not in the http header).
If API_PASSWORD is depreciated, how the alexa flash breafing url is supposed to be authenticated?
i dont know how to do it in that case, but i get a lot of reports from people that used api password for cam on HADashboard, that say it isnt working anymore since 101.
and its been deprecated for a long time.
and i got a hard time understanding what they actually mean in the blog:
API Password and trusted networks
It is no longer possible to make authenticated requests using trusted networks or by appending
?api_password=X
to the URL. You will now first need to get an authentication token and use that token to make requests.These features were deprecated in Home Assistant 0.90 and 0.91 (released around April 2019). It was initially planned to be dropped in Home Assistant 0.96 (released July 17, 2019).
The support of configuring the auth providers for API Password and Trusted Networks via the HTTP configuration is also removed. It now needs to be configured in the auth provider section (docs).
Direct authentication meant that you could make an authenticated request without a bearer token by making the request from a trusted network or appending
?api_password=X
to the URL.These features are still available as authentication providers (docs).
I confirm that the API_PASSWORD doesn’t work anymore in the http header but it is still possible to use it as an auth provider type. I tested and it is working but for some reason it is not working in the Alexa Flash Breafing url. Either the integration or the documentation for Alexa Flash Breafing has to be updated because right now it is not usable.
Do you know How can this be officialy reported?
homeassistant:
auth_providers:
- type: homeassistant
- type: legacy_api_password
api_password: <mypasswordhere>
Alexa API error: (https://YOUR_HOST/api/alexa/flash_briefings/BRIEFING_ID?api_password=YOUR_API_PASSWORD)
401 - Unauthorized
create an issue on github.
Issue created
The isse was closed without taking any action… Very disappointed…
Someone said that API_PASSWORD has been deprecated that is something that we already know. In the meantime, the Alexa Flash Breafing is useless in Home Assistant.
I don’t understand why the close the issue if the problem is still there.
Can someone create another issue? Just copy what I put in the one above.