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))
|
||||
|
||||
|
||||
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") -< ()
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user