Some nice fellow pointed out this possibility to me on Facebook and I really like that my TTS announcements are no longer subject to the frequent reauthentication whims of Alexa Media Player after implementing this, so I thought I would share a guide.
It is actually possible to make announcements using this method and bypassing Alexa Media Player entirely. This has some advantages, the big one being that you will not lose your announcement capabilities every time that Alexa Media Player loses itâs authentication (which happens every couple weeks for me, and which is why Iâm moving my Alexa announcements over to this method). The downside is that itâs quite a bit more configuration to do and you need Nabu Casa or the Alexa Custom Skill set up, and you cannot use dynamic text, it has to be a fixed message. Hereâs how itâs done:
first make a very simple script with no actions as a tag for the announcement you want to make:
script:
announce_dishes_are_clean:
sequence:
Then make a template binary)sensor which reads the on/off value of the script and converts it into a motion sensor:
binary_sensor:
- platform: template
sensors:
announce_dishes_are_clean:
device_class: motion
value_template: "{{ states.script.announce_dishes_are_clean.state == 'on' }}"
Then you will need to sync your alexa entities in the nabu casa configuration (ensure that you have binary_sensors set to sync or at least the individual sensor you are adding).
and and turn on the option to sync the entity states
then you will need to create a matching routine in the alexa app to actually read out the announcement when it sees the state change of our dummy movement sensor:
You can now test to see if it works in the developer tools. If it does, you should hear your announcement:
Then you can use it as a service call in your automations and never worry about reauthentication of Alexa Media breaking it again:
- id: kitchen_bar_alexa_notify_clean_dishes
alias: "TTS Notify Clean Dishes to Kitchen Bar Alexa"
initial_state: 'true'
trigger:
platform: state
entity_id: sensor.bosch_dishwasher_door
to: 'open'
condition:
condition: and
conditions:
- condition: template
value_template: '{{ (as_timestamp(now()) - as_timestamp(states.automation.fire_notify_clean_dishes.attributes.last_triggered | default(0)) | int > 150)}}'
- condition: or
conditions:
- condition: state
entity_id: input_select.bosch_dishwasher_status
state: 'Clean'
- condition: state
entity_id: input_select.bosch_dishwasher_status
state: 'Emptying'
action:
- service: script.announce_dishes_are_clean