Skip to content

Commit

Permalink
fix: usa low/high temp values (Hyundai-Kia-Connect#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlb authored Nov 18, 2021
1 parent ae05edb commit 0639d77
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,4 @@ logger:
logs:
custom_components.kia_uvo: debug
```

22 changes: 12 additions & 10 deletions custom_components/kia_uvo/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,16 +261,18 @@ def state(self):

value = self.vehicle.get_child_value(self._key)

if (
self._id == "temperatureSetpoint"
and REGIONS[self.vehicle.kia_uvo_api.region] != REGION_USA
):
value = value.replace("H", "")
value = value.replace("C", "")
value = "0x" + value
return self.vehicle.kia_uvo_api.get_temperature_range_by_region()[
int(value, 16)
]
if self._unit == DYNAMIC_TEMP_UNIT:
temp_range = self.vehicle.kia_uvo_api.get_temperature_range_by_region()
if REGIONS[self.vehicle.kia_uvo_api.region] == REGION_USA:
if value == "0xLOW":
return temp_range[0]
if value == "0xHIGH":
return temp_range[-1]
else:
value = value.replace("H", "")
value = value.replace("C", "")
value = "0x" + value
return temp_range[int(value, 16)]

if value is None:
value = NOT_APPLICABLE
Expand Down

0 comments on commit 0639d77

Please sign in to comment.