ha_realtime_trains_api icon indicating copy to clipboard operation
ha_realtime_trains_api copied to clipboard

sensor.next_train_from_xxx_to_xxx fails

Open jone9618 opened this issue 2 years ago • 0 comments

Hello

I have been using this integration for past 6 months. Much better than the official integration (especially given the problems caused by the owners of the data source). Thank you for putting this together.

I occasionally get bursts of errors in my logs. I had it in my mind that this was something to do with the strikes impacting on train movements, but I wondered whether there was something else going on. As you can see from below the number of occurrences are pretty high, so my logs are peppered with them (although oddly no occurrence in past few days).

Here is the log summary:

Logger: homeassistant.helpers.entity Source: custom_components/realtime_trains_api/sensor.py:176 Integration: realtime_trains_api (documentation) First occurred: 5 February 2023 at 17:20:19 (1006 occurrences) Last logged: 9 February 2023 at 23:13:20

Update for sensor.next_train_from_hhl_to_cdf fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 548, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 746, in async_device_update raise exc File "/config/custom_components/realtime_trains_api/sensor.py", line 176, in _async_update estimated = _to_colonseparatedtime(departure["locationDetail"]["realtimeDeparture"]) KeyError: 'realtimeDeparture'

My config is:

  - platform: realtime_trains_api
    username: 'xxxxxxxxxxx'
    password: 'xxxxxxxxxxxx'
    scan_interval:
      seconds: 90
    auto_adjust_scans: true 
    queries:
      - origin: HHL
        destination: CDF
        journey_data_for_next_X_trains: 5 
      - origin: HLL
        destination: CDF
        journey_data_for_next_X_trains: 3

Grateful for any thoughts on whether this is a genuine error or a configuration issue.

Thanks

Simon

jone9618 avatar Feb 11 '23 09:02 jone9618