-
Notifications
You must be signed in to change notification settings - Fork 0
Sun Automations
HaKafkaNet ships with several sun-based automations for you to use. In order to use these automations, ensure that your Kafka Integration is configured to send all "sun.sun" events by adding "sun" to your list of include_domains
filter in your configuration.yaml.
All sun-based automations implement the ISchedulableAutomation
interface. This means that for each sun-based automation you have, there will be one scheduled Task set to run at the appropriate time. All sun-based automations differ in their settings from most other automations in a few key ways. These defaults have been created for what the author believes to be the most common need for sun-based automations. You can override most of this behavior if you choose.
You have several options for creating sun-based automations:
- Use the
IAutomationFactory
- Use the
IAutomationBuilder
- Manually construct one of the 6 concrete types
The 6 types of sun-based automations are:
SunRiseAutomation
SunSetAutomation
SunDawnAutomation
SunDuskAutomation
SunNoonAutomation
SunMidnightAutomation
All sun-based automations optionally accept a TimeSpan
as an offset which can be positive or negative to schedule the automation some time before or after the sun event.
All sun-based automations are derived from the SunAutomation
abstract class, which handles the default setting mentioned above and handles scheduling. Below will outline those defaults.
All sun-base automations use "sun.sun" as a singular trigger id. This is not overridable.
All sun-based automations use a default value for their timings. This is overridable.
public const EventTiming DEFAULT_SUN_EVENT_TIMINGS =
EventTiming.PostStartup | EventTiming.PreStartupSameAsLastCached |
EventTiming.PreStartupPostLastCached | EventTiming.PreStartupNotCached;
Please see Event Timings for more details.
This is set to true, and all sun-based automations will attempt to handle past events. This is done to ensure that at starup, if one of the sun events happened prior to startup, that any changes to devices by your automation will be set appropriately. See information on IDelayableAutomation
for details. This is overridable.