Skip to content

[rules] Better wording for time-related rule builder triggers #310

Description

@mgr01

Item- and thing-related rule builders read naturally, for example (omitting dots and parentheses): when item X changed to Y then ...

Time-related builders don't form English sentences:

  1. .when().timeOfDay('17:00').then()
  2. .when().cron('0 0 17 * * ?').then()
  3. .when().dateTime('OutdoorLights_OffTime').timeOnly().then()
  4. .when().dateTime('OutdoorLights_OffDate').then()

Those are logical from the programmer's point of view -- as they map directly to trigger types -- but they read a bit awkwardly IMO.

My proposal is to replace the above with something like:

  1. .when().time().is('17:00').then() or
    .when().time().was('17:00').then() or
    .when().time().matched('17:00').then()
  2. .when().time().matchedCron('0 0 17 * * ?').then()
  3. .when().time().matchedItem('OutdoorLights_OffTime').then()
  4. .when().timeAndDate().matchedItem('OutdoorLights_OffDate').then()

WDYT?

I'll be happy to create a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions