opendata-stuttgart / metaEFA

an easy to use api wrapper for EFA
Other
33 stars 6 forks source link

Delay always 0 #19

Closed p4sI closed 5 years ago

p4sI commented 5 years ago

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.

crushedcoldice commented 5 years ago

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.

endoriel21 commented 5 years ago

I think the problem is, that the _parseefa(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.

toerb commented 5 years ago

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

asmaps commented 5 years ago

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