xlcnd / meteoalarmeu

A 'custom component' for Home-Assistant for Weather Warnings from meteoalarm.eu
GNU General Public License v3.0
20 stars 3 forks source link

Automation to add an event to a Google calendar based on a weather alert #16

Closed xlcnd closed 3 years ago

xlcnd commented 3 years ago

- alias: Add an event to a Google calendar based on a weather alert
  trigger:
  - platform: state
    entity_id: binary_sensor.meteoalarmeu
    attribute: message_id
  action:
  - service: google.add_event
    data:
      calendar_id: YOURCALENDARID@group.calendar.google.com
      summary: >
        METEOALARM-{{ state_attr('binary_sensor.meteoalarmeu', 'awareness_type') }}-{{ state_attr('binary_sensor.meteoalarmeu', 'awareness_level') }}-{{ state_attr('binary_sensor.meteoalarmeu', 'alert_id') }}
      description: >
        {{ state_attr('binary_sensor.meteoalarmeu', 'message') }}
      start_date_time: >
              {{ state_attr('binary_sensor.meteoalarmeu', 'from') }}:00
      end_date_time: >
              {{ state_attr('binary_sensor.meteoalarmeu', 'until') }}:00
xlcnd commented 3 years ago

Please, don't forget to replace YOURCALENDARID!