zacs / ha-nfl

NFL game scores custom component for Home Assistant
42 stars 32 forks source link

Support for additional sports leagues? #20

Closed vasqued2 closed 2 years ago

vasqued2 commented 2 years ago

You probably already considered this but I figured it doesn't hurt to ask.

Over the past year or so, I've created a bunch of one-off variations to support several of the different ESPN scoreboard APIs. To simplify the maintenance, I finally combined them all together into a single sensor that should be reasonably easy to maintain. I wanted to see if there was any interest in pulling the changes into this repository.

The changes basically allow a league (i.e. NFL, MLB, MLS, etc.) to be specified when a sensor is configured and changes the API based on it, adds several try/excepts to the retrieval of some values from the JSON string that don't exist for some of the new sports (i.e. timeouts, odds, etc.), and adds some new values to the sensor for some new sports (i.e. balls, strikes, outs, etc.).

The big caveat. I don't have a ton of experience w/ python, creating custom components, or git so I have no idea if my coding style is aligned to expectations or is a mess or what's needed to merge the code even if you wanted to. Feel free to take a look at my fork and see if there is any interest in pulling it in or not If not, no offense taken and I will just continue to pull in your updates as they come in.

Thanks

zacs commented 2 years ago

Thank you for the work! I love the new functionality, but my guess is that a component per-sport will keep things simpler. The amount of try/catch blocking that is sport-dependent seems worth keeping them separate, though I think there's still tons of value in keeping them as forks to share any common updates.

vasqued2 commented 2 years ago

Makes sense. I will definitely pull in your updates as they come. Thanks for all the great work!