Low Battery Cloud TTS Notification

This automation blueprint sends a Nabu Casa Cloud TTS message to a media player when your device reaches a certain percentage.

Note: you will need a Nabu Casa subscription to use this blueprint.

See the tts.cloud_say docs for available TTS options.

  name: Low Battery Cloud TTS Notification
  description: This blueprint will send a Cloud TTS message when a device's battery
    is low
  domain: automation
      name: Device
      description: The device that has a battery level.
          domain: sensor
          device_class: battery
      name: Media Player
      description: The media player to send the TTS message to.
          domain: media_player
      name: Media Player Volume (Optional)
      description: Set the media player's volume. (Leave at 0 or unset to leave unchanged)
      default: 0.0
          min: 0.0
          max: 1.0
          step: 0.1
          mode: slider
      name: Message (Optional)
      description: 'Default: "Battery is low on {{ device_name }}"'
      default: Battery is low on {{ device_name }}
      name: TTS Gender (Optional)
      description: 'Default: "female"'
      default: female
      name: TTS Language (Optional)
      description: 'Default: "en-GB"'
      default: en-GB
      name: Battery level
      description: What level the device should be to trigger the notification.
      default: 10
          min: 1.0
          max: 100.0
          unit_of_measurement: '%'
          step: 1.0
          mode: slider
  source_url: https://community.home-assistant.io/t/low-battery-cloud-tts-notification/255495
  battery_level: !input 'battery_level'
  device: !input 'device'
  device_name: '{{ states[device].name }}'
  media_player_volume: !input 'media_player_volume'
  platform: numeric_state
  entity_id: !input 'device'
  below: !input 'battery_level'
- choose:
  - condition: template
    value_template: '{{ media_player_volume != 0.0 }}'
  - service: media_player.volume_set
    entity_id: !input 'media_player'
      volume_level: '{{ media_player_volume }}'
- service: tts.cloud_say
  entity_id: !input 'media_player'
    message: !input 'message'
      gender: !input 'tts_gender'
    language: !input 'tts_language'

What if the battery level isn’t updated every percent? So it jumps from battery_level + 2 to battery_level. It might be better to use the numeric_state platform with a below battery_level trigger. Only problem is it triggers again if its below battery_level and your HA reboots.

I’ve updated the trigger to use a numeric_state trigger instead of a state trigger. This should be more accurate now and will trigger when the value drops below the number set instead of the exact number

Nice blueprint… just a thought though (I had a really quick look through it)…can you set an option for it to repeat itself every, say hour, until the battery is replaced?

that is a good question. I’ve never been able to do a repeated automation (without some nasty hacks), as this breaks the concept of the automation trigger: once a trigger has been triggered it won’t until its trigger condition has changed. In this case as soon as the battery falls below the limit -> the automation is triggered and won’t triggered again as long as the below-condition is true (or nasty hack: the automation is enabled-disabled again).

To overcome that, I use the alert-integration.

:thinking: The more I think about it, it might be possible nowadays using a repeat-count-action and delays
Here is a draft example of an generic nagging alert notifiton: Nagging Alert Notification

Thanks @pavax i’ll check it out… Keep up the good work!

Thanks a ton for this Blueprint, Exactly what I need to get the kids to keep their phones charged. I also need it to nag (read irritate :grin:) the kids to get them to charge their phones so will investigate the Nagging Alert. ( Something along the lines of "if battery level is below 12% and state is not charging, nag every 15 minutes, at increasing volume increments.) Also, I will need to find a way to tweak the Google Home Mini playback and volume. (Music playback stops and does not resume after TTS notification. This is life threatening, wife wants to kill me. :grin:. )