@@ -22,6 +22,7 @@ namespace HA4IoT.Controller.Main.Main.Rooms
2222{
2323 internal class KitchenConfiguration
2424 {
25+ private readonly ISystemEventsService _systemEventsService ;
2526 private readonly IAreaRegistryService _areaService ;
2627 private readonly IDeviceRegistryService _deviceService ;
2728 private readonly CCToolsDeviceService _ccToolsBoardService ;
@@ -64,6 +65,7 @@ public enum Kitchen
6465 }
6566
6667 public KitchenConfiguration (
68+ ISystemEventsService systemEventsService ,
6769 IAreaRegistryService areaService ,
6870 IDeviceRegistryService deviceService ,
6971 CCToolsDeviceService ccToolsDeviceService ,
@@ -72,6 +74,7 @@ public KitchenConfiguration(
7274 ActuatorFactory actuatorFactory ,
7375 SensorFactory sensorFactory )
7476 {
77+ _systemEventsService = systemEventsService ?? throw new ArgumentNullException ( nameof ( systemEventsService ) ) ;
7578 _areaService = areaService ?? throw new ArgumentNullException ( nameof ( areaService ) ) ;
7679 _deviceService = deviceService ?? throw new ArgumentNullException ( nameof ( deviceService ) ) ;
7780 _ccToolsBoardService = ccToolsDeviceService ?? throw new ArgumentNullException ( nameof ( ccToolsDeviceService ) ) ;
@@ -118,6 +121,11 @@ public void Apply()
118121 _actuatorFactory . RegisterSocket ( area , Kitchen . SocketCeiling1 , hspe8 [ HSPE8Pin . GPIO3 ] . WithInvertedState ( ) ) ;
119122 _actuatorFactory . RegisterSocket ( area , Kitchen . SocketCeiling2 , hspe8 [ HSPE8Pin . GPIO4 ] . WithInvertedState ( ) ) ;
120123
124+ _systemEventsService . StartupCompleted += ( s , e ) =>
125+ {
126+ area . GetComponent ( Kitchen . SocketCeiling1 ) . TryTurnOn ( ) ;
127+ } ;
128+
121129 _actuatorFactory . RegisterRollerShutter ( area , Kitchen . RollerShutter , hsrel5 [ HSREL5Pin . Relay4 ] , hsrel5 [ HSREL5Pin . Relay3 ] ) ;
122130
123131 _sensorFactory . RegisterButton ( area , Kitchen . ButtonKitchenette , input1 . GetInput ( 11 ) ) ;
@@ -134,7 +142,12 @@ public void Apply()
134142 area . GetRollerShutter ( Kitchen . RollerShutter ) . ConnectWith (
135143 area . GetButton ( Kitchen . RollerShutterButtonUp ) , area . GetButton ( Kitchen . RollerShutterButtonDown ) ) ;
136144
137- area . GetButton ( Kitchen . RollerShutterButtonUp ) . PressedLongTrigger . Attach ( ( ) => area . GetComponent ( Kitchen . LightKitchenette ) . TryTogglePowerState ( ) ) ;
145+ area . GetButton ( Kitchen . RollerShutterButtonUp ) . PressedLongTrigger . Attach ( ( ) =>
146+ {
147+ var light = area . GetComponent ( Kitchen . LightKitchenette ) ;
148+ light . TryTogglePowerState ( ) ;
149+ light . TrySetColor ( 0D , 0D , 1D ) ;
150+ } ) ;
138151
139152 _actuatorFactory . RegisterLogicalComponent ( area , Kitchen . CombinedAutomaticLights )
140153 . WithComponent ( area . GetLamp ( Kitchen . LightCeilingWall ) )
0 commit comments