Ejemplo n.º 1
0
        public static TurnOnAndOffAutomation SetupTurnOnAndOffAutomation(this IArea area)
        {
            if (area == null)
            {
                throw new ArgumentNullException(nameof(area));
            }

            var automation =
                new TurnOnAndOffAutomation(
                    AutomationIdFactory.CreateIdFrom <TurnOnAndOffAutomation>(area),
                    area.Controller.Timer);

            area.AddAutomation(automation);

            return(automation);
        }
        public static TurnOnAndOffAutomation SetupTurnOnAndOffAutomation(this IArea area)
        {
            if (area == null)
            {
                throw new ArgumentNullException(nameof(area));
            }

            var automation =
                new TurnOnAndOffAutomation(
                    AutomationIdFactory.CreateIdFrom <TurnOnAndOffAutomation>(area),
                    area.Controller.ServiceLocator.GetService <IDateTimeService>(),
                    area.Controller.ServiceLocator.GetService <ISchedulerService>());

            area.AddAutomation(automation);

            return(automation);
        }
Ejemplo n.º 3
0
        public static ConditionalOnAutomation SetupConditionalOnAutomation(this IArea area)
        {
            if (area == null)
            {
                throw new ArgumentNullException(nameof(area));
            }

            var automation =
                new ConditionalOnAutomation(
                    AutomationIdFactory.CreateIdFrom <ConditionalOnAutomation>(area),
                    area.Controller.Timer,
                    area.Controller.HttpApiController,
                    area.Controller.Logger);

            area.AddAutomation(automation);

            return(automation);
        }
        public static RollerShutterAutomation SetupRollerShutterAutomation(this IArea area)
        {
            if (area == null)
            {
                throw new ArgumentNullException(nameof(area));
            }

            var automation = new RollerShutterAutomation(
                AutomationIdFactory.CreateIdFrom <RollerShutterAutomation>(area),
                area.Controller.Timer,
                area.Controller.GetService <IDaylightService>(),
                area.Controller.GetService <IWeatherService>(),
                area.Controller);

            automation.Activate();

            area.AddAutomation(automation);

            return(automation);
        }