Implement the Right button on the bedroom remote
This commit is contained in:
parent
b9fc8bfaea
commit
d3a00b8a77
5 changed files with 74 additions and 64 deletions
|
|
@ -10,6 +10,7 @@ type RemoteInteraction =
|
|||
| RemotePressedOnButton
|
||||
| RemotePressedOffButton
|
||||
| RemotePressedLeftButton
|
||||
| RemotePressedRightButton
|
||||
|
||||
type HumanInteraction =
|
||||
| LightPoweredOn of Light
|
||||
|
|
@ -49,9 +50,7 @@ type FakeLight(light: Light) =
|
|||
member _.SetBrightness(newBrightness: byte) =
|
||||
if hasPower then
|
||||
brightness <- newBrightness
|
||||
|
||||
if (lightProps light).Bulb = IkeaBulb then
|
||||
state <- true
|
||||
state <- true
|
||||
|
||||
member _.SetColor(newColor: Color) =
|
||||
if hasPower then
|
||||
|
|
@ -139,6 +138,11 @@ type FakeHome() =
|
|||
Payload = @"{ ""action"": ""arrow_left_click"" }" }
|
||||
|> ReceivedZigbeeEvent
|
||||
|> onEventPublished.Trigger
|
||||
| RemoteInteraction RemotePressedRightButton ->
|
||||
{ Topic = $"zigbee2mqtt/{remoteControlFriendlyName.Get}"
|
||||
Payload = @"{ ""action"": ""arrow_right_click"" }" }
|
||||
|> ReceivedZigbeeEvent
|
||||
|> onEventPublished.Trigger
|
||||
| TimeChanged newTime -> newTime |> Event.TimeChanged |> onEventPublished.Trigger
|
||||
|
||||
type FakeHome with
|
||||
|
|
@ -147,19 +151,6 @@ type FakeHome with
|
|||
member this.LightsThatAreOn =
|
||||
this.LightStates |> Seq.filter (snd >> _.IsOn) |> Seq.toList
|
||||
|
||||
member this.NonRemotelyControlledLightStates =
|
||||
this.LightStates
|
||||
|> Seq.filter (fun (light, _) ->
|
||||
light = LivingRoomWallLamp
|
||||
|| light = LivingRoomFloorLamp
|
||||
|| light = BathroomCeilingLamp)
|
||||
|> Seq.toList
|
||||
|
||||
member this.RemotelyControlledLightStates =
|
||||
this.LightStates
|
||||
|> Seq.filter (fun (light, _) -> light = RightBedroomLamp || light = LeftBedroomLamp)
|
||||
|> Seq.toList
|
||||
|
||||
member this.Label =
|
||||
this.LightsThatAreOn
|
||||
|> Seq.map (fun (light, state) -> $"{(lightProps light).FriendlyName.Get}: {state}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue