Advertisement
pqpxoxa

HA | Phone Work Alarm Check

Mar 22nd, 2023
1,457
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.80 KB | None | 0 0
  1. alias: Work Alarm Check
  2. description: ""
  3. trigger:
  4. - platform: time
  5. at: "23:00:00"
  6. enabled: true
  7. condition:
  8. - condition: or
  9. conditions:
  10. - condition: numeric_state
  11. entity_id: sensor.pixel_6_pro_volume_level_alarm
  12. below: 5
  13. - condition: state
  14. entity_id: sensor.pixel_6_pro_next_alarm
  15. state: unavailable
  16. action:
  17. - alias: Set up variables for the actions
  18. variables:
  19. action_ack: "{{ 'Ack_' ~ context.id }}"
  20. action_setvol: "{{ 'SetVol_' ~ context.id }}"
  21. action_setal: "{{ 'SetAl_' ~ context.id }}"
  22. - alias: Work Alarm Warning Message and Responses
  23. service: notify.mobile_app_pixel_6_pro
  24. data:
  25. message: >-
  26. <h1>‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎‎ ‎ ‎ ‎ ‎ !!!‎ No Alarm Detected !!!</h1>You're
  27. <b>going to be late</b> for work tomorrow!
  28. data:
  29. actions:
  30. - action: "{{ action_ack }}"
  31. title: ‎ ‎‎ ‎ ‎ Ignore
  32. - action: "{{ action_setvol }}"
  33. title: ‎ ‎ ‎ ‎ Volume Up
  34. - action: "{{ action_setal }}"
  35. title: ‎ ‎‎ ‎ Alarm Set
  36. - alias: Wait for a response
  37. wait_for_trigger:
  38. - platform: event
  39. event_type: mobile_app_notification_action
  40. event_data:
  41. action: "{{ action_ack }}"
  42. - platform: event
  43. event_type: mobile_app_notification_action
  44. event_data:
  45. action: "{{ action_setvol }}"
  46. - platform: event
  47. event_type: mobile_app_notification_action
  48. event_data:
  49. action: "{{ action_setal }}"
  50. - alias: Perform the action
  51. choose:
  52. - conditions: "{{ wait.trigger.event.data.action == action_ack }}"
  53. sequence:
  54. - service: Input_boolean.turn_off
  55. target:
  56. entity_id: input_boolean.livingroom_climate_dropdown
  57. - conditions: "{{ wait.trigger.event.data.action == action_setal }}"
  58. sequence:
  59. - service: notify.mobile_app_pixel_6_pro
  60. data:
  61. message: command_activity
  62. data:
  63. intent_package_name: com.google.android.deskclock
  64. intent_action: android.intent.action.SET_ALARM
  65. intent_extras: >-
  66. android.intent.extra.alarm.HOUR:{{ 5
  67. }},android.intent.extra.alarm.MINUTES:{{ 45
  68. }},android.intent.extra.alarm.SKIP_UI:true,android.intent.extra.alarm.RINGTONE:VALUE_RINGTONE_SILENT
  69. - conditions: "{{ wait.trigger.event.data.action == action_setvol }}"
  70. sequence:
  71. - service: notify.mobile_app_pixel_6_pro
  72. data:
  73. message: command_volume_level
  74. data:
  75. media_stream: alarm_stream
  76. command: 6
  77. mode: single
  78.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement