Last active
March 9, 2021 01:28
-
-
Save Didgeridrew/6540bd56bfbb766b461ca623b8afa305 to your computer and use it in GitHub Desktop.
Use a HA card to add events to Google Calendars
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######## You will need to create the following Helpers ############ | |
# input_select.select_calendar | |
# input_text.cal_summary_text | |
# input_datetime.calendar_add_event_start_time | |
# input_datetime.calendar_add_event_end_time | |
#### scripts.yaml or use the UI ###### | |
script.add_calendar_event_fe: | |
alias: Add Calendar Event from Front End | |
sequence: | |
- service: google.add_event | |
data_template: | |
calendar_id: "{{ states('sensor.calendar_selector') }}" | |
summary: "{{ states('input_text.cal_summary_text') }}" | |
start_date_time: "{{ states('input_datetime.calendar_add_event_start_time') }}" | |
end_date_time: "{{ states('input_datetime.calendar_add_event_end_time') }}" | |
#### configuration.yaml (or sensors.yaml) ###### | |
sensor: | |
- platform: template | |
sensors: | |
calendar_selector: | |
friendly_name: "Calendar Selector Sensor" | |
value_template: > | |
{% set cal = states("input_select.select_calendar") %} | |
{% if cal == "Main" %} | |
[email protected] | |
{% elif cal == "Household Reminders" %} | |
[email protected] | |
{% elif cal == "Work" %} | |
[email protected] | |
{% endif %} | |
#### lovelace entities card ###### | |
type: entities | |
entities: | |
- entity: input_select.select_calendar | |
name: "Select Calendar to Add Event to:" | |
- entity: input_text.cal_summary_text | |
name: 'Type Summary Here:' | |
type: 'custom:text-input-row' | |
- entity: input_datetime.calendar_add_event_start_time | |
- entity: input_datetime.calendar_add_event_end_time | |
- action_name: Add Event... | |
icon: 'mdi:calendar' | |
name: ' ' | |
service: script.add_calendar_event_fe | |
type: call-service | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment