Complete rename vocabulary (childrenBedroomButton, toIkeaRemoteAction)
This commit is contained in:
@@ -82,12 +82,12 @@ lightsOff = foldMap atTime timersOff
|
|||||||
>>> AFRP.onEvent (callService (light [AreaId "lasten_makuuhuone"] Off))
|
>>> AFRP.onEvent (callService (light [AreaId "lasten_makuuhuone"] Off))
|
||||||
|
|
||||||
|
|
||||||
bedroomButton :: HASS (Event Value) (Event (IkeaButton IkeaGesture))
|
childrenBedroomButton :: HASS (Event Value) (Event (IkeaButton IkeaGesture))
|
||||||
bedroomButton = ikeaQuickButton "event.children_quick_remote_action"
|
childrenBedroomButton = ikeaQuickButton "event.children_quick_remote_action"
|
||||||
|
|
||||||
childrenBedroomButtonController :: HASS (Event Value) ()
|
childrenBedroomButtonController :: HASS (Event Value) ()
|
||||||
childrenBedroomButtonController = proc x -> do
|
childrenBedroomButtonController = proc x -> do
|
||||||
ev <- bedroomButton >>> traceEvent -< x
|
ev <- childrenBedroomButton >>> traceEvent -< x
|
||||||
case ev of
|
case ev of
|
||||||
Event (OnButton ShortRelease) -> callService (activateScene "scene.lasten_nukkuvalmistelu") -< ()
|
Event (OnButton ShortRelease) -> callService (activateScene "scene.lasten_nukkuvalmistelu") -< ()
|
||||||
Event (OnButton DoubleClick) -> callService (activateScene "scene.lasten_luku") -< ()
|
Event (OnButton DoubleClick) -> callService (activateScene "scene.lasten_luku") -< ()
|
||||||
|
|||||||
@@ -61,8 +61,8 @@ data IkeaRemoteAction
|
|||||||
| RemoteBrightnessStop
|
| RemoteBrightnessStop
|
||||||
deriving Show
|
deriving Show
|
||||||
|
|
||||||
toIkeaController :: T.Text -> Maybe IkeaRemoteAction
|
toIkeaRemoteAction :: T.Text -> Maybe IkeaRemoteAction
|
||||||
toIkeaController = \case
|
toIkeaRemoteAction = \case
|
||||||
"on" -> Just RemoteOn
|
"on" -> Just RemoteOn
|
||||||
"off" -> Just RemoteOff
|
"off" -> Just RemoteOff
|
||||||
"brightness_move_up" -> Just RemoteBrightnessUp
|
"brightness_move_up" -> Just RemoteBrightnessUp
|
||||||
@@ -77,4 +77,4 @@ ikeaBoxRemote entityId = entityChangeEvent' entityId
|
|||||||
>>| arr (maybe (Left ()) Right . eventType)
|
>>| arr (maybe (Left ()) Right . eventType)
|
||||||
>>> toEvent
|
>>> toEvent
|
||||||
where
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user