-
-
Notifications
You must be signed in to change notification settings - Fork 29.1k
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
Refactor NextBus integration to use new API #121133
base: dev
Are you sure you want to change the base?
Conversation
The failed test was a flake, not related to my changes. |
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.
Can you please elaborate on these 2 things:
- Adds back support for removed agencies
- This removes the messages, directions, and attribution attributes from the sensor. Those may be added back in the future with additional refactoring
So we removed agencies and will bring them back again, and we now remove attributes to introduce them again on a later moment in time?
We should not do that. We should keep the user experience consistent and not make the user update their config every once in a while for no reason.
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
I've updated the description to elaborate on those points, but in summary: The old, public API appears to be phasing out. Many agencies are now missing. Instead, a new, undocumented API is being used by the website for fetching predictions. This means that many existing users are now unable to get predictions via the old client. The old API provided additional information along with predictions, such as directions, messages, and attribution. These are not present via the new API. Both messages and full names of directions associated would be possible with additional API calls, however those don't seem appropriate to add to this sensor as attributes for several reasons:
|
This removes the `messages`, `directions`, and `attribution` attributes from the sensor. Those may be added back in the future with additional refactoring. Some existing sensors may be broken today because of deprecated Agency names. This patch will not migrate them as the migration path is ambiguous. Setting up again should work though.
17235af
to
df66ee2
Compare
Since you're doing a rewrite, consider using aiohttp to make the library async and nice |
Adds back support for agencies no longer in the old API by updating py-nextbusnext ViViDboarder/py_nextbusnext@v1.0.2...v2.0.3 which is using a new, undocumented API.
Breaking change
This removes the
messages
,directions
, andattribution
attributes from the sensor. The new API doesn't provide these in the request response.messages
now has it's own API and could be added as it's own sensor, but that would be another patch.Some existing sensors may be broken today because of deprecated Agency names. This patch will not migrate them as the migration path is ambiguous. Setting up again should work though.
Proposed change
Upgrade
py-nextbusnext
to v2.0.3 to utilize new API.Type of change
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.To help with the load of incoming pull requests: