Skip to content

Commit

Permalink
Merge pull request #6 from messum/main
Browse files Browse the repository at this point in the history
Added support for 3-character train stops like AVA
  • Loading branch information
make-all committed Feb 1, 2023
2 parents a1cf50e + b495f13 commit d3bc4a0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ API keys can be obtained by registering on the
[Metlink Developer Portal](https://opendata.metlink.org.nz/). **Be sure to subscribe to the "Metlink Open Data API".** Currently this is the only API they offer, and is free, but is still unsubscribed by default.


`stop_id` for Train and Cable Car stops is a 4 character alphabetic
`stop_id` for Train and Cable Car stops is a 3 to 4 character alphabetic
code, and for bus and ferry stops, is a 4 digit numeric code.
The IDs are on bus stop signs, or can be looked up on the
[Metlink](https://metlink.org.nz) main web site.
Expand Down
4 changes: 2 additions & 2 deletions custom_components/metlink/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
AUTH_SCHEMA = vol.Schema({vol.Required(CONF_API_KEY): cv.string})
STOP_SCHEMA = vol.Schema(
{
vol.Required(CONF_STOP_ID): vol.All(cv.string, vol.Length(min=4, max=4)),
vol.Required(CONF_STOP_ID): vol.All(cv.string, vol.Length(min=3, max=4)),
vol.Optional(CONF_ROUTE, default=""): vol.All(cv.string, vol.Length(max=3)),
vol.Optional(CONF_DEST, default=""): cv.string,
vol.Optional(CONF_NUM_DEPARTURES, default=1): cv.positive_int,
Expand Down Expand Up @@ -196,7 +196,7 @@ async def async_step_init(
CONF_STOPS, default=list(all_stops.keys())
): cv.multi_select(all_stops),
vol.Optional(CONF_STOP_ID): vol.All(
cv.string, vol.Length(min=4, max=4)
cv.string, vol.Length(min=3, max=4)
),
vol.Optional(CONF_ROUTE, default=""): vol.All(
cv.string, vol.Length(max=3)
Expand Down
4 changes: 2 additions & 2 deletions custom_components/metlink/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"title": "Add Metlink Stop",
"description": "Add a bus or train stop. Check the box to add another.",
"data": {
"stop_id": "4 digit or letter stop id.",
"stop_id": "3 to 4 digit or letter stop id.",
"route": "(Optional) Route filter.",
"destination": "(Optional} Final destination filter.",
"num_departures": "Number of departures to track. (Default: 1)",
Expand All @@ -31,7 +31,7 @@
"description": "Add or remove stops.",
"data": {
"stops": "Existing stops (unselect to remove)",
"stop_id": "4 digit or letter stop id.",
"stop_id": "3 to 4 digit or letter stop id.",
"route": "(Optional) Route filter.",
"destination": "(Optional) Final destination filter.",
"num_departures": "Number of departures to track. (Default: 1)"
Expand Down

0 comments on commit d3bc4a0

Please sign in to comment.