Add target exclusions to service calls
Services can now carry excluded targets, encoded as target.exclude in the WebSocket payload. The children's bedroom lights-off calls skip lights labelled 'decoration'.
This commit is contained in:
1 parent
383143024a
commit
9c89504399
15 files changed
+115
-86
No files matched your search
+15
-15
@@ -180,11 +180,11 @@ lightsSpec = do
|
||||
describe "hallwayLightsController" $ do
|
||||
it "turns the full lights on when someone enters during daytime" $
|
||||
services (runHASSTimed hallwayLightsController [(day, motionSensor "on")])
|
||||
`shouldBe` [[light [EntityId "light.hallway_lights"] (On def)]]
|
||||
`shouldBe` [[light [EntityId "light.hallway_lights"] [] (On def)]]
|
||||
|
||||
it "turns the full lights on when someone enters during daytime preceding tick" $
|
||||
services (runHASSTimed hallwayLightsController [(day, Tick), (day, motionSensor "on")])
|
||||
`shouldBe` [[], [light [EntityId "light.hallway_lights"] (On def)]]
|
||||
`shouldBe` [[], [light [EntityId "light.hallway_lights"] [] (On def)]]
|
||||
|
||||
it "turns the lights off when everyone leaves, without sleep mode" $
|
||||
let later = 505 `addUTCTime` day
|
||||
@@ -195,9 +195,9 @@ lightsSpec = do
|
||||
, (later, Tick)
|
||||
])
|
||||
`shouldBe` [ []
|
||||
, [light [EntityId "light.hallway_lights"] (On def)]
|
||||
, [light [EntityId "light.hallway_lights"] [] (On def)]
|
||||
, []
|
||||
, [light [EntityId "light.hallway_lights"] Off]
|
||||
, [light [EntityId "light.hallway_lights"] [] Off]
|
||||
]
|
||||
|
||||
it "turns on only the ceiling light when entering during sleep hours with a door open" $
|
||||
@@ -208,7 +208,7 @@ lightsSpec = do
|
||||
])
|
||||
`shouldBe` [ []
|
||||
, []
|
||||
, [light [EntityId "light.hallway_ceiling_2"] (On def)]
|
||||
, [light [EntityId "light.hallway_ceiling_2"] [] (On def)]
|
||||
]
|
||||
|
||||
it "leaves the lights unchanged when an empty bedroom door opens during sleep hours" $
|
||||
@@ -220,7 +220,7 @@ lightsSpec = do
|
||||
])
|
||||
`shouldBe` [ []
|
||||
, []
|
||||
, [light [EntityId "light.hallway_lights"] (On def)]
|
||||
, [light [EntityId "light.hallway_lights"] [] (On def)]
|
||||
, []
|
||||
]
|
||||
|
||||
@@ -233,7 +233,7 @@ lightsSpec = do
|
||||
, (night, motionSensor "on")
|
||||
])
|
||||
`shouldBe` [ [], [], [], []
|
||||
, [light [EntityId "light.hallway_lights"] (On def)]
|
||||
, [light [EntityId "light.hallway_lights"] [] (On def)]
|
||||
]
|
||||
|
||||
it "protects an open bedroom door as soon as its light is dimmed down" $
|
||||
@@ -246,8 +246,8 @@ lightsSpec = do
|
||||
, (night, bedroomLightEvent "light.bedroom_ceiling" 25)
|
||||
])
|
||||
`shouldBe` [ [], [], [], []
|
||||
, [light [EntityId "light.hallway_lights"] (On def)]
|
||||
, [light [EntityId "light.hallway_ceiling"] Off]
|
||||
, [light [EntityId "light.hallway_lights"] [] (On def)]
|
||||
, [light [EntityId "light.hallway_ceiling"] [] Off]
|
||||
]
|
||||
|
||||
it "counts a barely lit bedroom as ready to sleep" $
|
||||
@@ -260,8 +260,8 @@ lightsSpec = do
|
||||
, (night, masterDoor "on") -- opens for the cats, someone ready to sleep
|
||||
])
|
||||
`shouldBe` [ [], [], [], []
|
||||
, [light [EntityId "light.hallway_lights"] (On def)]
|
||||
, [light [EntityId "light.hallway_ceiling"] Off]
|
||||
, [light [EntityId "light.hallway_lights"] [] (On def)]
|
||||
, [light [EntityId "light.hallway_ceiling"] [] Off]
|
||||
]
|
||||
|
||||
it "dims the lower light when an occupied bedroom door opens during sleep hours" $
|
||||
@@ -273,8 +273,8 @@ lightsSpec = do
|
||||
, (night, masterDoor "on") -- opens for the cats, someone ready to sleep
|
||||
])
|
||||
`shouldBe` [ [], [], []
|
||||
, [light [EntityId "light.hallway_lights"] (On def)]
|
||||
, [light [EntityId "light.hallway_ceiling"] Off]
|
||||
, [light [EntityId "light.hallway_lights"] [] (On def)]
|
||||
, [light [EntityId "light.hallway_ceiling"] [] Off]
|
||||
]
|
||||
|
||||
it "turns the lower hallway light on when the doors close while presence is active" $
|
||||
@@ -285,7 +285,7 @@ lightsSpec = do
|
||||
, (night, childrenDoor "off")
|
||||
])
|
||||
`shouldBe` [ []
|
||||
, [light [EntityId "light.hallway_ceiling_2"] (On def)]
|
||||
, [light [EntityId "light.hallway_ceiling_2"] [] (On def)]
|
||||
, []
|
||||
, [light [EntityId "light.hallway_ceiling"] (On def)]
|
||||
, [light [EntityId "light.hallway_ceiling"] [] (On def)]
|
||||
]
|
||||
Reference in new issue
Block a user