G-Two / subarulink

A python package for interacting with Subaru STARLINK remote vehicle services.
Apache License 2.0
86 stars 13 forks source link

Add support for automatically reading from XDG_CONFIG_PATH for the config file. #38

Closed dfinlay closed 3 years ago

dfinlay commented 3 years ago

Add support for using the XDG Base Directory Specification, specifica…lly XDG_CONFIG_PATH, in reading and writing the config file.

TODO: Update README to document all the configuration options.

dfinlay commented 3 years ago

@G-Two I can't get it to pass the unit tests, they are getting an SSL error not related to my PR. Any thoughts?

G-Two commented 3 years ago

@dfinlay Thanks for the contribution. I fixed the issue in the tests (SSL private key too small). After you pull or rebase from master, your tests should pass. I also added nightly tests to hopefully catch these kinds of errors sooner.

dfinlay commented 3 years ago

@G-Two Sounds good, I pushed the rebased branch and it looks like it built.

In an unrelated note, I found an interesting bug that I'm going to try to track down. After the initial interactive session that sets up a config, it always gets an exception on the external temperature key not existing in _car_data. It gets it fine on every initial session, but not subsequent ones. Once I figure out the cause I'll open an issue and a PR.

G-Two commented 3 years ago

@dfinlay use of XDG_CONFIG_PATH looks good, thanks.

I'm having trouble replicating the bug. The Subaru "API" is very inconsistent between vehicle models and years, so you may be encountering something that hasn't been seen before. Feel free to post debug logs (please sanitize any personal info) in an issue if you'd like help tracking down the bug. The CLI code is kind of a haphazard demo since my main goal was homeassistant integration. I'd like to know if this bug is specific to the CLI, or if it affects the the subarulink module in general.

dfinlay commented 3 years ago

@G-Two Sounds good, I'll work on reproducing it tonight and capturing the debug logs. I was hoping to patch it up myself, but you'll probably be able to see the causation much better than I will.

I definitely noticed the amount of conditional around the API version and feature levels, what a nightmare they have created :).

No worries about the CLI being a bit rough, I get it was primarily for HA. That's how the project actually. I'll come back with a couple PRs for tweaks to the CLI.