Advertisement
pqpxoxa

HA Automation | Scooter Charging

May 17th, 2023
979
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. alias: Pure Scooter Charging
  2. description: >-
  3. When ARRIVED home using scooter (ESPrence, BT), push notification for charging
  4. duration is sent (HA Companion push notification to Pixel), turn on switch for
  5. duration as requested (TP Kasa Plug, WiFi)
  6. trigger:
  7. - platform: state
  8. entity_id:
  9. - sensor.pure_scooter_ble
  10. to: snug
  11. from: not_home
  12. for:
  13. hours: 0
  14. minutes: 0
  15. seconds: 0
  16. condition: []
  17. action:
  18. - alias: Set up variables for the actions
  19. variables:
  20. action_ign: "{{ 'Ign_' ~ context.id }}"
  21. action_p4m: "{{ 'P4m_' ~ context.id }}"
  22. action_p2h: "{{ 'P2h_' ~ context.id }}"
  23. - alias: Work Alarm Warning Message and Responses
  24. service: notify.mobile_app_pixel_6_pro
  25. data:
  26. message: ""
  27. title: Home Assistant
  28. data:
  29. image: /local/purechargestart.png
  30. actions:
  31. - action: "{{ action_ign }}"
  32. title: ‎ ‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎ ‎ Ignore
  33. - action: "{{ action_p4m }}"
  34. title: ‎ ‎‎ ‎‎‎ ‎‎‎ ‎‎ ‎‎‎ ‎‎ ‎‎‎ ‎‎‎ ‎‎‎ ‎ ‎ ‎ 45 Minutes
  35. - action: "{{ action_p2h }}"
  36. title: ‎ ‎‎ ‎‎ ‎‎‎ ‎‎‎‎‎ ‎‎‎ ‎‎‎ ‎‎ ‎‎‎ ‎ 2 Hours
  37. - alias: Wait for a response
  38. wait_for_trigger:
  39. - platform: event
  40. event_type: mobile_app_notification_action
  41. event_data:
  42. action: "{{ action_ign }}"
  43. - platform: event
  44. event_type: mobile_app_notification_action
  45. event_data:
  46. action: "{{ action_p4m }}"
  47. - platform: event
  48. event_type: mobile_app_notification_action
  49. event_data:
  50. action: "{{ action_p2h }}"
  51. - alias: Perform the action
  52. choose:
  53. - conditions: "{{ wait.trigger.event.data.action == action_ign }}"
  54. sequence:
  55. - service: notify.mobile_app_pixel_6_pro
  56. data:
  57. message: clear_notification
  58. data:
  59. tag: phone-alarm-reminder
  60. - conditions: "{{ wait.trigger.event.data.action == action_p2h }}"
  61. sequence:
  62. - service: script.pure_scooter_charge_2_hours
  63. data: {}
  64. - conditions: "{{ wait.trigger.event.data.action == action_p4m }}"
  65. sequence:
  66. - service: script.pure_scooter_charge_45_minutes
  67. data: {}
  68. mode: single
  69.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement