šŸ§Æ Door open tts.cloud_say and Piper Announcer (Piper OR Nabu-Casa required)

Works with BOTH Piper and Nabu-Casa tts-cloud-say. This blueprint is set up to watch a binary sensor. When it goes from off to on (closed to open) it triggers a message to be sent to the google enabled speaker of your choice. The message will play after a delay you set and repeat on that same delay until the switch returns to off (closed), at which time it sends a different message. The delay time and all the other parameters are adjustable.

:bookmark_tabs: Changelog

  • 2024-06-08: Blueprint Input Sections for enhanced Descriptions.
    • (Documentation change 2-7-2024 to add License notice. Changes only to Descriptions.)
  • 2024-04-22: The gender option for text-to-speech in the Home Assistant Cloud integration is deprecated
  • 2023-10-02: Add the ability to use Piper TTS.
    • File Rename to reflect new function.
    • Old Automatons will still work when pointed to new BP file name.
    • Added {{ door }} variable for users to plug into the messages.
    • Fixed Bug where crashed if multiple door sensors were selected.
  • 2023-09-22: Add silencing ability if the warning never triggers.
  • 2023-08-17: Add voice ability
    • Fix language list
    • Add Weekday ability
    • Set door close timing to soon after door closes
  • 2023-08-07: Updates for Home Assistant 2023.8
    • Selector syntax change
    • Condition Selector addition (where applicable)
    • MQTT Discovery name changes (where applicable)
    • Clean-up code formatting
  • 2023-03-01: Add Author Tag. Bump HA required Version to 2023-3-0
  • 2022-12-12: Add Update Method Note, minor code change.
    • Name of Blueprint may have changed meaning you have to re-download with a new link.
    • If name changed, it is similar. Variables have not changed.
  • 2022-05-05: Updated for 2022.5.0 HA. Added Markdown to !input Descriptions.
  • 2022-04-11: Add multiple to Speaker Selection and changed minimum HA to 2022.4.0
  • 2022-01-03: Remove ā€˜Doorā€™ restriction on input sensor, and expanded description.
  • 2021-12-24: Add pick list of all the available languages and dialects.
  • 2021-10-29: Add the ability to select the time-frame the announcement will be active
  • 2021-09-03: Add Description
  • 2021-06-16: First blueprint version :tada: Needs Home Assistant Core 2021.3 or higher and Nabu-Casa to work

:crystal_ball: About this blueprint

Type of blueprint: AUTOMATION

What if I am having problems getting it going?

You can contact me for help, see the links below.

Why do I need this?

This is a TTS.cloud-say version of another Door Announcer I found in the HA Blueprint Exchange. For people that have Nabu-Casa, TTS.cloud-say is far superior to TTS.google_say as it adds languages and gender to the voices available. If you are a Nabu-Casa subscriber, I highly recommend using this.

This blueprint is set up to watch a binary sensor. When it goes from off to on (closed to open) it triggers a message to be sent to the google enabled speaker of your choice. The message will play after a delay you set and repeat on that same delay until the switch returns to off (closed), at which time it sends a different message. The delay time and all the other parameters are adjustable.

There are ways to enable the announcement only during time slots and/or specific weekdays, so you could have a different message every day of the weekā€¦

:moyai:License Notice:

  • Copies of the original Blueprint that were converted via the ā€˜Take Controlā€™ feature or other means are officially not supported by me.

  • I may or may not be able to support you when you have a problem after you make changes to my code, as some of the code is no longer mine.

  • I & my license also require attribution as a link back to the original should you use this code in your own creation.

  • Here is a link to my license & the original github post expected to be followed & referenced as attribution should you use this code elsewhere.

:wrench: Configuration

Requirements

  • 1 binary_sensor entities to sense the action you are announcing

  • 1 media_player, group of media _players, or list of media_players to send the words to

  • Pick a gender and language from Cloud TTS

  • Pick a voice from hass-nabucasa/hass_nabucasa/voice.py at master Ā· NabuCasa/hass-nabucasa Ā· GitHub

    NOTE: For version 2023-10-02 the filename was changed to reflect the large change in function. To update, import the new Blueprint, and edit the prior automation to use the filename for the new BluePrint. Then delete the old BluePrint. Your old Automation for the prior version is compatible with the new blueprint with the exception of the path/name.

:card_index_dividers: Input fields

door_entity: 'Door Sensor (or any binary_sensor will do...)'
    Entity that causes the announcement. Actually any entity that 
    changes its state from off to on will work here, You would
    just need to enter the entity manually if it's not a
    binary sensor.

speaker_target: Speaker
    Entity to announce event on

tts_service: 'Text to Speech Processor'
    Select the configured TTS engine for media_player notifications.
    [SEE for details](https://www.home-assistant.io/integrations/#text-to-speech)

announcement_message: Announcement message
    What to say when door is opened.
    The variable {{ door }} is available if you want the dynamic
      friendly_name of the device that triggered.
    This can be set to "" if you do not want a message while sensor is active.

final_message: Final message
    What to say when door is closed.
    The variable {{ door }} is available if you want the dynamic
      friendly_name of the device that triggered.
    This can be set to "" if you do not want a message after the sensor is reset.

speaker_language: Speaker Language
    Select Language code.
    [See here for Details](https://www.nabucasa.com/config/tts/)

speaker_voice: tts_cloud (Nabu Casa) Voice
    ***Here you need to be careful.***
    If you are OK with the default voice then just leave this field empty.
    If you want to change the voice, you need to pick from [This List, TTS_VOICES section](https://github.com/NabuCasa/hass-nabucasa/blob/master/hass_nabucasa/voice.py)
    being certain to match the country code you picked above with one of
    the voices available for that country code on that list.

piper_voice: Voice option for the Piper addon played thru Wyoming
    Used only on Piper.
    [Voice List Here](https://huggingface.co/rhasspy/piper-voices/blob/main/voices.json)
    Also available in the Add-on UI configuration dropdown.
    If a new one is available you can enter it manually.

cooldown: Announcement cooldown
    The minimum number of seconds needed before AND between between
    announcements.

reminded: 'Did I remind you?'
    This is optional.
    You can leave this at the default (empty) and the behavior of the BP will
    be exactly what it was in the past. This ensures your old set-up will not
    break if you upgrade the BluePrint.
    Or if you create an 'input_boolean'/'toggle' helper and put the name in
    here, the behavior will be the door is silent as long as you do not
    exceed the time it takes to get to the warning message that the door is
    open. If that warning message triggers once, it will then thank you after
    you close it.

start_time: StartTime
    Time of day you want to enable the announcement each day.

end_time: EndTime
    Time of day you want to disable the announcement each day. 

additional_conditions:
    Extra conditions you may want to add to this automation 
    (Example: Home occupied, TV on, etc)

:dna: Walk-thru:

  1. The header of the Blueprint contains the required info plus the URL from where it came from.
  2. The input: section is where it gets the information it needs to fill in the blanks. This information is stored in the actual automation referencing this Blueprint when executing the task.
  3. The Trigger section will start everything when your Binary Sensor changes state from off to on.
  4. Once triggered it goes into a repeat loop that starts with the delay time selected. This repeat loop will immediately abort if the binary sensor flips back to off. If the binary sensor stays on long enough to get passed the delay time, the initial announcement will be sent to the speaker and it will cycle back to the top and start the repeat loop again.
  5. When the binary_sensor flips to off it will play the closing message,

:sun_with_face: :snowflake: Troubleshooting tip

If you are troubleshooting and you want to see more traces back when doing so, here is a TIP Iā€™ve found.
Manually edit the automation created with the ui editor (or manually with a text editor) and add the following to have this automation contain 10 traces instead of the normal 5. Then if the automation is triggering often, you can see the last 10 traces to help you decide what the issue is.
HA Docs on this here.

trace:
  stored_traces: 10

:envelope_with_arrow: Version Updates

Updates will be published on my GIT repository with the rest of my Home Assistant Blueprint collection.

:envelope_with_arrow: There is not an official version control system for Blueprints. However I have found something that comes pretty close. It is not perfect, but for MOST Blueprints, it does just fine. I encourage you to check this script out and use it to easily check if I have updated this blueprint. :link:koter84 Blueprint Update Script

Please Click the :orange_heart: at the end of this top Post if you find this Useful

:calling: Software to Download :floppy_disk:

HA link to download blueprint: Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Direct link to download Blueprint: https://github.com/SirGoodenough/HA_Blueprints/blob/master/Automations/door_open_tts_cloud_say_and_Piper_announcer_Piper_OR_nabu_casa_required.yaml

:globe_with_meridians: All My Blueprints

Link to ALL my Blueprints

https://github.com/SirGoodenough/HA_Blueprints/blob/master/README.md

:man_juggling:t5: Contact Links or see my other work

What are we Fixing Today Homepage / Website: https://www.WhatAreWeFixing.Today/

Channel Link URL: (WhatAreWeFixingToday) https://bit.ly/WhatAreWeFixingTodaysYT

Discord Guild: (Sir_Goodenough#9683) WhatAreWeFixingToday?

:cheese: If you want to support me

Buy me Coffee: https://www.buymeacoffee.com/SirGoodenough

PayPal one-off donation link: PayPal.Me

#WhatAreWeFixingToday

#SirGoodEnough

5 Likes

Nice idea. Would use it if it offered an option to configure a door open persistent time period. I mean: if the door is open for more than X sec./min. then make the voice announcement. Like the example show on Nabu Casa page:

Below is an automation which plays a spoken message to a specific media player when a sensor has had an open state for 10 minutes.

- id: DoorOpen10min
  alias: Door is still open
  trigger:
    platform: state
    entity_id: sensor.garage_status
    to: Open
    for:
      minutes: 10
  action:
    service: tts.cloud_say
    data:
      entity_id: media_player.family_room_speaker
      message: the door has been open for 10 minutes
      options:
        gender: female
      language: en-US
2 Likes

It does that. The delay before message is in the start of the sequence before it plays the message, so set it for 600 seconds, it will delay 10 minutes play message, repeat until the binary sensor flips back.

    repeat:
      sequence:
        - delay: !input cooldown 
        - service: tts.cloud_say

If the binary-sensor flips back before it plays, you hear nothing.

1 Like

Oh, good to know that. I read this in the code, and I didnā€™t see a for: minutes: X so I thought the announcement would be made at every status change.

trigger:
  platform: state
  entity_id: !input door_entity
  from: "off"
  to: "on"

Thatā€™s fine, glad to help.

TTS Nabu Casa stopped working today. Does anyone have the same problem?

I love this blueprint!! but couldnā€™t find an option do set a period of time to run the automation. Any ideia, thanks!!

I am not sure what you are asking.
It runs while the ā€˜door_entityā€™ sensor is on and the message repeats after every ā€˜cooldownā€™ time with the ā€˜final_messageā€™ when the ā€˜door_entityā€™ sensor turns off.

Hi!!

Iā€™ll like to have this automation to run just (for example) between 6 am to 8 pm
thanks!!

Then you write another automation that disables this automation between 20:00:01 pm until 05:59:59 am.

- id: 'control_tts_announce'
  trigger:
    - platform: time
      at: '05:59:59'
      id: go
    - platform: time
      at: '20:00:01'
      id: stop
  action:
    - choose:
      - alias: Enable the Automation
        conditions:
        - condition: trigger
          id: go
        sequence:
        - service: automation.turn_on
          entity_id: automation.announce_tts
      - alias: Disable the Automation
        conditions:
        - condition: trigger
          id: stop
        sequence:
        - alias: Stop a possible running sequence
          service: homeassistant.turn_off
          entity_id: automation.announce_tts
        - alias: disable the automation
          service: automation.turn_on
          entity_id: automation.announce_tts

Or else you edit the blueprint and add a condition:

...
trigger:
  ...
condition:
  alias: "enabled time slot"
  condition: time
  after: "05:59:59"
  before: "20:00:01"
action:
...

I guess I could add this into the blueprint without messing with people that want it on 24hrs. Iā€™ll have to consider that, but not at 3am localā€¦ Could add days of the week as wellā€¦

I updated it on your requestā€¦
It now has start time and end time when it will be active, and if left default it will just run all the time.
I tried to play with day of week, that didnā€™t go wellā€¦

1 Like

thanks!!! itā€™s working greatā€¦ and now have happy wife

1 Like

Glad could help.
Let me know if you have other suggestions.

Added a pick list for languages, so all available at the time of this release are now available.

Hi!

When iā€™m trying to add my door sensor i canā€™t find it in the list. Itā€™s called ā€œbinary_sensor.fin_entreā€ . It does not show up.
Any ideas? The only sensors i get in the list is from my Volvoā€™s doorsā€¦

// Mattias

Add device_class: door to your binary sensor

Very nice, thanks for sharing!

Thought iā€™d add to the suggestion listā€¦
It would be great to be able to expand, or change the speakers/group as time persists.
So one would have the ability to announce first locally by the door, and expand announcement to other areas of the house if door is left open.

Where should i type in that? In Automations.yaml?

I found this error aswell:

Where does this sensor come from?
If you have an entity where the sensor can be modified, you can use the selection: display as.
If you have it created manually, add it to the configuration of that sensor.

I donā€™t know where the ā€œdoor_entityā€ come from. My binary sensor i use comes from my home alarm system.