https://github.com/codetheweb/bay-wheels-hass
A Home Assistent integration for Bay Wheels
https://github.com/codetheweb/bay-wheels-hass
Last synced: 3 days ago
JSON representation
A Home Assistent integration for Bay Wheels
- Host: GitHub
- URL: https://github.com/codetheweb/bay-wheels-hass
- Owner: codetheweb
- Created: 2026-01-21T03:50:37.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2026-01-21T03:51:31.000Z (4 months ago)
- Last Synced: 2026-04-29T10:44:09.010Z (20 days ago)
- Language: Python
- Size: 126 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Bay Wheels Home Assistant Integration
A Home Assistant custom integration for Bay Wheels bike-share that provides station monitoring sensors and services for creating and canceling bike reservations. Vibe coded, so use at your own risk.
## Features
- **Station monitoring**: Track bike availability at your favorite stations with sensors for e-bikes available, regular bikes available, and maximum e-bike range
- **Automatic range validation**: When creating a reservation, the integration checks if the assigned bike meets your minimum range requirement and automatically cancels if it doesn't
- **Token refresh**: Automatically refreshes authentication tokens when they expire
- **Reauth flow**: Prompts for re-authentication when tokens can't be refreshed
## Installation
### HACS (Recommended)
1. Open HACS in your Home Assistant instance
2. Click the three dots in the top right corner and select **Custom repositories**
3. Add `https://github.com/codetheweb/bay-wheels-hass` with category **Integration**
4. Click **Add**
5. Search for "Bay Wheels" in HACS and click **Download**
6. Restart Home Assistant
### Manual
1. Download the latest release from [GitHub](https://github.com/codetheweb/bay-wheels-hass/releases)
2. Extract and copy the `custom_components/bay_wheels` directory to your Home Assistant `config/custom_components/` directory
3. Restart Home Assistant
## Configuration
### Initial Setup
1. Go to **Settings** → **Devices & Services** → **Add Integration**
2. Search for "Bay Wheels"
3. Enter your phone number in E.164 format (e.g., `+14155551234`)
4. Enter the SMS verification code sent to your phone
5. If prompted, enter your email address for verification
### Selecting Stations to Monitor
After initial setup, configure which stations to monitor:
1. Go to **Settings** → **Devices & Services**
2. Find the Bay Wheels integration and click **Configure**
3. Select the stations you want to monitor from the list
4. Click **Submit**
Each selected station creates three sensors:
- **E-Bikes Available**: Number of e-bikes currently at the station
- **Bikes Available**: Number of regular bikes at the station
- **Max E-Bike Range**: Highest battery range (in miles) among available e-bikes
Sensors update every 60 seconds and include extra attributes: `station_id`, `latitude`, `longitude`, `docks_available`, and `is_offline`.
## Services
### `bay_wheels.create_reservation`
Reserve an e-bike at a Bay Wheels station with minimum range validation.
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `station_id` | string | Yes | Bay Wheels station ID (e.g., `motivate_BAY_abc123`) |
| `min_range` | float | Yes | Minimum acceptable battery range in miles |
**Response:**
```yaml
ride_id: "12345678"
bike_id: "BAY12345"
estimated_range_miles: 25
station_id: "motivate_BAY_abc123"
```
**Behavior:**
- Creates a reservation at the specified station
- Fetches the assigned bike's battery range
- If the range is below `min_range`, automatically cancels and returns an error
- If the bike range can't be verified, automatically cancels for safety
### `bay_wheels.cancel_reservation`
Cancel an active Bay Wheels reservation.
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `ride_id` | string | Yes | The reservation/ride ID to cancel |
## Example Automation
```yaml
automation:
- alias: "Reserve bike when leaving work"
trigger:
- platform: zone
entity_id: person.me
zone: zone.work
event: leave
action:
- service: bay_wheels.create_reservation
data:
station_id: "motivate_BAY_abc123"
min_range: 15
response_variable: reservation
- service: notify.mobile_app
data:
message: "Bike {{ reservation.bike_id }} reserved with {{ reservation.estimated_range_miles }} miles range"
```
## Requirements
- Home Assistant 2024.1.0 or newer
- A Bay Wheels account with a valid phone number
The `bay-wheels` Python package is installed automatically.
## License
MIT