@@ -22,6 +22,7 @@ namespace HA4IoT.Controller.Main.Main.Rooms
22
22
{
23
23
internal class KitchenConfiguration
24
24
{
25
+ private readonly ISystemEventsService _systemEventsService ;
25
26
private readonly IAreaRegistryService _areaService ;
26
27
private readonly IDeviceRegistryService _deviceService ;
27
28
private readonly CCToolsDeviceService _ccToolsBoardService ;
@@ -57,10 +58,14 @@ public enum Kitchen
57
58
SocketWall ,
58
59
SocketKitchenette ,
59
60
61
+ SocketCeiling1 , // Über Hängeschrank
62
+ SocketCeiling2 , // Bei Dunsabzug
63
+
60
64
Window
61
65
}
62
66
63
67
public KitchenConfiguration (
68
+ ISystemEventsService systemEventsService ,
64
69
IAreaRegistryService areaService ,
65
70
IDeviceRegistryService deviceService ,
66
71
CCToolsDeviceService ccToolsDeviceService ,
@@ -69,6 +74,7 @@ public KitchenConfiguration(
69
74
ActuatorFactory actuatorFactory ,
70
75
SensorFactory sensorFactory )
71
76
{
77
+ _systemEventsService = systemEventsService ?? throw new ArgumentNullException ( nameof ( systemEventsService ) ) ;
72
78
_areaService = areaService ?? throw new ArgumentNullException ( nameof ( areaService ) ) ;
73
79
_deviceService = deviceService ?? throw new ArgumentNullException ( nameof ( deviceService ) ) ;
74
80
_ccToolsBoardService = ccToolsDeviceService ?? throw new ArgumentNullException ( nameof ( ccToolsDeviceService ) ) ;
@@ -102,18 +108,26 @@ public void Apply()
102
108
103
109
_sensorFactory . RegisterMotionDetector ( area , Kitchen . MotionDetector , input1 . GetInput ( 8 ) ) ;
104
110
105
- var rgb = _outpostDeviceService . GetRgbAdapter ( "RGBSK1" ) ;
111
+ _actuatorFactory . RegisterLamp ( area , Kitchen . LightCeilingMiddle , hsrel5 [ HSREL5Pin . GPIO0 ] . WithInvertedState ( ) ) ;
112
+ _actuatorFactory . RegisterLamp ( area , Kitchen . LightCeilingWindow , hsrel5 [ HSREL5Pin . GPIO1 ] . WithInvertedState ( ) ) ;
113
+ _actuatorFactory . RegisterLamp ( area , Kitchen . LightCeilingWall , hsrel5 [ HSREL5Pin . GPIO2 ] . WithInvertedState ( ) ) ;
114
+ _actuatorFactory . RegisterLamp ( area , Kitchen . LightCeilingDoor , hspe8 [ HSPE8Pin . GPIO0 ] . WithInvertedState ( ) ) ;
115
+ _actuatorFactory . RegisterLamp ( area , Kitchen . LightCeilingPassageInner , hspe8 [ HSPE8Pin . GPIO1 ] . WithInvertedState ( ) ) ;
116
+ _actuatorFactory . RegisterLamp ( area , Kitchen . LightCeilingPassageOuter , hspe8 [ HSPE8Pin . GPIO2 ] . WithInvertedState ( ) ) ;
117
+ _actuatorFactory . RegisterLamp ( area , Kitchen . LightKitchenette , _outpostDeviceService . GetRgbAdapter ( "RGBSK1" ) ) ;
118
+
119
+ _actuatorFactory . RegisterSocket ( area , Kitchen . SocketKitchenette , hsrel5 [ HSREL5Pin . Relay1 ] ) ; // 0?
120
+ _actuatorFactory . RegisterSocket ( area , Kitchen . SocketWall , hsrel5 [ HSREL5Pin . Relay2 ] ) ;
121
+ _actuatorFactory . RegisterSocket ( area , Kitchen . SocketCeiling1 , hspe8 [ HSPE8Pin . GPIO3 ] . WithInvertedState ( ) ) ;
122
+ _actuatorFactory . RegisterSocket ( area , Kitchen . SocketCeiling2 , hspe8 [ HSPE8Pin . GPIO4 ] . WithInvertedState ( ) ) ;
123
+
124
+ _systemEventsService . StartupCompleted += ( s , e ) =>
125
+ {
126
+ area . GetComponent ( Kitchen . SocketCeiling1 ) . TryTurnOn ( ) ;
127
+ } ;
106
128
107
- _actuatorFactory . RegisterLamp ( area , Kitchen . LightCeilingPassageOuter , hspe8 . GetOutput ( 2 ) . WithInvertedState ( ) ) ;
108
- _actuatorFactory . RegisterLamp ( area , Kitchen . LightCeilingMiddle , hsrel5 . GetOutput ( 5 ) . WithInvertedState ( ) ) ;
109
- _actuatorFactory . RegisterLamp ( area , Kitchen . LightCeilingWindow , hsrel5 . GetOutput ( 6 ) . WithInvertedState ( ) ) ;
110
- _actuatorFactory . RegisterLamp ( area , Kitchen . LightCeilingWall , hsrel5 . GetOutput ( 7 ) . WithInvertedState ( ) ) ;
111
- _actuatorFactory . RegisterLamp ( area , Kitchen . LightCeilingDoor , hspe8 . GetOutput ( 0 ) . WithInvertedState ( ) ) ;
112
- _actuatorFactory . RegisterLamp ( area , Kitchen . LightCeilingPassageInner , hspe8 . GetOutput ( 1 ) . WithInvertedState ( ) ) ;
113
- _actuatorFactory . RegisterLamp ( area , Kitchen . LightKitchenette , rgb ) ;
129
+ _actuatorFactory . RegisterRollerShutter ( area , Kitchen . RollerShutter , hsrel5 [ HSREL5Pin . Relay4 ] , hsrel5 [ HSREL5Pin . Relay3 ] ) ;
114
130
115
- _actuatorFactory . RegisterSocket ( area , Kitchen . SocketWall , hsrel5 . GetOutput ( 2 ) ) ;
116
- _actuatorFactory . RegisterRollerShutter ( area , Kitchen . RollerShutter , hsrel5 . GetOutput ( 4 ) , hsrel5 . GetOutput ( 3 ) ) ;
117
131
_sensorFactory . RegisterButton ( area , Kitchen . ButtonKitchenette , input1 . GetInput ( 11 ) ) ;
118
132
_sensorFactory . RegisterButton ( area , Kitchen . ButtonPassage , input1 . GetInput ( 9 ) ) ;
119
133
_sensorFactory . RegisterRollerShutterButtons ( area , Kitchen . RollerShutterButtonUp , input2 . GetInput ( 15 ) ,
@@ -128,7 +142,12 @@ public void Apply()
128
142
area . GetRollerShutter ( Kitchen . RollerShutter ) . ConnectWith (
129
143
area . GetButton ( Kitchen . RollerShutterButtonUp ) , area . GetButton ( Kitchen . RollerShutterButtonDown ) ) ;
130
144
131
- 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
+ } ) ;
132
151
133
152
_actuatorFactory . RegisterLogicalComponent ( area , Kitchen . CombinedAutomaticLights )
134
153
. WithComponent ( area . GetLamp ( Kitchen . LightCeilingWall ) )
0 commit comments