Skip to content

Commit

Permalink
Fix device class for sensor estimated_fully_charged_time
Browse files Browse the repository at this point in the history
  • Loading branch information
jschlyter committed Feb 5, 2025
1 parent b8a4934 commit 79b29b6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
2 changes: 1 addition & 1 deletion custom_components/polestar_api/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
"gql[httpx]>=3.5.0",
"homeassistant>=2024.6.0"
],
"version": "1.14.0"
"version": "1.14.1"
}
7 changes: 1 addition & 6 deletions custom_components/polestar_api/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from dataclasses import dataclass
from typing import TYPE_CHECKING, Final

import homeassistant.util.dt as dt_util
from homeassistant.components.sensor import (
SensorDeviceClass,
SensorEntity,
Expand Down Expand Up @@ -259,13 +258,9 @@ class PolestarSensorDescription(SensorEntityDescription, PolestarEntityDescripti
key="estimated_fully_charged_time",
icon="mdi:battery-clock",
native_unit_of_measurement=None,
state_class=SensorStateClass.MEASUREMENT,
device_class=SensorDeviceClass.DURATION,
device_class=SensorDeviceClass.TIMESTAMP,
data_source=PolestarEntityDataSource.BATTERY,
data_state_attribute="estimated_fully_charged",
data_state_fn=lambda value: dt_util.as_local(value).strftime(
"%Y-%m-%d %H:%M:%S"
),
),
PolestarSensorDescription(
key="last_updated_battery_data",
Expand Down

0 comments on commit 79b29b6

Please sign in to comment.