private void SetupStairsCeilingLamps(IArea floor, HSPE8OutputOnly hspe8UpperFloor) { var output = new LogicalBinaryOutput() .WithOutput(hspe8UpperFloor[HSPE8Pin.GPIO4]) .WithOutput(hspe8UpperFloor[HSPE8Pin.GPIO5]) .WithOutput(hspe8UpperFloor[HSPE8Pin.GPIO7]) .WithOutput(hspe8UpperFloor[HSPE8Pin.GPIO6]) .WithInvertedState(); floor.WithLamp(Floor.LampStairsCeiling, output); floor.SetupTurnOnAndOffAutomation() .WithTrigger(floor.MotionDetector(Floor.StairsLowerMotionDetector), new AnimateParameter()) .WithTrigger(floor.MotionDetector(Floor.StairsUpperMotionDetector)) //.WithTrigger(floor.Button(Floor.ButtonStairsUpper)) .WithTarget(floor.BinaryStateOutput(Floor.LampStairsCeiling)) .WithOnDuration(TimeSpan.FromSeconds(10)); var lamp = floor.Lamp(Floor.LampStairsCeiling); floor.Button(Floor.ButtonStairsUpper).GetPressedShortlyTrigger().Triggered += (s, e) => { if (lamp.GetState() == BinaryActuatorState.On) { lamp.TurnOff(new AnimateParameter().WithReversedOrder()); } else { lamp.TurnOn(new AnimateParameter()); } }; floor.Button(Floor.ButtonStairsLowerUpper).GetPressedShortlyTrigger().Triggered += (s, e) => { if (lamp.GetState() == BinaryActuatorState.On) { lamp.TurnOff(new AnimateParameter()); } else { lamp.TurnOn(new AnimateParameter().WithReversedOrder()); } }; }