-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new nextbus sensor #20197
Add new nextbus sensor #20197
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Just removed dependency on upstream patch and added documentation. |
So the Travis build is confusing me. It seems that
However this appears to conform to pep8 just fine. It also seems that It is asking for the internal values to be double indented as so:
It allows a 4 space hanging indent in other places, but it seems to be asking for 8 spaces when there is a function continuation within an It looks like it may just be a bug in |
6c9971a
to
7485eef
Compare
Just added tests. Haven't figured out how to successfully mock instance methods on an object within a dependency module... So that test is skipped. Also, because I couldn't figure this out, I had to move the imports into some module level functions so that they could be mocked out entirely without having to mock the client itself. I am not a fan of the way I've got it working right now. I'd prefer if I didn't have to update the actual module to support tests and wish I could keep it looking more like it did in this diff |
Removed module from the omit section of Also, it doesn't look like I can use pytest parameterized tests with |
Odd that tests ran fine on my branch. I just ran tests after merging dev into this and it seems to pass. Anything more that I need to do here? I see a few labels that are out of date now. |
Please rebase on latest dev branch, to solve the merge conflict. |
Wow. Looks like things have changed quite a bit since I last submitted a patch. I'll try to update using the new conventions and add a manifest file. |
69a4710
to
33836b9
Compare
Ok. Think I finally got through all the checks. For some reason some
Which prevented me from finding the requirements ordering issue. I believe that's because |
Woo! Finally all green! :) Let me know if there's anything you'd like me to update. |
Please don't squash commits after review has started. Sqaushing commits makes it harder for readers to track changes. |
Sure. Good feedback. I originally did it because I had to rebase ~25 commits onto dev and haven't mastered |
It would have been ok to squash everything until before my last review, but keep the last changes as separate commits. Then I could have just looked at those. Now I have to look over everything again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good! Can be merged when last comment is addressed and build passes.
Thanks! Just when I thought I was done, found another edge case with this API. Really feeling the burn of an untyped and not well documented API. Just found out that like the Adding more tests to cover this permutation. |
Ok. Made my changes and working on an update. I'm struggling a bit with the actual interface now. It doesn't look very friendly at all as it just renders the ISO timestamp rather than the actual wait times. I'm not sure what's missing as I followed the example you linked to. How can I make it show the relative time until the bus/train leaves? Setting |
Use lovelace. Eg with the system monitor sensor and yaml lovelace config: type: entities
entities:
- entity: sensor.last_boot
format: relative
show_header_toggle: false https://www.home-assistant.io/lovelace/entities/#format It will default to relative so you don't need to go into yaml mode if relative is fine. |
It doesn't seem to have defaulted to relative for me on a brand new install. It's showing a long ISO string that overflows so all I can see is the year. Is there documentation on how to use timestamp sensors for users? When I look at the the docs for the |
We should keep the timestamp device class and state formatting. Currently you have to be in managed lovelace mode to be able to add the correct card type. This could possible be enhanced in the frontend. |
Can be merged when build passes. |
Description:
New platform sensor to display upcoming transit arrivals using NextBus.
This is my first contribution to hass, so I'm submitting for some early feedback while there is still a little work to be done. I need to write tests, documentation, (no longer waiting for patch to be merged into py_nextbus to fix an issue with the client, instead we're working around it.)
The other thing I'm considering is allowing to add the platform once, but then provide a list of routes, stops, and names so that the platform can make a single request to update all sensors at once. I'm not sure what is the typical convention here though and chose to implement the simplest thing first. Looking for feedback on design.
Pull request in home-assistant.io with documentation (if applicable): home-assistant/home-assistant.io#8661
Example entry for
configuration.yaml
(if applicable):Checklist:
tox
. Your PR cannot be merged unless tests passIf user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
REQUIREMENTS
variable (example).requirements_all.txt
by runningscript/gen_requirements_all.py
..coveragerc
.If the code does not interact with devices: