Skip to content
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

fix: Distance unit fixed #492

Merged
merged 1 commit into from
Feb 4, 2024
Merged

Conversation

Bubo08
Copy link
Collaborator

@Bubo08 Bubo08 commented Feb 2, 2024

Should fix the kia_uvo problem: Not valid unit for device class distance #812

@Bubo08 Bubo08 changed the title Distance unit fixed fix: Distance unit fixed Feb 2, 2024
@cdnninja
Copy link
Collaborator

cdnninja commented Feb 2, 2024

This should match the property approach of the rest of the file with a setter. On my phone so hard to link to an example but I can later.

@cdnninja
Copy link
Collaborator

cdnninja commented Feb 3, 2024

Here is an example of unit being used.

Values being stored here:

_next_service_distance: float = None
_next_service_distance_value: float = None
_next_service_distance_unit: str = None

and setter getter:

@property
def next_service_distance(self):
return self._next_service_distance
@next_service_distance.setter
def next_service_distance(self, value):
self._next_service_distance_value = value[0]
self._next_service_distance_unit = value[1]
self._next_service_distance = value[0]

Plus from the EU API this must be set correctly.

Copy link
Collaborator

@cdnninja cdnninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marking as requested changes per above.

@Bubo08
Copy link
Collaborator Author

Bubo08 commented Feb 4, 2024

I took the following code as template as the odometer is not throwing this kind of error:

@property
def odometer(self):
    return self._odometer

@property
def odometer_unit(self):
    return self._odometer_unit

@odometer.setter
def odometer(self, value):
    float_value = get_float(value[0])
    self._odometer_value = float_value
    self._odometer_unit = value[1]
    self._odometer = float_value

Therefore I thought the unit setter function is missing and I added them. Why do you think this is not correct?

@Bubo08 Bubo08 requested a review from cdnninja February 4, 2024 08:24
@cdnninja
Copy link
Collaborator

cdnninja commented Feb 4, 2024

Oops you are correct. The rest was in before this PR.

@cdnninja cdnninja merged commit b744446 into Hyundai-Kia-Connect:master Feb 4, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants