Compare commits
2
Commits
e50a505a13
...
a77b85b576
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a77b85b576 | ||
|
|
b5574e7436 |
@@ -3,3 +3,5 @@ dist-newstyle
|
|||||||
.direnv
|
.direnv
|
||||||
|
|
||||||
.worktrees/
|
.worktrees/
|
||||||
|
|
||||||
|
docs/superpowers
|
||||||
|
|||||||
+3
-3
@@ -1,8 +1,8 @@
|
|||||||
HA_TOKEN: ENC[AES256_GCM,data:zs9nTT2EV/OhBiH9alUuupUvYURXj40lxe7IKKWXdExW+BW98yEDHcQr/KNsQ0Iu9+U2GrsA8WpODeM351kI3Owj3rl082tObBJ2jwF1iyYcXhoH3xvbHb+HN802SBOTIO32m+ZwGvIVPjF8W+67eGKTrIUcqnKj7Ab/TchG+mYPLdil0mYjITY+DCUi0mW1nElCaTTexovj4PHlUdA1xIsCYF+XnTypQv8o+Zy8MsMZtdzNQKJG,iv:Lmxmp5y15sqhQvEO7liVk6x3Y26qtoL39TT2MSqZdok=,tag:1Xvs6YUilP/XH0UxYngTIg==,type:str]
|
HA_TOKEN: ENC[AES256_GCM,data:zs9nTT2EV/OhBiH9alUuupUvYURXj40lxe7IKKWXdExW+BW98yEDHcQr/KNsQ0Iu9+U2GrsA8WpODeM351kI3Owj3rl082tObBJ2jwF1iyYcXhoH3xvbHb+HN802SBOTIO32m+ZwGvIVPjF8W+67eGKTrIUcqnKj7Ab/TchG+mYPLdil0mYjITY+DCUi0mW1nElCaTTexovj4PHlUdA1xIsCYF+XnTypQv8o+Zy8MsMZtdzNQKJG,iv:Lmxmp5y15sqhQvEO7liVk6x3Y26qtoL39TT2MSqZdok=,tag:1Xvs6YUilP/XH0UxYngTIg==,type:str]
|
||||||
HA_HOST: ENC[AES256_GCM,data:6ivOMsDGVWsc+xV+Qjk5Y/bbu7cy/g==,iv:nFkLQCNk6DlW5vFq8So44YoICL95GYlhrvj4Rqes9kM=,tag:Nkqnflf4lazGdYnoDkFVVw==,type:str]
|
HA_HOST: ENC[AES256_GCM,data:MfA+RReJHnKP31bD4YAoZrc=,iv:Z9xDtzPsUER4jQ12BbM2EtnLNggZhOWzCb7VAL2I02g=,tag:/Eogbd2kT7phdhaR/vGNDA==,type:str]
|
||||||
sops:
|
sops:
|
||||||
lastmodified: "2026-08-20T10:49:23Z"
|
lastmodified: "2026-08-21T10:17:59Z"
|
||||||
mac: ENC[AES256_GCM,data:Vfks6xgIizhaYD90vEtWFwjFG1qox56/rlSOMzLZ30xKx1x+085hrlSsq4XOgqBXTDAXeRbMXTpZe/U259gNbfHeBYfpQOgwjHg5MrXl8K3G6eIEWkv/OBQfPpR1DVrhfJsN34ehOUkt3h7K+uHad/XAUavwNNaOQ8fInvRCMqo=,iv:XAvgJJONoI8G5bJ09nR7wxnoH/HJVsPkz2ahXP5fOvI=,tag:hprULBSFR/JpLTot9+B/ng==,type:str]
|
mac: ENC[AES256_GCM,data:GuNyo/3flhR30e6kds1iXcDGmq0Xq2hqvBmAvYtakKwzUzMocP9vImfxs+MfVNiMGirlkwbihrX5mFSbfORjES/FDTs6p0100H1tkBqPTecW88PC6/66Js9umVevGYbgToCNBjV9mUBu7o7SyU+NYLnZ/8X4xdx0y6/MKnuvjUA=,iv:/nL5AIL80iV3sutjMTmHyF62SRezmX9XyJJ6+o9TdkQ=,tag:SNMu17rgMIhdzZVsGmXyfg==,type:str]
|
||||||
pgp:
|
pgp:
|
||||||
- created_at: "2026-08-20T05:39:51Z"
|
- created_at: "2026-08-20T05:39:51Z"
|
||||||
enc: |-
|
enc: |-
|
||||||
|
|||||||
@@ -65,8 +65,9 @@ runController bus (Controller name machine _enabled) = do
|
|||||||
defaultMain :: IO ()
|
defaultMain :: IO ()
|
||||||
defaultMain = withSocketsDo $ withBus $ \bus -> do
|
defaultMain = withSocketsDo $ withBus $ \bus -> do
|
||||||
token <- getEnv "HA_TOKEN"
|
token <- getEnv "HA_TOKEN"
|
||||||
|
host <- getEnv "HA_HOST"
|
||||||
let workers =
|
let workers =
|
||||||
[ ("reader", readerAction "last-resort-redux" 8123 token bus)
|
[ ("reader", readerAction host 8123 token bus)
|
||||||
, ("writer", writerAction bus)
|
, ("writer", writerAction bus)
|
||||||
] ++ [ (name, runController bus c) | c@(Controller name _ True) <- controllers ]
|
] ++ [ (name, runController bus c) | c@(Controller name _ True) <- controllers ]
|
||||||
as <- mapM (\(name, act) -> async (supervised name defaultBackoff act)) workers
|
as <- mapM (\(name, act) -> async (supervised name defaultBackoff act)) workers
|
||||||
|
|||||||
+2
-1
@@ -34,7 +34,8 @@ spec = describe "Bus" $ do
|
|||||||
svc = Service "light" "turn_on" Nothing [EntityId "light.bedroom_masse"]
|
svc = Service "light" "turn_on" Nothing [EntityId "light.bedroom_masse"]
|
||||||
runKatipContextT (busLogEnv bus) () (Namespace ["test"]) $
|
runKatipContextT (busLogEnv bus) () (Namespace ["test"]) $
|
||||||
channelHassEval bus (CallService req svc)
|
channelHassEval bus (CallService req svc)
|
||||||
atomically (readTChan (busOutbound bus)) `shouldReturn` svc
|
(_, svc') <- atomically $ readTChan (busOutbound bus)
|
||||||
|
svc' `shouldBe` svc
|
||||||
|
|
||||||
|
|
||||||
it "generates unique sequential call ids" $ do
|
it "generates unique sequential call ids" $ do
|
||||||
|
|||||||
+4
-4
@@ -22,11 +22,11 @@ spec = describe "runController" $ do
|
|||||||
atomically $ writeTChan (busInbound bus) (doorEvent "off") -- door closes: lights on
|
atomically $ writeTChan (busInbound bus) (doorEvent "off") -- door closes: lights on
|
||||||
atomically $ writeTChan (busInbound bus) (doorEvent "on") -- door opens: lights off
|
atomically $ writeTChan (busInbound bus) (doorEvent "on") -- door opens: lights off
|
||||||
putStrLn "After the writes"
|
putStrLn "After the writes"
|
||||||
svc1 <- boundedRead (busOutbound bus)
|
Right (_, svc1) <- boundedRead (busOutbound bus)
|
||||||
svc2 <- boundedRead (busOutbound bus)
|
Right (_, svc2) <- boundedRead (busOutbound bus)
|
||||||
putStrLn "After the reads"
|
putStrLn "After the reads"
|
||||||
svc1 `shouldBe` Right (light [EntityId "light.bedroom_masse"] True)
|
svc1 `shouldBe` light [EntityId "light.bedroom_masse"] True
|
||||||
svc2 `shouldBe` Right (light [EntityId "light.bedroom_masse"] False)
|
svc2 `shouldBe` light [EntityId "light.bedroom_masse"] False
|
||||||
atomically (isEmptyTChan (busOutbound bus)) `shouldReturn` True
|
atomically (isEmptyTChan (busOutbound bus)) `shouldReturn` True
|
||||||
where
|
where
|
||||||
boundedRead channel = race (threadDelay 10000) (atomically (readTChan channel))
|
boundedRead channel = race (threadDelay 10000) (atomically (readTChan channel))
|
||||||
|
|||||||
Reference in New Issue
Block a user