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
+4
-4
@@ -36,18 +36,18 @@ dinnerTableSpec = describe "dinnerTableController" $ do
|
||||
|
||||
it "turns lights on when presence is occupied and light level is low" $ do
|
||||
services (runHASS dinnerTableController [testDinnerLightLevel 10, testDinnerPresence "on"])
|
||||
`shouldBe` [[switchService [EntityId "switch.adaptive_lighting_ruokapoydan_valot_sleep_mode"] True], [switchService [EntityId "switch.adaptive_lighting_ruokapoydan_valot_sleep_mode"] False, light [EntityId "light.kitchen_dining_large"] (On def)]]
|
||||
`shouldBe` [[switchService [EntityId "switch.adaptive_lighting_ruokapoydan_valot_sleep_mode"] [] True], [switchService [EntityId "switch.adaptive_lighting_ruokapoydan_valot_sleep_mode"] [] False, light [EntityId "light.kitchen_dining_large"] [] (On def)]]
|
||||
|
||||
it "turns lights to sleep when presence is unoccupied" $ do
|
||||
now <- getCurrentTime
|
||||
services (runHASSTimed dinnerTableController [(now, testDinnerLightLevel 10), (now, testDinnerPresence "off")])
|
||||
`shouldBe` [[switchService [EntityId "switch.adaptive_lighting_ruokapoydan_valot_sleep_mode"] True], []]
|
||||
`shouldBe` [[switchService [EntityId "switch.adaptive_lighting_ruokapoydan_valot_sleep_mode"] [] True], []]
|
||||
it "turns lights off when no presence for 300 seconds" $ do
|
||||
now <- getCurrentTime
|
||||
let later = 305 `addUTCTime` now
|
||||
services (runHASSTimed dinnerTableController [(now, testDinnerLightLevel 10), (now, testDinnerPresence "off"), (later, Tick)])
|
||||
`shouldBe` [[switchService [EntityId "switch.adaptive_lighting_ruokapoydan_valot_sleep_mode"] True], [], [switchService [EntityId "switch.adaptive_lighting_ruokapoydan_valot_sleep_mode"] False, light [EntityId "light.kitchen_dining_large"] Off]]
|
||||
`shouldBe` [[switchService [EntityId "switch.adaptive_lighting_ruokapoydan_valot_sleep_mode"] [] True], [], [switchService [EntityId "switch.adaptive_lighting_ruokapoydan_valot_sleep_mode"] [] False, light [EntityId "light.kitchen_dining_large"] [] Off]]
|
||||
|
||||
it "does nothing on Tick" $ do
|
||||
services (runHASS dinnerTableController [Tick])
|
||||
`shouldBe` [[switchService [EntityId "switch.adaptive_lighting_ruokapoydan_valot_sleep_mode"] True]]
|
||||
`shouldBe` [[switchService [EntityId "switch.adaptive_lighting_ruokapoydan_valot_sleep_mode"] [] True]]
|
||||
Reference in new issue
Block a user