Add ecobee services to create and delete vacations#26923
Conversation
|
Please keep the title starting with |
start_date, start_time, end_date, and end_time must be specified together.
|
We should document the new services, right? |
|
Can be merged when build passes. |
|
Looks like we are good to go! 👍 |
| vol.Required(ATTR_VACATION_NAME): cv.string, | ||
| vol.Required(ATTR_COOL_TEMP): vol.Coerce(float), | ||
| vol.Required(ATTR_HEAT_TEMP): vol.Coerce(float), | ||
| vol.Inclusive(ATTR_START_DATE, "dtgroup", msg=DTGROUP_INCLUSIVE_MSG): cv.string, |
There was a problem hiding this comment.
Maybe we should have validated the date and time as date and time? Future improvement possible. Sorry for missing this.
There was a problem hiding this comment.
I had thought of that - but it's really a string that gets passed to the ecobee API so we wouldn't necessarily want to convert it to a datetime object - and in any event if it's not in a valid format, then the vacation won't get created by the API.
There was a problem hiding this comment.
It would just be for validation. We like to validate as early as possible, ie in the service schema.
There was a problem hiding this comment.
Would this validate or transform?
vol.Inclusive(ATTR_START_DATE, "dtgroup", msg=DTGROUP_INCLUSIVE_MSG): cv.date,
vol.Inclusive(ATTR_START_TIME, "dtgroup", msg=DTGROUP_INCLUSIVE_MSG): cv.time,
vol.Inclusive(ATTR_END_DATE, "dtgroup", msg=DTGROUP_INCLUSIVE_MSG): cv.date,
vol.Inclusive(ATTR_END_TIME, "dtgroup", msg=DTGROUP_INCLUSIVE_MSG): cv.time,I'm happy to open a PR now to patch this.
There was a problem hiding this comment.
It would transform, so we'd need to transform back to string with another validator after the first one. Combine with vol.All.
Description:
Adds two new services to the ecobee integration: create_vacation and delete_vacation.
Related issue (if applicable): N/A
Pull request with documentation for home-assistant.io (if applicable):
home-assistant/home-assistant.io#10457
Example entry for
configuration.yaml(if applicable):N/A
Checklist:
tox. Your PR cannot be merged unless tests passIf user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
python3 -m script.hassfest.requirements_all.txtby runningpython3 -m script.gen_requirements_all..coveragerc.If the code does not interact with devices: