{-# LANGUAGE OverloadedStrings #-} module Tesla.Car.Command.Windows ( ventWindows, closeWindows, ventSunroof, closeSunroof ) where import Control.Monad.IO.Class (MonadIO (..)) import Data.Text (Text) import Network.Wreq (FormParam (..)) import Tesla.Car.Command windowControl :: MonadIO m => Text -> (Double, Double) -> Car m CommandResponse windowControl :: Text -> (Double, Double) -> Car m CommandResponse windowControl Text x (Double lat,Double lon) = String -> [FormParam] -> Car m CommandResponse forall (m :: * -> *) p. (MonadIO m, Postable p) => String -> p -> Car m CommandResponse runCmd String "window_control" [ ByteString "command" ByteString -> Text -> FormParam forall v. FormValue v => ByteString -> v -> FormParam := Text x, ByteString "lat" ByteString -> Double -> FormParam forall v. FormValue v => ByteString -> v -> FormParam := Double lat, ByteString "lon" ByteString -> Double -> FormParam forall v. FormValue v => ByteString -> v -> FormParam := Double lon] ventWindows :: MonadIO m => Car m CommandResponse ventWindows :: Car m CommandResponse ventWindows = Text -> (Double, Double) -> Car m CommandResponse forall (m :: * -> *). MonadIO m => Text -> (Double, Double) -> Car m CommandResponse windowControl Text "vent" (Double 0,Double 0) closeWindows :: MonadIO m => (Double, Double) -> Car m CommandResponse closeWindows :: (Double, Double) -> Car m CommandResponse closeWindows = Text -> (Double, Double) -> Car m CommandResponse forall (m :: * -> *). MonadIO m => Text -> (Double, Double) -> Car m CommandResponse windowControl Text "close" sc :: MonadIO m => Text -> Car m CommandResponse sc :: Text -> Car m CommandResponse sc Text c = String -> [FormParam] -> Car m CommandResponse forall (m :: * -> *) p. (MonadIO m, Postable p) => String -> p -> Car m CommandResponse runCmd String "sun_roof_control" [ ByteString "state" ByteString -> Text -> FormParam forall v. FormValue v => ByteString -> v -> FormParam := Text c ] ventSunroof :: MonadIO m => Car m CommandResponse ventSunroof :: Car m CommandResponse ventSunroof = Text -> Car m CommandResponse forall (m :: * -> *). MonadIO m => Text -> Car m CommandResponse sc Text "vent" closeSunroof :: MonadIO m => Car m CommandResponse closeSunroof :: Car m CommandResponse closeSunroof = Text -> Car m CommandResponse forall (m :: * -> *). MonadIO m => Text -> Car m CommandResponse sc Text "close"