public TurnOnAndOffAutomation WithTarget(IBinaryStateOutputActuator actuator)
        {
            if (actuator == null)
            {
                throw new ArgumentNullException(nameof(actuator));
            }

            _turnOnActions.Add(() => actuator.TurnOn());
            _turnOffActions.Add(() => actuator.TurnOff());

            return(this);
        }
Exemplo n.º 2
0
        public static void Toggle(this IBinaryStateOutputActuator actuator, params IParameter[] parameters)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException(nameof(parameters));
            }

            if (actuator.GetState() == BinaryActuatorState.Off)
            {
                actuator.TurnOn();
            }
            else
            {
                actuator.TurnOff();
            }
        }