Store a custom snapshot of lights
This commit is contained in:
@@ -34,6 +34,7 @@ import AFRP (Request(..), Event(..))
|
||||
import Control.Monad (when)
|
||||
import Control.Monad.IO.Class (MonadIO, liftIO)
|
||||
import HomeAssistant.Runtime.Flags (Flags, isEnabled)
|
||||
import Data.Foldable (forM_)
|
||||
|
||||
-- | Shared runtime state: inbound is a broadcast channel (controllers
|
||||
-- read from 'dupTChan' copies), outbound queues service calls for the
|
||||
@@ -76,6 +77,10 @@ channelHassEval bus = \case
|
||||
logFM DebugS (ls $ show svc)
|
||||
enabled <- isEnabled (busFlags bus) (requestHandler req)
|
||||
when enabled $ liftIO $ atomically $ writeTChan (busOutbound bus) (req, svc)
|
||||
CallServices req svcs -> katipAddContext (sl "traceId" (toText (requestTraceId req))) $ forM_ svcs $ \svc -> do
|
||||
logFM DebugS (ls $ show svc)
|
||||
enabled <- isEnabled (busFlags bus) (requestHandler req)
|
||||
when enabled $ liftIO $ atomically $ writeTChan (busOutbound bus) (req, svc)
|
||||
Debug x -> logFM DebugS (ls $ show x)
|
||||
Trace req x -> katipAddContext (sl "traceId" (toText (requestTraceId req))) $
|
||||
logFM InfoS (ls $ show x)
|
||||
|
||||
Reference in New Issue
Block a user