diff --git a/src/HomeAssistant/Controller/Children.hs b/src/HomeAssistant/Controller/Children.hs index 513ea30..a4dcfd9 100644 --- a/src/HomeAssistant/Controller/Children.hs +++ b/src/HomeAssistant/Controller/Children.hs @@ -82,12 +82,12 @@ lightsOff = foldMap atTime timersOff >>> AFRP.onEvent (callService (light [AreaId "lasten_makuuhuone"] Off)) -bedroomButton :: HASS (Event Value) (Event (IkeaButton IkeaGesture)) -bedroomButton = ikeaQuickButton "event.children_quick_remote_action" +childrenBedroomButton :: HASS (Event Value) (Event (IkeaButton IkeaGesture)) +childrenBedroomButton = ikeaQuickButton "event.children_quick_remote_action" childrenBedroomButtonController :: HASS (Event Value) () childrenBedroomButtonController = proc x -> do - ev <- bedroomButton >>> traceEvent -< x + ev <- childrenBedroomButton >>> traceEvent -< x case ev of Event (OnButton ShortRelease) -> callService (activateScene "scene.lasten_nukkuvalmistelu") -< () Event (OnButton DoubleClick) -> callService (activateScene "scene.lasten_luku") -< () diff --git a/src/HomeAssistant/Controller/Ikea.hs b/src/HomeAssistant/Controller/Ikea.hs index 4e6befe..06fc081 100644 --- a/src/HomeAssistant/Controller/Ikea.hs +++ b/src/HomeAssistant/Controller/Ikea.hs @@ -61,8 +61,8 @@ data IkeaRemoteAction | RemoteBrightnessStop deriving Show -toIkeaController :: T.Text -> Maybe IkeaRemoteAction -toIkeaController = \case +toIkeaRemoteAction :: T.Text -> Maybe IkeaRemoteAction +toIkeaRemoteAction = \case "on" -> Just RemoteOn "off" -> Just RemoteOff "brightness_move_up" -> Just RemoteBrightnessUp @@ -77,4 +77,4 @@ ikeaBoxRemote entityId = entityChangeEvent' entityId >>| arr (maybe (Left ()) Right . eventType) >>> toEvent where - eventType v = v ^? key "event" . key "variables" . key "trigger" . key "to_state" . key "attributes" . key "event_type" . _String . to toIkeaController . traversed + eventType v = v ^? key "event" . key "variables" . key "trigger" . key "to_state" . key "attributes" . key "event_type" . _String . to toIkeaRemoteAction . traversed