I have created a script based on Alexa TTS that I use to pass dynamic content to make announcements. Is there a way to know when a TTS message has completed or when the script has completed so I can use a wait template before sending the next TTS message?
- id: family_greeting
alias: Family Greeting
trigger:
platform: state
entity_id:
- binary_sensor.cameron_home
- binary_sensor.corey_home
- binary_sensor.courtney_home
- binary_sensor.mom_home
- binary_sensor.morgan_home
- binary_sensor.wendy_home
- binary_sensor.andy_home
- binary_sensor.jasmine_home
- binary_sensor.brandon_home
from: 'off'
to: 'on'
for: '00:00:05'
action:
- wait_template: "{{ is_state('script.say_greeting', 'off') }}"
- service: script.say_greeting
data_template:
entity_id:
- "media_player.livingroom,media_player.bedroom,media_player.courtneys_room"
- media_player.fire_speaker
person: >
{{ trigger.to_state.name }}
{%- for s in states.binary_sensor
|rejectattr('entity_id','eq',trigger.entity_id)
|selectattr('state','eq','on')
if '_home' in s.entity_id and
(now() - s.last_changed).total_seconds() < 60 -%}
{{ (' and ' if loop.last else ', ') ~ s.name }}
{%- endfor %}
message: >
{{ ["Welcome back home PERSON",
"Guess who is home PERSON is!",
"PERSON is now in the house.",
"Welcome Home PERSON We have missed you Or at least I did.",
"Attention Everybody PERSON is home I repeat PERSON is home Welcome home PERSON",
"Our home is now complete, Rest your head and relax your feet, Welcome Back PERSON",
"Life is like a song, you’re back where you belong, Welcome home PERSON",
"Hey there PERSON Welcome Home!",
"Knock Knock. Who is There? PERSON is!",
"PERSON, you are home!",
"I know a secret. PERSON is home!",
"PERSON it's nice to see you again. Right where you belong. Welcome home PERSON",
"O M G it's PERSON. Oh how I missed your face. Welcome home",
"Welcome back to the best house in th 3 3 0 PERSON",
"Oh Goodie PERSON is home. Welcome back",
"When PERSON is here we are complete. Its nice to see you PERSON"
"Its not the same when PERSON isn't here, so from the MAXIM's welcome home"
] | random }}
[/quote]
This is what I use to welcome my family home, Feel free to change it based on your needs.
OK, since I couldn’t get my question above answered I just gave it a shot…
I put the alexa.py script in the custom_components/media_player/ directory and I put the entry into the configuration.yaml with no quotes.
restarted HA.
Here is what I got:
the configurator window pops up and when I click on “configure” I get the captcha box. After I put in the captcha code the captcha box closes but the configurator box remains.
I don’t see any of my echo dots in my entities.
If I click the configure button again the new captcha pops up and says failed to login. I’ve tried a few times to re-enter the different captcha’s just to make sure I didn’t enter them wrong.
I get the following error in the log:
2018-08-09 09:36:28 ERROR (SyncWorker_8) [custom_components.media_player.alexa] Error loading pickled cookie to /config/alexa_media.pickle: An exception of type FileNotFoundError occurred. Arguments:
(2, ‘No such file or directory’)
With the latest release after a reboot I was presented with the capthca. It kept saying that I’d typed it in wrong so I entered nothing and submitted it, after that I was presented with another captcha and I DID enter it. That worked.
It looks like your say_greeting script is very similar to my audio_notify script. My problem is that I don’t know a good way to determine when the script is off or when my echo has finished playing the dynamic content in short TTS bursts. For example, I come home there are several TTS announcements that occurs back to back.
Random welcome message
Temperature report and setting for two different thermostat
Confirm you don’t have 2FA enabled and you can log into amazon without needing anything other than the password. I disabled 2FA to test this component and after you make a change to your amazon account the subsequent log-on can require an additional verification step (enter code from text/e-mail). After I sorted my normal amazon log-in the component work flawlessly.
I’ve never used 2FA on my amazon account so I’m sure that’s not the problem. And I haven’t gotten any warning emails from Amazon about any failed login attempts.
Could a special character in the password cause issues? I have a # buried in there.
Even with 2FA off they can ask to receive a code to verify your new login.
The # is likley the issue. In Yaml a # is interpreted as everything after (including the #) is ignored. I would try putting ‘quotes’ or “quotes” around your password. HA can be picky about quotes so be sure to try both if the first doesn’t work.
I tried putting both " and ’ around the whole password but it’s still failing.
However I never thought about the # in the password being seen as a comment. Duh… I’ve been commenting yaml files for a year and until just now I never thought about that being a problem!
Unfortunately in this case it didn’t seem to work.
I even tried to delete the pycache folder in the custom component directory and still no luck.
So I guess using the # in passwords without quotes should work in a yaml file. At least it does everywhere else in HA that I’ve used the same form of password.