Bedroom buttons: long off press turns the hallway lights off too

This commit is contained in:
MasseR committed 2026-11-09 12:11:34 +02:00
1 parent c5c11fe8d3
commit 383143024a
2 files changed
+18

No files matched your search

+6
View File
@@ -129,6 +129,9 @@ bedroomButtonController = proc x -> do
callService "scene.makuuhuone_keski" (activateScene "scene.makuuhuone_keski") -< () callService "scene.makuuhuone_keski" (activateScene "scene.makuuhuone_keski") -< ()
Event (Masse (OnButton LongClick)) -> do Event (Masse (OnButton LongClick)) -> do
callService "scene.makuuhuone_kirkas" (activateScene "scene.makuuhuone_kirkas") -< () callService "scene.makuuhuone_kirkas" (activateScene "scene.makuuhuone_kirkas") -< ()
Event (Masse (OffButton LongClick)) -> do
callService "Lights off" (light [AreaId "makuuhuone"] Off) -< ()
callService "Hallway lights off" (light [EntityId "light.hallway_lights"] Off) -< ()
Event (Masse (OffButton _)) -> do Event (Masse (OffButton _)) -> do
callService "Lights off" (light [AreaId "makuuhuone"] Off) -< () callService "Lights off" (light [AreaId "makuuhuone"] Off) -< ()
Event (Enishen (OnButton ShortRelease)) -> do Event (Enishen (OnButton ShortRelease)) -> do
@@ -137,6 +140,9 @@ bedroomButtonController = proc x -> do
callService "scene.makuuhuone_keski" (activateScene "scene.makuuhuone_keski") -< () callService "scene.makuuhuone_keski" (activateScene "scene.makuuhuone_keski") -< ()
Event (Enishen (OnButton LongClick)) -> do Event (Enishen (OnButton LongClick)) -> do
callService "scene.makuuhuone_kirkas" (activateScene "scene.makuuhuone_kirkas") -< () callService "scene.makuuhuone_kirkas" (activateScene "scene.makuuhuone_kirkas") -< ()
Event (Enishen (OffButton LongClick)) -> do
callService "Lights off" (light [AreaId "makuuhuone"] Off) -< ()
callService "Hallway lights off" (light [EntityId "light.hallway_lights"] Off) -< ()
Event (Enishen (OffButton _)) -> do Event (Enishen (OffButton _)) -> do
callService "Lights off" (light [AreaId "makuuhuone"] Off) -< () callService "Lights off" (light [AreaId "makuuhuone"] Off) -< ()
_ -> returnA -< () _ -> returnA -< ()
+12
View File
@@ -195,6 +195,14 @@ buttonSpec = describe "bedroomButtonController" $ do
concat (services (runHASS bedroomButtonController [masseButton "2_short_release"])) concat (services (runHASS bedroomButtonController [masseButton "2_short_release"]))
`shouldContain` [light [area] Off] `shouldContain` [light [area] Off]
it "Masse long off click also turns the hallway lights off" $
concat (services (runHASS bedroomButtonController [masseButton "2_long_press"]))
`shouldContain` [light [EntityId "light.hallway_lights"] Off]
it "Masse short off click leaves the hallway lights alone" $
concat (services (runHASS bedroomButtonController [masseButton "2_short_release"]))
`shouldNotContain` [light [EntityId "light.hallway_lights"] Off]
it "Enishen single click turns on her nightstand scene (lowest)" $ it "Enishen single click turns on her nightstand scene (lowest)" $
concat (services (runHASS bedroomButtonController [enishenButton "1_short_release"])) concat (services (runHASS bedroomButtonController [enishenButton "1_short_release"]))
`shouldContain` [activateScene "scene.makuuhuone_jemina"] `shouldContain` [activateScene "scene.makuuhuone_jemina"]
@@ -211,6 +219,10 @@ buttonSpec = describe "bedroomButtonController" $ do
concat (services (runHASS bedroomButtonController [enishenButton "2_short_release"])) concat (services (runHASS bedroomButtonController [enishenButton "2_short_release"]))
`shouldContain` [light [area] Off] `shouldContain` [light [area] Off]
it "Enishen long off click also turns the hallway lights off" $
concat (services (runHASS bedroomButtonController [enishenButton "2_long_press"]))
`shouldContain` [light [EntityId "light.hallway_lights"] Off]
it "ignores the initial press (scene only fires on release)" $ it "ignores the initial press (scene only fires on release)" $
services (runHASS bedroomButtonController [masseButton "1_initial_press"]) services (runHASS bedroomButtonController [masseButton "1_initial_press"])
`shouldBe` [[]] `shouldBe` [[]]