remiks_renovasjon.yaml 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. remiks_renovasjon:
  2. streets: ["kirkegardsvegen-14"]
  3. following: ["Glass og metallemballasje"]
  4. days_notice: 1
  5. binary_sensor:
  6. - platform: remiks_renovasjon
  7. sensor:
  8. - platform: remiks_renovasjon
  9. calendar:
  10. - platform: entities_calendar
  11. calendars:
  12. - name: "Trash collection: Glass and metal"
  13. entities:
  14. - entity: sensor.remiks_glass_og_metallemballasje_kirkegardsvegen_14
  15. name: "Glass and metal"
  16. start_time:
  17. timestamp_attribute: start_time
  18. all_day: true
  19. automation:
  20. - id: "trash_collection_glass_metal"
  21. alias: "Trash collection: Glass and metal"
  22. trigger:
  23. platform: calendar
  24. event: start
  25. entity_id: calendar.trash_collection_glass_and_metal
  26. offset: "-06:00:00"
  27. action:
  28. - service: system_log.write
  29. data:
  30. level: warning
  31. message: "{{ trigger }}"
  32. - variables:
  33. notify_devices: >-
  34. {{ state_attr('group.owners_notify_devices', 'entity_id')|list }}
  35. entity_id: "{{ trigger.entity_id|default('calendar.trash_collection_glass_and_metal') }}"
  36. date: >-
  37. {{ state_attr(entity_id, 'start_time') }}
  38. - repeat:
  39. for_each: "{{ notify_devices }}"
  40. sequence:
  41. - service: script.turn_on
  42. target:
  43. entity_id: script.notify_device
  44. data:
  45. variables:
  46. notify_device: "{{ repeat.item }}"
  47. timeout:
  48. hours: 12
  49. data:
  50. title: "Trash collection day ♻"
  51. message: >-
  52. It's collection day for glass 🍾 and metal 🥫
  53. tomorrow {{ as_datetime(date).strftime('%A')}} the {{ as_datetime(date).day|string + {1: 'st', 2: 'nd', 3: 'rd'}.get(4 if 10 <= as_datetime(date).day|int % 100 < 20 else as_datetime(date).day|int % 10, 'th') }} of {{ as_datetime(date).strftime('%B') }}.
  54. \n\nHow about placing it next to the road tonight?
  55. data:
  56. persistent: true
  57. channel: "Trash"
  58. vibrationPattern: "100, 1000, 100000, 100, 1000, 100"
  59. notification_icon: "mdi:delete-restore"
  60. icon_url: /local/icons/notifications/glass_trash.png
  61. color: "#5bb59b"
  62. actions:
  63. - action: DONE_DISMISS_ALL
  64. title: "Done! ✔"
  65. - action: DISMISS
  66. title: "Dismiss ✖"