tesla 0.7.4.0 → 0.7.5.0
raw patch · 2 files changed
+23/−3 lines, 2 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Tesla.Car: locationData :: MonadIO m => Car m VehicleData
+ Tesla.Car: vehicleDriveState :: MonadIO m => Car m VehicleData
- Tesla.Car: _Closed :: forall a_asHs. Prism' (OpenState a_asHs) a_asHs
+ Tesla.Car: _Closed :: forall a_asHP. Prism' (OpenState a_asHP) a_asHP
- Tesla.Car: _Open :: forall a_asHs. Prism' (OpenState a_asHs) a_asHs
+ Tesla.Car: _Open :: forall a_asHP. Prism' (OpenState a_asHP) a_asHP
- Tesla.Car.Command: (.=) :: (KeyValue kv, ToJSON v) => Key -> v -> kv
+ Tesla.Car.Command: (.=) :: (KeyValue e kv, ToJSON v) => Key -> v -> kv
Files
- src/Tesla/Car.hs +21/−1
- tesla.cabal +2/−2
src/Tesla/Car.hs view
@@ -23,7 +23,7 @@ Car, runCar, runNamedCar, VehicleID, -- * Requests- vehicleData, nearbyChargers, vehicleStatus, isAwake,+ vehicleData, locationData, nearbyChargers, vehicleStatus, isAwake, vehicleDriveState, -- * Convenience functions for examining VehicleData VehicleData, isUserPresent, isCharging, teslaTS, maybeTeslaTS, Door(..), OpenState(..), _Open, _Closed, doors, openDoors,@@ -146,6 +146,26 @@ r <- liftIO $ getWith (authOpts a) (vehicleURL v "vehicle_data") pure . fromJust . inner $ r ^. responseBody where inner = BL.stripPrefix "{\"response\":" <=< BL.stripSuffix "}"++-- | Fetch location information.+locationData :: MonadIO m => Car m VehicleData+locationData = do+ a <- teslaAuth+ v <- currentVehicleID+ r <- liftIO $ getWith (authOpts a) (vehicleURL v "vehicle_data?endpoints=location_data")+ pure . fromJust . inner $ r ^. responseBody+ where inner = BL.stripPrefix "{\"response\":" <=< BL.stripSuffix "}"++-- https://owner-api.teslamotors.com/api/1/vehicles/:id/data_request/drive_state+-- /api/1/vehicles/1492931202218670/data_request/drive_state+vehicleDriveState :: MonadIO m => Car m VehicleData+vehicleDriveState = do+ a <- teslaAuth+ v <- currentVehicleID+ r <- liftIO $ getWith (authOpts a) (vehicleURL v "data_request/drive_state")+ pure . fromJust . inner $ r ^. responseBody+ where inner = BL.stripPrefix "{\"response\":" <=< BL.stripSuffix "}"+ -- | Prism for viewing 'VehicleData' as an Aeson 'Value'. vdata :: Prism' VehicleData Value
tesla.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: e0d2e2f773d615d0ece057d0010a09010354337fbe9736a6489f13ab7c0d11f9+-- hash: f2b48e7660c0e754e6f9e9eefad8d4929d5b0366526bd7b5182df9cb6ee9cc93 name: tesla-version: 0.7.4.0+version: 0.7.5.0 synopsis: Tesla API client. description: Please see the README on GitHub at <https://github.com/dustin/tesla#readme> category: Web