Quantcast
Viewing all articles
Browse latest Browse all 103240

Need help with a script to notify multiple devices (Alexa, Google Home, Mobile, Perm notification)

Hi All, I am in the process of creating a single reusable notification script that will notify Alexas, Google Assistant, and mobile entities all in one shot.

Though this script is triggering I don’t get notifications on Alexa or Google, I am getting mobile notifications on HA App.

Can someone review and tell me what am i doing wrong? I wanted to pass the list of Alexa and Google Homes as parameters for this.

alias: Script Notify Displays
description: Send notification to key devices
fields:
  name:
    description: Subject of the message
    required: true
    selector:
      text: null
    example: You are awesome
  message:
    description: Message content of the notification.
    required: true
    selector:
      text: null
    example: Notifications are awesome
  notify_alexa:
    description: Notify Alexa Devices
    default: true
    selector:
      boolean: null
    example: 'False'
  notify_google_home:
    description: Notify Google Home Devices
    default: true
    selector:
      boolean: null
    example: 'False'
  entities:
    description: List of Google Homes to notify
    selector:
      target:
        entity:
          domain: media_player
    example: media_player.kitchen_display
  alexa_entities:
    description: List of Alexa Players to notify
    selector:
      target:
        entity:
          domain: media_player
    example: media_player.kitchen_display
  emergency:
    description: Notify even if the device is in DND Mode.
    default: false
    selector:
      boolean: null
    example: 'False'
  logbook:
    description: Add entry to Log Book
    default: true
    selector:
      boolean: null
    example: 'True'
  title:
    description: Title for permenant notifications
    required: true
    selector:
      text: null
    example: Permanent notification Title
  mobile:
    description: Send Mobile Notification
    default: true
    selector:
      boolean: null
    example: 'True'
  permanent:
    description: Create a permanent notification?
    default: false
    selector:
      boolean: null
    example: 'True'
sequence:
  - choose:
      - conditions:
          - condition: template
            value_template: '{{ notify_alexa }}'
        sequence:
          - service: notify.alexa_media
            data:
              title: '{{ title }}'
              message: '{{ name }} {{ message }}'
              target: '{{ alexa_entities.entity_id }}'
              data:
                type: announce
                method: all
  - choose:
      - conditions:
          - condition: template
            value_template: '{{ permanent }}'
        sequence:
          - service: persistent_notification.create
            data:
              title: '{{ title }}'
              message: '** {{ name }} ** {{ message }}'
  - choose:
      - conditions:
          - condition: template
            value_template: '{{ mobile }}'
        sequence:
          - service: notify.xxx
            data:
              title: '{{ title }}'
              message: '{{ name }} {{ message }}'
  - choose:
      - conditions:
          - condition: template
            value_template: '{{ logbook }}'
        sequence:
          - service: logbook.log
            data:
              name: '{{ name }}'
              message: '{{ message }}'
  - choose:
      - conditions:
          - condition: template
            value_template: '{{ notify_google_home }}'
        sequence:
          - service: media_player.play_media
            target:
              entity_id: |
                {{ entities.entity_id }}
            data:
              media_content_id: >-
                media-source://tts/google_translate?message="{{ name | replace("
                ", "+") }} + {{ message | replace(" ", "+") }}"
              media_content_type: provider
            metadata:
              title: 'Back Door is open '
              thumbnail: https://brands.home-assistant.io/_/google_translate/logo.png
              media_class: app
              children_media_class: null
              navigateIds:
                - {}
                - media_content_type: app
                  media_content_id: media-source://tts
                - media_content_type: provider
                  media_content_id: >-
                    media-source://tts/google_translate?message="{{ name |
                    replace(" ", "+") }}+{{ message | replace(" ", "+") }}"
mode: single
icon: mdi:speaker-wireless

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 103240

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>