JLindvig

android

Feb 9th, 2021 (edited)
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 2.01 KB | None | 0 0
  1.  script:
  2.     notification_android:
  3.       alias: Android notifikationer med actions
  4.       icon: mdi:android-debug-bridge
  5.       description: Med dette script er det nemt at sende notifikationer til en Android enhed.
  6.       sequence:
  7.         - service: "{{ service }}"
  8.           data:
  9.             title: "{{ title }}"
  10.             message: |
  11.              {{ message }}
  12.             data:
  13.               icon_url: "{{ icon_url }}"
  14.               sticky: "{{ sticky }}"
  15.               persistent: "{{ persistent }}"
  16.               tag: "{{ tag }}"
  17.               channel: "{{ channel }}"
  18.               importance: "{{ high }}"
  19.               chronometer: "{{ chronometer }}"
  20.               when: "{{ when }}"
  21.               actions: >
  22.                {% set ns = namespace(actions = []) %}
  23.                 {% for a_action in actions %}
  24.                 {% set action = {
  25.                   "action": a_action.action_name,
  26.                   "title": a_action.action_title
  27.                 } %}
  28.                 {% set ns.actions = ns.actions + [action] %}
  29.                 {% endfor %}
  30.                 {{ ns.actions }}
  31.  
  32.     flag_notification:
  33.       sequence:
  34.         - service: script.notification_android
  35.           data:
  36.             service: notify.mobile_app_jacobs_moto
  37.             title: "Besked fra din flagstang"
  38.             message: "{{ message }}"
  39.             icon_url: "{{ state_attr('sensor.next_flag_day', 'entity_picture') }}"
  40.             persistent: true
  41.             tag: flag_notification
  42.             channel: Flagstang
  43.             importance: max
  44.             chronometer: "{{ time_offset is defined }}"
  45.             when: >
  46.              {% if time_offset is defined %}
  47.                 {{ ((now() | as_timestamp) + (time_offset | int)) | int }}
  48.               {% endif %}
  49.             actions: "{{ actions }}"
  50.  
  51.     flag_clear_notification:
  52.       sequence:
  53.         - service: notify.mobile_app_jacobs_moto
  54.           data:
  55.             message: clear_notification
  56.             data:
  57.               tag: flag_notification
Add Comment
Please, Sign In to add comment