megakid / ha_realtime_trains_api

rtt.io Home Assistant integration
Apache License 2.0
17 stars 9 forks source link

Invalid response from API #14

Closed timdonovanuk closed 1 year ago

timdonovanuk commented 1 year ago

Hi,

My HA logs are showing Invalid response from API. I've tried adding additional debug but not much is output:

logger:
  default: info
  logs:
    custom_components.realtime_trains_api.sensor: debug

I get the following:

WARNING (MainThread) [custom_components.realtime_trains_api.sensor] Invalid response from API

I am using the following config:

sensor:
  - platform: realtime_trains_api
    username: !secret realtime_trains_api_username
    password: !secret realtime_trains_api_password
    scan_interval:
      seconds: 90 # this defaults to 60 seconds (in HA) so you can change this.  Dont set it too frequent or you might get blocked for abuse of the RTT API.
    auto_adjust_scans: true # If no depatures are retrieved, back off polling interval to 30 mins (until there are some trains)
    queries:
      - origin: PRP
        destination: ZFD
        journey_data_for_next_X_trains: 5 

These are valid station codes and there are depatures:

image

timdonovanuk commented 1 year ago

Ah my bad. It's not very clear in the documentation that you don't use your rtt login, but a seperate api username/password that is available after creating an account. Maybe just change "Signup to https://api.rtt.io/" to "Signup to https://api.rtt.io/ and retrieve your API Auth Credentials". Thanks!