Skip to content

Commit

Permalink
feat(lock-status): Added reference docs and batch mapping (#124)
Browse files Browse the repository at this point in the history
updated docs to show the function and the return values of the lock_status method

updated the map dict to map the security endpoint to lock_status when using batch
  • Loading branch information
JacobAndrewSmith92 authored Aug 25, 2023
1 parent f8ba40c commit 273f3bc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,25 @@ Returns the `Permissions` NamedTuple, paged list of all permissions currently as
| `Permissions.unit_system` | String[] | An array of permission |
| `Permissions.meta` | collections.namedtuple | Smartcar response headers (`request_id`, `data_age`, and/or `unit_system`) |

---

### `lock_status(self)`

Returns the lock status for a vehicle and the open status of its doors, windows, storage units, sunroof and charging port where available. The open status array(s) will be empty if a vehicle has partial support. The request will error if lock status can not be retrieved from the vehicle or the brand is not supported.

#### Return

| Value | Type | Description |
|:--------------------------|:-----------------------|:---------------------------------------------------------------------------|
| `isLocked` | bool | Indicates whether the vehicle is locked. |
| `doors` | typing.NamedTuple | An array of the open status of the vehicle's doors. Array length will vary depending on the number of doors. |
| `windows` | typing.NamedTuple | An array of the open status of the vehicle's windows. Array length will vary depending on the number of windows. |
| `sunroof` | typing.NamedTuple | An array of the open status of the vehicle's sunroofs. |
| `storage` | typing.NamedTuple | An array of the open status of the vehicle's storages. For internal combustion and plug-in hybrid vehicles, front refers to the engine hood. For battery vehicles, this will be the front trunk. |
| `chargingPort` | typing.NamedTuple | An array of the open status of the vehicle's charging port |
| `LockStatus.meta` | collections.namedtuple | Smartcar response headers (`request_id`, `data_age`, and/or `unit_system`) |


---

### `batch(self, paths)`
Expand Down
1 change: 1 addition & 0 deletions smartcar/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ def format_path_and_attribute_for_batch(raw_path: str) -> tuple:
"charge/limit": "get_charge_limit",
"tires/pressure": "tire_pressure",
"": "attributes",
"security": "lock_status",
}
formatted_path = raw_path[1:] if raw_path[0] == "/" else raw_path
formatted_attribute = mapper.get(formatted_path, formatted_path)
Expand Down

0 comments on commit 273f3bc

Please sign in to comment.