Advertisement
JLindvig

dumme jan....

Feb 9th, 2021
943
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 6.35 KB | None | 0 0
  1. # - alias: Opdater flagdage
  2.     #   id: 2f0253f30f74479b90b5231ec7296d61
  3.     #   description: Opdater nedtællingen til næste officielle flagdag
  4.     #   initial_state: true
  5.     #   mode: single
  6.     #   trigger:
  7.     #     - platform: time
  8.     #       at: "05:00:00"
  9.     #     - platform: homeassistant
  10.     #       event: start
  11.  
  12.     #   action:
  13.     #     service: shell_command.flagdays_update
  14.  
  15.     # # It is flagday
  16.     # - alias: Flaget skal hejses
  17.     #   id: 3f6b25440fe54302b3165c2624431d8c
  18.     #   description: Reminder om at hejse flaget
  19.     #   initial_state: true
  20.     #   mode: single
  21.     #   trigger:
  22.     #     - platform: template
  23.     #       value_template: "{{ states('sensor.time') == state_attr('sensor.next_flag_day', 'flag_up_time') }}"
  24.     #   condition: "{{ ( state_attr('sensor.next_flag_day', 'days') | int ) == 0 }}"
  25.     #   action:
  26.  
  27.     #     # Update the boolean switch whether it is a half mast
  28.     #     - service: >-
  29.     #         {%- if is_state_attr('sensor.flagdays_dk', 'half_mast_all_day', true) %}
  30.     #           input_boolean.turn_on
  31.     #         {% elif is_state_attr('sensor.flagdays_dk', 'half_mast_end_time', false) %}
  32.     #           input_boolean.turn_off
  33.     #         {% else %}
  34.     #           input_boolean.turn_on
  35.     #         {% endif %}
  36.     #       data:
  37.     #         entity_id: input_boolean.private_half_mast
  38.  
  39.     #     # Send a actionable notification to my phone
  40.     #     - service: script.flag_notification
  41.     #       data:
  42.     #         message: |
  43.    #           Husk at hejse flaget i anledning af {{ state_attr('sensor.next_flag_day', 'friendly_name') }}.
  44.     #           {%- if not is_state_attr('sensor.next_flag_day', 'half_mast', 'false') %}
  45.     #             <br><br><b>HUSK</b>: Flaget skal være på halv {{ 'hele dagen.' if is_state_attr('sensor.next_flag_day', 'half_mast', 'true') else 'indtil ' + state_attr('sensor.next_flag_day', 'half_mast') + ' hvorefter det skal hejses til tops.' }}
  46.     #           {% endif %}
  47.     #         actions:
  48.     #           - action_title: "OK, flaget er hejst"
  49.     #             action_name: "flag_toggle"
  50.     #           - action_title: "Annuler"
  51.     #             action_name: "flag_cancel"
  52.                
  53.     # # On a half mast day  with a end time
  54.     # - alias: Flaget skal helt til tops
  55.     #   id: 45b26aec9e45450ebefdc46f7c6be4bd
  56.     #   description: Reminder om at hejse flaget helt til tops
  57.     #   initial_state: true
  58.     #   mode: single
  59.     #   trigger:
  60.     #     - platform: template
  61.     #       value_template: "{{ states('sensor.time') == state_attr('sensor.next_flag_day', 'half_mast') }}"
  62.     #   variables:
  63.     #     time_out: 600
  64.     #   action:
  65.  
  66.     #     - service: script.flag_notification
  67.     #       data:
  68.     #         message: |
  69.     #           Det er nu tid til at flaget skal helt til tops.
  70.     #         time_offset: "{{ time_out }}"
  71.     #         actions:
  72.     #           - action_title: "OK"
  73.     #             action_name: "flag_ok_half_mast"
  74.     #           - action_title: "Annullér"
  75.     #             action_name: "flag_cancel_half_mast"
  76.  
  77.     #     - wait_for_trigger:
  78.     #         - platform: event
  79.     #           event_type: mobile_app_notification_action
  80.     #       timeout:
  81.     #         seconds: "{{ time_out }}"
  82.  
  83.     #     - choose:
  84.     #       - conditions: "{{ trigger.event.data.action == 'flag_ok_half_mast' }}"
  85.     #         sequence:
  86.     #           - service: input_boolean.turn_off
  87.     #             data:
  88.     #               entity_id: input_boolean.private_half_mast
  89.     #       default:
  90.     #         - service: notify.mobile_app_jacobs_moto
  91.     #           data:
  92.     #             message: clear_notification
  93.     #             data:
  94.     #               tag: flag_notification
  95.  
  96.     # # Time to take the flag down
  97.     # - alias: Flaget er hejst
  98.     #   id: 305695924c244ce4a3ddbb4710228135
  99.     #   description: Reminder om at tage flaget ned
  100.     #   mode: single
  101.     #   trigger:
  102.     #     - platform: sun
  103.     #       event: sunset
  104.     #       offset:
  105.     #         minutes: "-10"
  106.     #   action:
  107.     #     - variables:
  108.     #         time_out: "{{ trigger.offset[1:] | int }}"
  109.  
  110.     #     - service: script.flag_notification
  111.     #       data:
  112.     #         message: |
  113.     #           Husk at tage flaget ned. Solen går ned kl. {{ state_attr('sensor.next_flag_day', 'flag_down_time') }}.
  114.     #           {{ '<b>OBS</b>: Hejs først flaget helt til tops inden det tages ned.' if is_state('input_boolean.private_half_mast', 'on') }}
  115.     #         time_offset: "{{ time_out }}"
  116.     #         actions:
  117.     #           - action_title: "OK, flaget er taget ned"
  118.     #             action_name: "flag_toggle"
  119.     #           - action_title: "Annullér"
  120.     #             action_name: "flag_cancel"
  121.  
  122.     #     - wait_for_trigger:
  123.     #         - platform: event
  124.     #           event_type: mobile_app_notification_action
  125.     #       timeout:
  126.     #         seconds: "{{ time_out * 60 }}"
  127.  
  128.     #     - choose:
  129.     #       - conditions: "{{ trigger.event.data.action == 'flag_toggle' }}"
  130.     #         sequence:
  131.     #           - service: input_boolean.turn_off
  132.     #             data:
  133.     #               entity_id: input_boolean.private_half_mast
  134.     #       default:
  135.     #         - service: notify.mobile_app_jacobs_moto
  136.     #           data:
  137.     #             message: clear_notification
  138.     #             data:
  139.     #               tag: flag_notification
  140.  
  141.     #     - service: input_boolean.turn_off
  142.     #       data:
  143.     #         entity_id: input_boolean.private_half_mast
  144.  
  145.     # # Receiver of the actions from the phone
  146.     # - alias: Opdater flagets status
  147.     #   id: 0408a260c8514a17b42ae7c4167217f2
  148.     #   description: Modtager af kommandoer fra notifikationer
  149.     #   initial_state: true
  150.     #   mode: single
  151.     #   trigger:
  152.     #     - platform: event
  153.     #       event_type: mobile_app_notification_action
  154.     #   action:
  155.     #     - choose:
  156.     #       - conditions: "{{ trigger.event.data['action'] == 'flag_toggle' }}"
  157.     #         sequence:
  158.     #         - service: automation.toggle
  159.     #           data:
  160.     #             entity_id: automation.flaget_er_hejst
  161.     #       default:
  162.     #         - service: notify.mobile_app_jacobs_moto
  163.     #           data:
  164.     #             message: clear_notification
  165.     #             data:
  166.     #               tag: persistent
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement