tofuSCHNITZEL / home-assistant-wienerlinien

A sensor that give you information about departures from a specified Wiener Linien stop.
MIT License
26 stars 8 forks source link

Sensors not showing up #16

Open Friday13th87 opened 1 year ago

Friday13th87 commented 1 year ago

If i add more then 4-6 Sensors to the configuration file, the sensors wont show up and partially disappear after restarting HA. I am using HA in docker and the Beta 1.3.0 version of this integration.

here is my configuration as an example

sensor:
  - platform: wienerlinien
    firstnext: first
    stops:
      - "852"
      - "724"
      - "901"
      - "4926"
      - "4118"
      - "4416"
      - "1448"
      - "1474"
      - "4109"
      - "4906"
      - "4411"
      - "4925"
      - "4920"
      - "4921"
      - "4619"
      - "4610"
      - "1449"
      - "1473"
      - "1449"
      - "2618"
      - "4426"
      - "4409"
  - platform: wienerlinien
    firstnext: next
    stops:
      - "852"
      - "724"
      - "901"
      - "4926"
      - "4118"
      - "4416"
      - "1448"
      - "1474"
      - "4109"
      - "4906"
      - "4411"
      - "4925"
      - "4920"
      - "4921"
      - "4619"
      - "4610"
      - "1449"
      - "1473"
      - "1449"
      - "2618"
      - "4426"
      - "4409"
      - "1462"
      - "1461"

log 2023-09-09 14:08:47.456 WARNING (MainThread) [custom_components.wienerlinien.sensor] Skipping already existing monitor This is the only thing popping up in the logges repeatedly

It seems, that the problem is starting after adding more then 12 sensors (2 times 6 for "next" and "first").

Is there anything i am doing wrong, or is there a way to get this running with like 20-30 stops?

thanks in advance

EDIT: It seems to be an API Limit problem. if i am checking my IDs on the official page https://www.wienerlinien.at/ogd_realtime/monitor?stopid=724

And do it for a lot of lines, i am getting after a while "Abfrage Limit erreicht"

but it is working again after several seconds. So it would be best to have a sleep of 5-10 seconds between each API call to avoid this behavior.

And maybe it would be possible to get the times for the first, next and so on in 1 API call. The Times for the next upcoming 7 stops are delivered in 1 API call (key 0 till 6)

But as far as i can see i cant get both timings for first and next in one call, so i need to add 2 sensors for first and next, right?

LuckyMooon commented 1 year ago

I have the same problem, except that nothing is displayed for me, no matter how many stations I add.

Does anyone have an idea for a solution?

tofuSCHNITZEL commented 1 year ago

The whole thing is bad need of a rework. Though if you really are hitting the request limit then I don't think there is a real way to solve it. although there would be a way to get an API key - there seems to be no way currently to provide these credentials to the current api endpoint and perhaps not be (so) limited. Unfortunately there is no documentation at all provided by Wiener Linien.

LuckyMooon commented 1 year ago

Is a rework planned in the near future?

tofuSCHNITZEL commented 1 year ago

Yea sure... Soon(TM) ;) but I would also need some help because I would like to to it "correct" but some of the home assistant doku is beyond my understanding

LuckyMooon commented 1 year ago

I don't really know much about creating integrations myself, but if I can help in any way, I'm happy to do so.

DerBauherr commented 3 months ago

The whole thing is bad need of a rework. Though if you really are hitting the request limit then I don't think there is a real way to solve it. although there would be a way to get an API key - there seems to be no way currently to provide these credentials to the current api endpoint and perhaps not be (so) limited. Unfortunately there is no documentation at all provided by Wiener Linien.

Documentation from Wiener Linien for this API can be found here: https://www.wienerlinien.at/ogd_realtime/doku/ogd/wienerlinien-echtzeitdaten-dokumentation.pdf