Skip to content

Allow use of date_string in service call#13256

Merged
fabaff merged 2 commits intohome-assistant:devfrom
bjw-s:todoist
Apr 6, 2018
Merged

Allow use of date_string in service call#13256
fabaff merged 2 commits intohome-assistant:devfrom
bjw-s:todoist

Conversation

@bjw-s
Copy link
Copy Markdown
Contributor

@bjw-s bjw-s commented Mar 16, 2018

Description:

In the original implementation of the Todoist calendar component it was not possible to allow Todoist natural language for due dates. This PR adds this capability.

Also fixes the services.yaml for the service call

Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#4923

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass

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

item.update(date_lang=call.data[DATE_LANG])

if DUE_DATE in call.data:
# Make sure only DUE_DATE is set
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this should at least issue a warning here, if it's not already caught by service validation (see above).

vol.Optional(DUE_DATE): cv.string,
vol.Optional(DATE_STRING): cv.string,
vol.Optional(DATE_LANG): vol.All(cv.string, vol.Length(min=2, max=2)),
vol.Optional(DUE_DATE): cv.string
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since specifying both a date string and a due date is not possible (see below), this should probably already be caught in validation?

description: The day this task is due, in natural language (Optional).
example: "tomorrow"
date_lang:
description: The langurage of date_string (Optional).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Typo

priority:
description: The priority of this task, from 1 (normal) to 4 (urgent) (Optional).
example: 2
date_string:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The other due date parameter is called due_date - so one might wonder whether this is another type of date? Perhaps a name like due_date_string would make things clearer?

@bjw-s
Copy link
Copy Markdown
Contributor Author

bjw-s commented Mar 16, 2018

@tinloaf Thanks for the feedback, think I've processed it all in the latest commit 👍

Copy link
Copy Markdown
Contributor

@tinloaf tinloaf left a comment

Choose a reason for hiding this comment

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

Looking good, Thanks! 👍 You've missed to update the naming in the documentation PR, I mentioned it there.

@bjw-s
Copy link
Copy Markdown
Contributor Author

bjw-s commented Mar 18, 2018

Doh... Missed that one indeed. Fixed now, thanks 👍

@bjw-s
Copy link
Copy Markdown
Contributor Author

bjw-s commented Apr 3, 2018

Do I need to do anything else to have this PR (and the accompanying docs PR) merged?

@fabaff fabaff merged commit c77d013 into home-assistant:dev Apr 6, 2018
@balloob balloob mentioned this pull request Apr 27, 2018
@bjw-s bjw-s deleted the todoist branch May 24, 2018 17:34
Adminiuga pushed a commit to Adminiuga/home-assistant that referenced this pull request Jun 25, 2018
* Allow use of date_string in service call

* Add stricter validation, fix descriptions
@home-assistant home-assistant locked and limited conversation to collaborators Sep 5, 2018
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.

4 participants