Goal: Create a calendar event 12 hours out from when my dishwasher finishes.
I think I have two issues here - so I’ll break this in two sections:
1. What I really need figured out:
Does the google.add_event accept template values for the start_date_time
& end_date_time
service data attributes? The docs do not specify, as far as I can tell. If so, how can I calculate X hours from the current time? I’m terrible at templating, and worse at math - but I’ve got this:
{{ now().strftime("%Y-%m-%d %H:%M:%S") }}
which gives me the current time of:
2020-02-14 14:58:00
This appears to be the same date_time format as the service data is asking for (manually entered date_time, tested working example below), but I get an error if I put this template in the start and end fields.
calendar_id: [email protected]
summary: test
start_date_time: 2020-02-14 20:00:00
end_date_time: 2020-02-14 21:00:00
2. What I would settle on if the above can’t be done:
Assuming I can’t figure out how to use specific date_time values in the start_date_time and end_date_time service data attributes, what is the proper formatting for the in:
service data attribute? I have tried the following, all create the same error (log below):
in: "days": 2 #this is how the git docs have it in their example
in: '"days": 2' #this is how the HA auto-populates "fill example data"
Log Details (ERROR)
Fri Feb 14 2020 15:27:26 GMT-0500 (Eastern Standard Time)
expected a dictionary for dictionary value @ data['in']
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 134, in handle_call_service
connection.context(msg),
File "/usr/src/homeassistant/homeassistant/core.py", line 1204, in async_call
processed_data = handler.schema(service_data)
File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 272, in __call__
return self._compiled([], data)
File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict
return base_validate(path, iteritems(data), out)
File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping
raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: expected a dictionary for dictionary value @ data['in']