opendata-stuttgart / metaEFA

an easy to use api wrapper for EFA

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Delay always 0

p4sI opened this issue · comments

Hi,
it seems like the delay in the departures response is always 0.
This would of course be cool if it's true, but unfortunately it's not.

Hi p4sl, i thing the zero is due to legal issues. I found the following solution: I took a deeper look at the VVS page and found the following:
https://www.vvs.de/no_cache/service/auskuenfte-fuer-website-desktop/?tx_vvsefaonhp_pi1%5Btype%5D=abfahrtstafel&tx_vvsefaonhp_pi1%5Bhtmlcode%5D=abfahrtstafel

I filled in the information for my station, and inspected the POST call with the chrome debugging feature. There i found the following request (suiteiable for my application):
http://www2.vvs.de/vvsDM/XSLT_DM_REQUEST?dmMacro=mini&name_dm=5006001&limit=10&line=vvs%3A10001%3A+%3AR%3Aj18&line=vvs%3A10002%3A+%3AR%3Aj18&line=vvs%3A10003%3A+%3AR%3Aj18&itdLPxx_depOnly=1&language=de

It results in an easy to parse html page, that i was able to use in my esp8266 project:

https://instagram.com/p/BqR51gchClF/

If you have any further questions don't hesitate to contact me.

I think the problem is, that the parse_efa(efa) search in the Json for "delay" in "servingLine", which is no longer there.
(I've checked some stations with trains with a few minutes delay, for example http://www2.vvs.de/vvs/widget/XML_DM_REQUEST?zocationServerActive=1&lsShowTrainsExplicit1&stateless=1&language=de&SpEncId=0&anySigWhenPerfectNoOtherMatches=1&limit=50&depArr=departure&type_dm=any&anyObjFilter_dm=2&deleteAssignedStops=1&name_dm=5006261&mode=direct&dmLineSelectionAll=1&useRealtime=1&outputFormat=json&coordOutputFormat=WGS84[DD.ddddd] and i couldn't find any "delay" in there)
But I think it should be possible to compare "realDateTime" with "DateTime" to get and calc the delay, if they are not the same.

commented

@asmaps
This issue should be solved with my merged PR.

I get delays other than 0 now, so should be fine. Thx for the PR