home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.52k stars 30.34k forks source link

UK Transport sensor #63738

Closed geofffarmer closed 2 years ago

geofffarmer commented 2 years ago

The problem

HA returns no busses whilst transportapi returns some busses for same query

HA returns

atcocode: 340000093BP3 locality: Bicester Town Centre, Bicester stop_name: Manorsfield Road request_time: '2022-01-09T14:09:40+00:00' next_buses: [] unit_of_measurement: min icon: mdi:bus friendly_name: Next bus to Oxford City Centre Magdalen Street East

transportapi returns

{ "atcocode": "340000093BP3", "smscode": "oxfamtjw", "request_time": "2022-01-09T14:45:48+00:00", "name": "Manorsfield Road (Stand 3)", "stop_name": "Manorsfield Road", "bearing": "SE", "indicator": "Stand 3", "locality": "Bicester Town Centre, Bicester", "location": { "type": "Point", "coordinates": [ -1.15359, 51.89824 ] }, "departures": { "S5": [ { "mode": "bus", "line": "S5", "line_name": "S5", "direction": "Oxford City Centre Magdalen Street East", "operator": "SOX", "date": "2022-01-09", "expected_departure_date": "2022-01-09", "aimed_departure_time": "14:50", "expected_departure_time": "14:50", "aimed": { "arrival": { "date": null, "time": null }, "departure": { "date": "2022-01-09", "time": "14:50" } }, "expected": { "arrival": { "date": null, "time": null }, "departure": { "date": "2022-01-09", "time": "14:50" } }, "best_departure_estimate": "14:50", "status": { "cancellation": { "value": false, "reason": null } }, "source": "NextBuses", "dir": null, "operator_name": null, "id": null }, ... "source": "NextBuses" }

What version of Home Assistant Core has the issue?

2021.12.8

What was the last working version of Home Assistant Core?

Unknown

What type of installation are you running?

Home Assistant OS

Integration causing the issue

UK Transport

Link to integration documentation on our website

https://www.home-assistant.io/integrations/uk_transport/

Example YAML snippet

# Tranpot API
- platform: uk_transport
  app_id: !secret transportapi_app_id
  app_key: !secret transportapi_key
  queries:
    - mode: bus
      origin: 340000093BP3
      destination: Oxford City Centre Magdalen Street East

Anything in the logs that might be useful for us?

No response

Additional information

I wonder if this is caused by the API parameter 'nextbuses' ?

if I send the following

https://transportapi.com/v3/uk/bus/stop/340000093BP3/live.json?app_id=MYID&app_key=MYKEY&group=route&nextbuses=no

then I also get no buses

{ "atcocode": "340000093BP3", "smscode": "oxfamtjw", "request_time": "2022-01-09T14:54:54+00:00", "name": "Manorsfield Road (Stand 3)", "stop_name": "Manorsfield Road", "bearing": "SE", "indicator": "Stand 3", "locality": "Bicester Town Centre, Bicester", "location": { "type": "Point", "coordinates": [ -1.15359, 51.89824 ] }, "departures": {} }

probot-home-assistant[bot] commented 2 years ago

uk_transport documentation uk_transport source (message by IssueLinks)

geofffarmer commented 2 years ago

Is it the code at line 167 that says:

def _update(self):
    """Get the latest live departure data for the specified stop."""
    params = {"group": "route", "nextbuses": "no"}