Control the kitchen lights

This commit is contained in:
2026-09-14 14:45:45 +03:00
parent aaba917a9b
commit 0f7c6ff98a
9 changed files with 167 additions and 33 deletions
+7 -1
View File
@@ -8,6 +8,7 @@ module HomeAssistant.Controller
, HASSEff(..)
, HASS
, callService
, callServiceDyn
, entityChangeEvent
, entityChangeEvent'
, entityRead
@@ -61,6 +62,9 @@ type HASS a b = Mealy HASSEff a b
callService :: Service -> HASS a ()
callService service = eff (\req _ -> CallService req service)
callServiceDyn :: (a -> Service) -> HASS a ()
callServiceDyn mkService = eff (\req a -> CallService req (mkService a))
debug :: Show a => HASS a a
debug = proc x -> do
eff (const Debug) -< x
@@ -84,7 +88,9 @@ data DoorState = Open | Closed
instance Serialize DoorState
data Presence = Occupied | Unoccupied
deriving (Show, Eq)
deriving (Show, Eq, Generic)
instance Serialize Presence
presence :: T.Text -> HASS (Event Value) (Event Presence)
presence entityId =entityBool entityId