New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split time_pattern triggers from time trigger #19825

Merged
merged 4 commits into from Jan 15, 2019

Conversation

@armills
Copy link
Member

armills commented Jan 6, 2019

Description:

This PR separates the current time trigger into two triggers, time and time_schedule. This will allow us to properly implement these triggers in the automation editor on the frontend.

See also: home-assistant/home-assistant-polymer#2413

Related issue (if applicable): fixes home-assistant/architecture#88

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

Example entry for configuration.yaml (if applicable):

automation:
  trigger:
    platform: time_pattern
    # Matches every hour at 5 minutes past whole
    minutes: 5
automation:
  trigger:
    platform: time
    # Military time format. This trigger will fire at 3:32 PM
    at: '15:32:00'
@amelchio

This comment has been minimized.

Copy link
Member

amelchio commented Jan 6, 2019

While we are breaking things anyway, let's implement this proposal.

@armills armills force-pushed the time-interval-trigger-split branch from acdbb0e to 177f755 Jan 6, 2019

@OttoWinter

This comment has been minimized.

Copy link
Contributor

OttoWinter commented Jan 6, 2019

I don't like the name interval so much. For example if I type:

minutes: 1
seconds: 30

I expect it to trigger every 1min+30s=90s. Similarly, an interval of minutes: 1 in my mind means "trigger every minute".

Maybe we can come up with a better name for it? I mean cron is a possibility since it's pretty much cron syntax but it's also bad because few people know what cron means.

@armills

This comment has been minimized.

Copy link
Member Author

armills commented Jan 7, 2019

What about schedule?

@OttoWinter

This comment has been minimized.

Copy link
Contributor

OttoWinter commented Jan 7, 2019

Sounds good!

@pvizeli

This comment has been minimized.

Copy link
Member

pvizeli commented Jan 7, 2019

+1 for interval because it's an interval. minutes: \1 trigger every minute...

@pvizeli

pvizeli approved these changes Jan 7, 2019

Copy link
Member

pvizeli left a comment

The question is if we want to make a hard break or soft break like in architecture PR? Otherwise, if a user doesn't update often, they run also later into the same problem also with the soft break.

@armills

This comment has been minimized.

Copy link
Member Author

armills commented Jan 7, 2019

My vote is just to make it a hard break, since it's going to have to happen eventually anyway. It's an easy fix to just change the platform name, and then we're not carrying legacy code around until someone happens to clean it up.

@amelchio

This comment has been minimized.

Copy link
Member

amelchio commented Jan 7, 2019

@pvizeli minutes: /45 does not trigger every 45 minutes ;-)

Since we do not actually support a generic interval yet, leaving that name available for the future seems like a good idea (though maybe periodic would be a better name for that).

I actually suspect that proper interval support would be more useful that the current almost-cron style.

@armills armills changed the title Split interval triggers from time trigger Split schedule triggers from time trigger Jan 8, 2019

@balloob

This comment has been minimized.

Copy link
Member

balloob commented Jan 11, 2019

leaving that name available for the future seems like a good idea

I agree with this but think it might also apply to schedule ?

@balloob

This comment has been minimized.

Copy link
Member

balloob commented Jan 11, 2019

I would almost call it cron except that we don't want to commit to a full cron syntax support.

@amelchio

This comment has been minimized.

Copy link
Member

amelchio commented Jan 11, 2019

Maybe time_pattern ...

@armills armills changed the title Split schedule triggers from time trigger Split time_pattern triggers from time trigger Jan 14, 2019

@armills

This comment has been minimized.

Copy link
Member Author

armills commented Jan 14, 2019

I like it! Updated to time_pattern.

@balloob balloob merged commit 336b6ad into dev Jan 15, 2019

6 checks passed

Hound No violations found. Woof!
WIP Legacy commit status override — see details
Details
cla-bot Everyone involved has signed the CLA
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
coverage/coveralls Coverage decreased (-0.04%) to 93.042%
Details

@wafflebot wafflebot bot removed the in progress label Jan 15, 2019

@delete-merged-branch delete-merged-branch bot deleted the time-interval-trigger-split branch Jan 15, 2019

@balloob balloob removed the new-platform label Jan 21, 2019

@balloob balloob referenced this pull request Jan 23, 2019

Merged

0.86.0 #20354

alandtse added a commit to alandtse/home-assistant that referenced this pull request Feb 12, 2019

Split time_pattern triggers from time trigger (home-assistant#19825)
* Split interval triggers from time trigger

* Default smaller interval units to zero

* Rename interval to schedule

* Rename schedule to time_pattern
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment