Skip to content

Commit 4dff331

Browse files
committed
Merge branch 'develop'
2 parents ff1f530 + 3ace71f commit 4dff331

File tree

105 files changed

+1268
-1188
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+1268
-1188
lines changed

App/HA4IoT.WebApp/Views/FanTemplate.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<span class="glyphicon glyphicon-arrow-down"></span>
44
</a>
55

6-
<a href="#" class="btn btn-default" ng-repeat="i in getNumbers(component.Features.LevelStateFeature.MaxLevel)" ng-class="component.State.LevelState.Value===0 && i===0 ? 'btn-success' : component.State.LevelState.Value===i ? 'btn-danger' : 'btn-default'" ng-click="ctrl.componentService.setLevel(component, i)">
6+
<a href="#" class="btn btn-default" ng-repeat="i in getNumbers(component.Features.LevelFeature.MaxLevel)" ng-class="component.State.LevelState.Value===0 && i===0 ? 'btn-success' : component.State.LevelState.Value===i ? 'btn-danger' : 'btn-default'" ng-click="ctrl.componentService.setLevel(component, i)">
77
<span>{{i}}</span>
88
</a>
99

App/HA4IoT.WebApp/cache.manifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CACHE MANIFEST
2-
# Version 1.17.169
2+
# Version 1.17.170
33

44
CACHE:
55

App/LocalDeployInfo.dat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
192.168.1.15=

Controllers/Examples/HA4IoT.Controller.Main/Main/Rooms/BedroomConfiguration.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System;
22
using HA4IoT.Actuators;
33
using HA4IoT.Actuators.Connectors;
4-
using HA4IoT.Actuators.Fans;
54
using HA4IoT.Actuators.Lamps;
65
using HA4IoT.Actuators.RollerShutters;
76
using HA4IoT.Adapters;
@@ -181,16 +180,16 @@ public void Apply()
181180
.WithEnabledAtNight()
182181
.WithSkipIfAnyIsAlreadyOn(area.GetLamp(Bedroom.LampBedLeft), area.GetLamp(Bedroom.LampBedRight));
183182

184-
area.RegisterComponent(new Fan($"{area.Id}.{Bedroom.Fan}", new BedroomFanAdapter(hsrel8)));
183+
_actuatorFactory.RegisterFan(area, Bedroom.Fan, new BedroomFanAdapter(hsrel8));
185184

186185
area.GetButton(Bedroom.ButtonBedLeftInner).PressedShortTrigger.Attach(() => area.GetComponent(Bedroom.LampBedLeft).TryTogglePowerState());
187186
area.GetButton(Bedroom.ButtonBedLeftInner).PressedLongTrigger.Attach(() => area.GetComponent(Bedroom.CombinedCeilingLights).TryTogglePowerState());
188-
area.GetButton(Bedroom.ButtonBedLeftOuter).PressedShortTrigger.Attach(area.GetFan(Bedroom.Fan).SetNextLevelAction);
187+
area.GetButton(Bedroom.ButtonBedLeftOuter).PressedShortTrigger.Attach(() => area.GetComponent(Bedroom.Fan).TryIncreaseLevel());
189188
area.GetButton(Bedroom.ButtonBedLeftOuter).PressedLongTrigger.Attach(() => area.GetComponent(Bedroom.Fan).TryTurnOff());
190189

191190
area.GetButton(Bedroom.ButtonBedRightInner).PressedShortTrigger.Attach(() => area.GetComponent(Bedroom.LampBedRight).TryTogglePowerState());
192191
area.GetButton(Bedroom.ButtonBedRightInner).PressedLongTrigger.Attach(() => area.GetComponent(Bedroom.CombinedCeilingLights).TryTogglePowerState());
193-
area.GetButton(Bedroom.ButtonBedRightOuter).PressedShortTrigger.Attach(area.GetFan(Bedroom.Fan).SetNextLevelAction);
192+
area.GetButton(Bedroom.ButtonBedRightOuter).PressedShortTrigger.Attach(() => area.GetComponent(Bedroom.Fan).TryIncreaseLevel());
194193
area.GetButton(Bedroom.ButtonBedRightOuter).PressedLongTrigger.Attach(() => area.GetComponent(Bedroom.Fan).TryTurnOff());
195194
}
196195

Controllers/Examples/HA4IoT.Controller.Main/Main/Rooms/KitchenConfiguration.cs

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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;
@@ -57,10 +58,14 @@ public enum Kitchen
5758
SocketWall,
5859
SocketKitchenette,
5960

61+
SocketCeiling1, // Über Hängeschrank
62+
SocketCeiling2, // Bei Dunsabzug
63+
6064
Window
6165
}
6266

6367
public KitchenConfiguration(
68+
ISystemEventsService systemEventsService,
6469
IAreaRegistryService areaService,
6570
IDeviceRegistryService deviceService,
6671
CCToolsDeviceService ccToolsDeviceService,
@@ -69,6 +74,7 @@ public KitchenConfiguration(
6974
ActuatorFactory actuatorFactory,
7075
SensorFactory sensorFactory)
7176
{
77+
_systemEventsService = systemEventsService ?? throw new ArgumentNullException(nameof(systemEventsService));
7278
_areaService = areaService ?? throw new ArgumentNullException(nameof(areaService));
7379
_deviceService = deviceService ?? throw new ArgumentNullException(nameof(deviceService));
7480
_ccToolsBoardService = ccToolsDeviceService ?? throw new ArgumentNullException(nameof(ccToolsDeviceService));
@@ -102,18 +108,26 @@ public void Apply()
102108

103109
_sensorFactory.RegisterMotionDetector(area, Kitchen.MotionDetector, input1.GetInput(8));
104110

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+
};
106128

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]);
114130

115-
_actuatorFactory.RegisterSocket(area, Kitchen.SocketWall, hsrel5.GetOutput(2));
116-
_actuatorFactory.RegisterRollerShutter(area, Kitchen.RollerShutter, hsrel5.GetOutput(4), hsrel5.GetOutput(3));
117131
_sensorFactory.RegisterButton(area, Kitchen.ButtonKitchenette, input1.GetInput(11));
118132
_sensorFactory.RegisterButton(area, Kitchen.ButtonPassage, input1.GetInput(9));
119133
_sensorFactory.RegisterRollerShutterButtons(area, Kitchen.RollerShutterButtonUp, input2.GetInput(15),
@@ -128,7 +142,12 @@ public void Apply()
128142
area.GetRollerShutter(Kitchen.RollerShutter).ConnectWith(
129143
area.GetButton(Kitchen.RollerShutterButtonUp), area.GetButton(Kitchen.RollerShutterButtonDown));
130144

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+
});
132151

133152
_actuatorFactory.RegisterLogicalComponent(area, Kitchen.CombinedAutomaticLights)
134153
.WithComponent(area.GetLamp(Kitchen.LightCeilingWall))

Controllers/Examples/HA4IoT.Controller.Main/Main/Rooms/UpperBathroomConfiguration.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ public void Apply()
7777

7878
var area = _areaService.RegisterArea(Room.UpperBathroom);
7979

80-
area.RegisterComponent(new Fan($"{area.Id}.{UpperBathroom.Fan}", new UpperBathroomFanAdapter(hsrel5)));
81-
8280
_sensorFactory.RegisterTemperatureSensor(area, UpperBathroom.TemperatureSensor,
8381
i2CHardwareBridge.DHT22Accessor.GetTemperatureSensor(SensorPin));
8482

@@ -87,6 +85,8 @@ public void Apply()
8785

8886
_sensorFactory.RegisterMotionDetector(area, UpperBathroom.MotionDetector, input5.GetInput(15));
8987

88+
_actuatorFactory.RegisterFan(area, UpperBathroom.Fan, new UpperBathroomFanAdapter(hsrel5));
89+
9090
_actuatorFactory.RegisterLamp(area, UpperBathroom.LightCeilingDoor, hsrel5.GetOutput(0));
9191
_actuatorFactory.RegisterLamp(area, UpperBathroom.LightCeilingEdge, hsrel5.GetOutput(1));
9292
_actuatorFactory.RegisterLamp(area, UpperBathroom.LightCeilingMirrorCabinet, hsrel5.GetOutput(2));

Controllers/HA4IoT.Simulator/Controls/UIMotionDetectorAdapter.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@ public class UIMotionDetectorAdapter : IMotionDetectorAdapter
1111

1212
public UIMotionDetectorAdapter(CheckBox checkBox)
1313
{
14-
if (checkBox == null) throw new ArgumentNullException(nameof(checkBox));
15-
16-
_checkBox = checkBox;
14+
_checkBox = checkBox ?? throw new ArgumentNullException(nameof(checkBox));
1715
}
1816

1917
public event EventHandler MotionDetectionBegin;
2018
public event EventHandler MotionDetectionEnd;
2119

20+
public void Refresh()
21+
{
22+
}
23+
2224
public void Connect()
2325
{
2426
_checkBox.Checked += (s, e) => OnMotionDetectionBegin();
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
using HA4IoT.Contracts.Components;
2-
using HA4IoT.Contracts.Core;
32

43
namespace HA4IoT.Contracts.Actuators
54
{
65
public interface IFan : IComponent
76
{
8-
IAction SetNextLevelAction { get; }
97
}
108
}

Core/HA4IoT.Contracts/Adapters/IMotionDetectorAdapter.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,7 @@ public interface IMotionDetectorAdapter
77
event EventHandler MotionDetectionBegin;
88

99
event EventHandler MotionDetectionEnd;
10+
11+
void Refresh();
1012
}
1113
}

Core/HA4IoT.Contracts/Areas/IArea.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public interface IArea
2222

2323
IList<TComponent> GetComponents<TComponent>() where TComponent : IComponent;
2424

25-
void AddAutomation(IAutomation automation);
25+
void RegisterAutomation(IAutomation automation);
2626

2727
IList<IAutomation> GetAutomations();
2828
}

0 commit comments

Comments
 (0)