Skip to content

Add ecobee services to create and delete vacations#26923

Merged
MartinHjelmare merged 9 commits into
home-assistant:devfrom
marthoc:add-ecobee-vacation-services
Sep 26, 2019
Merged

Add ecobee services to create and delete vacations#26923
MartinHjelmare merged 9 commits into
home-assistant:devfrom
marthoc:add-ecobee-vacation-services

Conversation

@marthoc
Copy link
Copy Markdown
Contributor

@marthoc marthoc commented Sep 26, 2019

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:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly. Update and include derived files by running python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

Comment thread homeassistant/components/ecobee/services.yaml Outdated
Comment thread homeassistant/components/ecobee/climate.py Outdated
Comment thread homeassistant/components/ecobee/climate.py Outdated
Comment thread homeassistant/components/ecobee/climate.py Outdated
Comment thread homeassistant/components/ecobee/climate.py Outdated
@MartinHjelmare MartinHjelmare changed the title ecobee: Add services to create and delete vacations Add ecobee services to create and delete vacations Sep 26, 2019
@marthoc marthoc changed the title Add ecobee services to create and delete vacations ecobee: Add services to create and delete vacations Sep 26, 2019
@MartinHjelmare MartinHjelmare changed the title ecobee: Add services to create and delete vacations Add ecobee services to create and delete vacations Sep 26, 2019
@MartinHjelmare
Copy link
Copy Markdown
Member

Please keep the title starting with Add:
Add ecobee services to create and delete vacations

Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@MartinHjelmare
Copy link
Copy Markdown
Member

We should document the new services, right?

@arsaboo
Copy link
Copy Markdown
Contributor

arsaboo commented Sep 26, 2019

@MartinHjelmare Docs PR home-assistant/home-assistant.io#10457

@MartinHjelmare
Copy link
Copy Markdown
Member

Can be merged when build passes.

@marthoc
Copy link
Copy Markdown
Contributor Author

marthoc commented Sep 26, 2019

Looks like we are good to go! 👍

@MartinHjelmare MartinHjelmare merged commit c194f4a into home-assistant:dev Sep 26, 2019
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,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should have validated the date and time as date and time? Future improvement possible. Sorry for missing this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would just be for validation. We like to validate as early as possible, ie in the service schema.

Copy link
Copy Markdown
Contributor Author

@marthoc marthoc Sep 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would transform, so we'd need to transform back to string with another validator after the first one. Combine with vol.All.

@marthoc marthoc deleted the add-ecobee-vacation-services branch September 26, 2019 19:36
@marthoc marthoc mentioned this pull request Sep 27, 2019
9 tasks
@lock lock Bot locked and limited conversation to collaborators Sep 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants