Rename IkeaController to IkeaRemoteAction, fix brightness typo

This commit is contained in:
2026-09-29 23:44:56 +03:00
parent 889091d321
commit 138b62c54a
2 changed files with 19 additions and 19 deletions
+18 -18
View File
@@ -40,7 +40,7 @@ module HomeAssistant.Controller
, activateScene , activateScene
, activateSceneWith , activateSceneWith
, ikeaBoxRemote , ikeaBoxRemote
, IkeaController(..) , IkeaRemoteAction(..)
, LightAttributes(..) , LightAttributes(..)
, Brightness(..) , Brightness(..)
, formatLightAttributes , formatLightAttributes
@@ -301,28 +301,28 @@ ikeaQuickButton entityId =
where where
eventType v = v ^? key "event" . key "variables" . key "trigger" . key "to_state" . key "attributes" . key "event_type" . _String . to toIkeaQuickButton . traversed eventType v = v ^? key "event" . key "variables" . key "trigger" . key "to_state" . key "attributes" . key "event_type" . _String . to toIkeaQuickButton . traversed
data IkeaController data IkeaRemoteAction
= ControllerOn -- Short press on = RemoteOn -- Short press on
| ControllerOff -- Short press off | RemoteOff -- Short press off
| ControllerBrighnessUp -- Turn brightness up | RemoteBrightnessUp -- Turn brightness up
| ControllerBrighnessDown -- Turn brighness down | RemoteBrightnessDown -- Turn brightness down
| ControllerArrowRight -- Turn brighness down | RemoteArrowRight -- Arrow right
| ControllerArrowLeft -- Turn brighness down | RemoteArrowLeft -- Arrow left
| ControllerBrighnessStop | RemoteBrightnessStop
deriving Show deriving Show
toIkeaController :: T.Text -> Maybe IkeaController toIkeaController :: T.Text -> Maybe IkeaRemoteAction
toIkeaController = \case toIkeaController = \case
"on" -> Just ControllerOn "on" -> Just RemoteOn
"off" -> Just ControllerOff "off" -> Just RemoteOff
"brightness_move_up" -> Just ControllerBrighnessUp "brightness_move_up" -> Just RemoteBrightnessUp
"brightness_move_down" -> Just ControllerBrighnessDown "brightness_move_down" -> Just RemoteBrightnessDown
"brightness_stop" -> Just ControllerBrighnessStop "brightness_stop" -> Just RemoteBrightnessStop
"arrow_right_click" -> Just ControllerArrowRight "arrow_right_click" -> Just RemoteArrowRight
"arrow_left_click" -> Just ControllerArrowLeft "arrow_left_click" -> Just RemoteArrowLeft
_ -> Nothing _ -> Nothing
ikeaBoxRemote :: T.Text -> HASS (Event Value) (Event IkeaController) ikeaBoxRemote :: T.Text -> HASS (Event Value) (Event IkeaRemoteAction)
ikeaBoxRemote entityId = entityChangeEvent' entityId ikeaBoxRemote entityId = entityChangeEvent' entityId
>>| arr (maybe (Left ()) Right . eventType) >>| arr (maybe (Left ()) Right . eventType)
>>> toEvent >>> toEvent
+1 -1
View File
@@ -85,7 +85,7 @@ bedroomPresenceController = proc x -> do
data BedroomControls data BedroomControls
= Masse (IkeaButton IkeaGesture) = Masse (IkeaButton IkeaGesture)
| Enishen (IkeaButton IkeaGesture) | Enishen (IkeaButton IkeaGesture)
| Central IkeaController | Central IkeaRemoteAction
deriving Show deriving Show