Support temporal expressions#14
Merged
Merged
Conversation
johanflint
commented
Oct 22, 2025
Owner
- Support setting the location in the config file
- Supported expressions:
- Is it a certain day, like "Monday" or "Wed"
- Is it within a range of days, like "Mon-Fri"
- Is it within a set of days, like ["Mon", "Wed"]
- Is it a weekday
- Is it weekend
- Is before a certain time
- Is after a certain time
- Has the sun risen
- Has the sun set
- Is it daytime
- Is it nighttime
Enables evaluation of temporal expressions, specifically checking if the current day matches a given weekday. This allows flows to be triggered based on the day of the week. Introduces a new `TemporalExpression` enum and a `Weekday` enum. Also, adds a `now` field to the `Context` struct to provide the current time.
Adds `IsBeforeTime` and `IsAfterTime` temporal expressions to the flow engine, allowing flows to trigger based on time-of-day comparisons. Introduces a `Time` struct to represent a specific time, and a custom deserializer to parse time strings in "HH:MM" format. This enhances the flexibility of flow definitions by enabling time-based conditions.
Adds location configuration to enable flow execution based on sunrise and sunset times. This change introduces the `sunrise` crate for calculating solar events. It also adds `GeoLocation` struct and integrates it into the application configuration. Flow execution context is updated to include sunrise and sunset times. New temporal expressions are added to check if the sun has risen/set, or if it's daytime/nighttime. This enables flows to be triggered based on time of day relative to sunrise and sunset.
Adds `WeekdayCondition` to `TemporalExpression` to allow for more flexible scheduling based on weekdays, ranges, sets, weekdays, or weekends. This simplifies flow definition and allows for more complex time-based logic.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.