Skip to content

Commit

Permalink
#134 enable the voltage and current from not supported to supported v…
Browse files Browse the repository at this point in the history
…alue
  • Loading branch information
leeyuentuen committed Apr 26, 2024
1 parent 8fd77b2 commit b4807a2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions custom_components/polestar_api/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ class PolestarSensorDescription(
round_digits=None,
max_value=None,
state_class=SensorStateClass.MEASUREMENT,
device_class=SensorDeviceClass.POWER,
device_class=SensorDeviceClass.CURRENT,
dict_data=None
),
PolestarSensorDescription(
Expand Down Expand Up @@ -564,13 +564,12 @@ def icon(self) -> str | None:
@property
def state(self) -> StateType:
"""Return the state of the sensor."""
if self._attr_native_value is None and self.entity_description.key in ('charging_current', 'charging_power', 'estimated_charging_time_minutes_to_target_distance'):
if self._attr_native_value is None and self.entity_description.key in ('estimated_charging_time_minutes_to_target_distance'):
#self.entity_description.native_unit_of_measurement = None
self._attr_native_unit_of_measurement = None
return "Not Supported Yet"

if self.entity_description.dict_data is not None:
# exception for api_status_code
if self.entity_description.key == 'api_status_code':
return self.entity_description.dict_data.get(self._device.get_latest_call_code_v1(), "Error")
elif self.entity_description.key == 'api_status_code_v2':
Expand Down

0 comments on commit b4807a2

Please sign in to comment.