diff --git a/NightLight.Core.Tests/FakeHome.fs b/NightLight.Core.Tests/FakeHome.fs index c04ef4e..f1f92f7 100644 --- a/NightLight.Core.Tests/FakeHome.fs +++ b/NightLight.Core.Tests/FakeHome.fs @@ -150,14 +150,14 @@ type FakeHome with member this.NonRemotelyControlledLightStates = this.LightStates |> Seq.filter (fun (light, _) -> - light = VardagsrumVagglampa - || light = VardagsrumGolvlampa - || light = BadrumTaklampa) + light = LivingRoomWallLamp + || light = LivingRoomFloorLamp + || light = BathroomCeilingLamp) |> Seq.toList member this.RemotelyControlledLightStates = this.LightStates - |> Seq.filter (fun (light, _) -> light = VardagsrumFonsterlampa || light = SovrumNattduksbordlampa) + |> Seq.filter (fun (light, _) -> light = RightBedroomLamp || light = LeftBedroomLamp) |> Seq.toList member this.Label = diff --git a/NightLight.Core.Tests/LightArbitraries.fs b/NightLight.Core.Tests/LightArbitraries.fs index 02dc5be..78300b3 100644 --- a/NightLight.Core.Tests/LightArbitraries.fs +++ b/NightLight.Core.Tests/LightArbitraries.fs @@ -10,29 +10,29 @@ type ArbitraryNonRemotelyControlledLight = static member Light() = lights |> Seq.filter (fun light -> - light = VardagsrumVagglampa - || light = VardagsrumGolvlampa - || light = BadrumTaklampa) + light = LivingRoomWallLamp + || light = LivingRoomFloorLamp + || light = BathroomCeilingLamp) |> Gen.elements |> Arb.fromGen type ArbitraryLeftRemotelyControlledLight = static member Light() = lights - |> Seq.filter (fun light -> light = SovrumNattduksbordlampa) + |> Seq.filter (fun light -> light = LeftBedroomLamp) |> Gen.elements |> Arb.fromGen type ArbitraryRightRemotelyControlledLight = static member Light() = lights - |> Seq.filter (fun light -> light = VardagsrumFonsterlampa) + |> Seq.filter (fun light -> light = RightBedroomLamp) |> Gen.elements |> Arb.fromGen type ArbitraryRemotelyControlledLight = static member Light() = lights - |> Seq.filter (fun light -> light = VardagsrumFonsterlampa || light = SovrumNattduksbordlampa) + |> Seq.filter (fun light -> light = RightBedroomLamp || light = LeftBedroomLamp) |> Gen.elements |> Arb.fromGen diff --git a/NightLight.Core.Tests/NightLightTests.fs b/NightLight.Core.Tests/NightLightTests.fs index 8d4b42f..3a210a7 100644 --- a/NightLight.Core.Tests/NightLightTests.fs +++ b/NightLight.Core.Tests/NightLightTests.fs @@ -52,7 +52,7 @@ type NightLightTests() = && time <= endOfAlarm let scaledForAlarm light brightness = - if (light = VardagsrumFonsterlampa || light = SovrumNattduksbordlampa) && alarm then + if (light = RightBedroomLamp || light = LeftBedroomLamp) && alarm then float brightness * ((time - startOfDay) / (endOfAlarm - startOfDay)) |> byte else brightness @@ -109,10 +109,10 @@ type NightLightTests() = let allOff (ls: (Light * LightState) seq) = ls |> Seq.forall (snd >> _.IsOff) let controlledByLeft ls = - ls |> Seq.filter (fun (light, _) -> light = SovrumNattduksbordlampa) + ls |> Seq.filter (fun (light, _) -> light = LeftBedroomLamp) let controlledByRight ls = - ls |> Seq.filter (fun (light, _) -> light = VardagsrumFonsterlampa) + ls |> Seq.filter (fun (light, _) -> light = RightBedroomLamp) let maybeLastRemoteInteraction = tryGetLastRemoteInteraction interactions diff --git a/NightLight.Core/Models.fs b/NightLight.Core/Models.fs index 52dcf48..20f9b24 100644 --- a/NightLight.Core/Models.fs +++ b/NightLight.Core/Models.fs @@ -41,11 +41,11 @@ type DeviceFriendlyName = | DeviceFriendlyName deviceFriendlyName -> deviceFriendlyName type Light = - | VardagsrumFonsterlampa - | VardagsrumVagglampa - | VardagsrumGolvlampa - | BadrumTaklampa - | SovrumNattduksbordlampa + | RightBedroomLamp + | LivingRoomWallLamp + | LivingRoomFloorLamp + | BathroomCeilingLamp + | LeftBedroomLamp type LightProps = { FriendlyName: DeviceFriendlyName @@ -54,33 +54,33 @@ type LightProps = let lightProps light = match light with - | VardagsrumFonsterlampa -> + | RightBedroomLamp -> { FriendlyName = DeviceFriendlyName "Vardagsrum - Fönsterlampa" Room = Bedroom Bulb = IkeaBulb } - | VardagsrumVagglampa -> + | LivingRoomWallLamp -> { FriendlyName = DeviceFriendlyName "Vardagsrum - Vägglampa" Room = LivingRoom Bulb = PaulmannBulb } - | VardagsrumGolvlampa -> + | LivingRoomFloorLamp -> { FriendlyName = DeviceFriendlyName "Vardagsrum - Golvlampa" Room = LivingRoom Bulb = PaulmannBulb } - | BadrumTaklampa -> + | BathroomCeilingLamp -> { FriendlyName = DeviceFriendlyName "Badrum - Taklampa" Room = Bathroom Bulb = IkeaBulb } - | SovrumNattduksbordlampa -> + | LeftBedroomLamp -> { FriendlyName = DeviceFriendlyName "Sovrum - Nattduksbordlampa" Room = Bedroom Bulb = IkeaBulb } let lights = - [ VardagsrumFonsterlampa - VardagsrumVagglampa - VardagsrumGolvlampa - BadrumTaklampa - SovrumNattduksbordlampa ] + [ RightBedroomLamp + LivingRoomWallLamp + LivingRoomFloorLamp + BathroomCeilingLamp + LeftBedroomLamp ] let remoteControlFriendlyName = DeviceFriendlyName "Fjärrkontroll" diff --git a/NightLight.Core/NightLightStateMachine.fs b/NightLight.Core/NightLightStateMachine.fs index a99ec09..c3b91ec 100644 --- a/NightLight.Core/NightLightStateMachine.fs +++ b/NightLight.Core/NightLightStateMachine.fs @@ -48,7 +48,7 @@ let internal createOrUpdateNightLightState light, { Color = color Brightness = - if alarm && (light = VardagsrumFonsterlampa || light = SovrumNattduksbordlampa) then + if alarm && (light = RightBedroomLamp || light = LeftBedroomLamp) then brightness.Scale(getAlarmWeight time) else brightness @@ -105,18 +105,18 @@ type NightLightStateMachine private (maybeState: NightLightState option) = | PressedOn -> currentState |> withAlarmOff - |> withStateFor VardagsrumFonsterlampa On - |> withStateFor SovrumNattduksbordlampa On + |> withStateFor RightBedroomLamp On + |> withStateFor LeftBedroomLamp On | PressedOff -> currentState |> withAlarmOff - |> withStateFor VardagsrumFonsterlampa Off - |> withStateFor SovrumNattduksbordlampa Off + |> withStateFor RightBedroomLamp Off + |> withStateFor LeftBedroomLamp Off | PressedLeft -> currentState |> withAlarmOff - |> withStateFor VardagsrumFonsterlampa Off - |> withStateFor SovrumNattduksbordlampa On + |> withStateFor RightBedroomLamp Off + |> withStateFor LeftBedroomLamp On NightLightStateMachine(Some newNightLightState), generateZigbeeCommandsForDifference (Some currentState) newNightLightState