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
, activateSceneWith
, ikeaBoxRemote
, IkeaController(..)
, IkeaRemoteAction(..)
, LightAttributes(..)
, Brightness(..)
, formatLightAttributes
@@ -301,28 +301,28 @@ ikeaQuickButton entityId =
where
eventType v = v ^? key "event" . key "variables" . key "trigger" . key "to_state" . key "attributes" . key "event_type" . _String . to toIkeaQuickButton . traversed
data IkeaController
= ControllerOn -- Short press on
| ControllerOff -- Short press off
| ControllerBrighnessUp -- Turn brightness up
| ControllerBrighnessDown -- Turn brighness down
| ControllerArrowRight -- Turn brighness down
| ControllerArrowLeft -- Turn brighness down
| ControllerBrighnessStop
data IkeaRemoteAction
= RemoteOn -- Short press on
| RemoteOff -- Short press off
| RemoteBrightnessUp -- Turn brightness up
| RemoteBrightnessDown -- Turn brightness down
| RemoteArrowRight -- Arrow right
| RemoteArrowLeft -- Arrow left
| RemoteBrightnessStop
deriving Show
toIkeaController :: T.Text -> Maybe IkeaController
toIkeaController :: T.Text -> Maybe IkeaRemoteAction
toIkeaController = \case
"on" -> Just ControllerOn
"off" -> Just ControllerOff
"brightness_move_up" -> Just ControllerBrighnessUp
"brightness_move_down" -> Just ControllerBrighnessDown
"brightness_stop" -> Just ControllerBrighnessStop
"arrow_right_click" -> Just ControllerArrowRight
"arrow_left_click" -> Just ControllerArrowLeft
"on" -> Just RemoteOn
"off" -> Just RemoteOff
"brightness_move_up" -> Just RemoteBrightnessUp
"brightness_move_down" -> Just RemoteBrightnessDown
"brightness_stop" -> Just RemoteBrightnessStop
"arrow_right_click" -> Just RemoteArrowRight
"arrow_left_click" -> Just RemoteArrowLeft
_ -> Nothing
ikeaBoxRemote :: T.Text -> HASS (Event Value) (Event IkeaController)
ikeaBoxRemote :: T.Text -> HASS (Event Value) (Event IkeaRemoteAction)
ikeaBoxRemote entityId = entityChangeEvent' entityId
>>| arr (maybe (Left ()) Right . eventType)
>>> toEvent
+1 -1
View File
@@ -85,7 +85,7 @@ bedroomPresenceController = proc x -> do
data BedroomControls
= Masse (IkeaButton IkeaGesture)
| Enishen (IkeaButton IkeaGesture)
| Central IkeaController
| Central IkeaRemoteAction
deriving Show