Platform for Munich public transport departure times#6704
Conversation
|
@DavidMStraub, thanks for your PR! By analyzing the history of the files in this pull request, we identified @balloob, @fabaff and @rmkraus to be potential reviewers. |
|
Nothing is too local 👍 |
There was a problem hiding this comment.
Make sure to open an issue for this on their repo so we can migrate to use the PyPi version in the future.
There was a problem hiding this comment.
Done, just replaced it with the PyPI version
balloob
left a comment
There was a problem hiding this comment.
Few changes, code looks good 👍
There was a problem hiding this comment.
Please don't call update here but instead pass True as a second parameter to add_devices
There was a problem hiding this comment.
It's usually not a good idea to mutate data that you fetch from a library. They might store a reference in a cache that is now no longer what they expect it to be. Create new dictionaries instead.
There was a problem hiding this comment.
Thanks for the hints! I think I fixed everything.
There was a problem hiding this comment.
continuation line over-indented for visual indent
There was a problem hiding this comment.
continuation line over-indented for visual indent
There was a problem hiding this comment.
continuation line over-indented for visual indent
There was a problem hiding this comment.
This code is unmaintainable. Please make it a for loop.
There was a problem hiding this comment.
Right. Refactored and simplified.
There was a problem hiding this comment.
This case can never happen because you always have an empty dictionary in your list, meaning it will always test truthy. (only an empty list is False)
There was a problem hiding this comment.
Right. Refactored the code now - in fact, no need for the list as we're only interested in the 1st item.
| continue | ||
| # now select the relevant data | ||
| _nextdep = {} | ||
| for k in ['destination', 'linename', 'time', 'direction', 'product']: |
There was a problem hiding this comment.
line too long (81 > 79 characters)
I'm not sure if this is too local to become an official component but for me it's very useful so I thought I'd share it anyway.
Description:
The MVG live service (http://www.mvg-live.de) provides real-time departure information for the Munich public transort system (bus, tram, subway, suburban rail). This platform provides a sensor for the time to the next departure (optionally the next departure after an offset, e.g. the time it takes you to walk to the bus stop) at a stop or station. The destination and line number are given in the attributes. Optionally, specific lines or destinations can be selected.
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#2311
Example entry for
configuration.yaml(if applicable):Checklist:
toxrun successfully. Your PR cannot be merged unless tests passREQUIREMENTSvariable (example).requirements_all.txtby runningscript/gen_requirements_all.py..coveragerc.