Skip to content

Commit

Permalink
Merge pull request #7 from RobertD502/deprecated_constants_fix
Browse files Browse the repository at this point in the history
Deprecated constants fix
  • Loading branch information
RobertD502 authored Dec 27, 2023
2 parents d47e3ba + c402200 commit 57af722
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion custom_components/purrsong/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/RobertD502/home-assistant-lavviebot/issues",
"requirements": ["lavviebotaio==0.2.0"],
"version": "0.1.11"
"version": "0.1.12"
}
15 changes: 7 additions & 8 deletions custom_components/purrsong/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import(
PERCENTAGE,
TIME_MINUTES,
TIME_SECONDS,
UnitOfMass,
UnitOfTemperature,
UnitOfTime,
)

from homeassistant.core import HomeAssistant
Expand Down Expand Up @@ -206,10 +205,10 @@ def native_value(self) -> float | int:
return round(self.cat_data.duration, 1)

@property
def native_unit_of_measurement(self) -> str:
def native_unit_of_measurement(self) -> UnitOfTime:
""" Return seconds as the native unit """

return TIME_SECONDS
return UnitOfTime.SECONDS

@property
def icon(self) -> str:
Expand Down Expand Up @@ -722,10 +721,10 @@ def native_value(self) -> float:
return round(self.device_data.last_used_duration, 1)

@property
def native_unit_of_measurement(self) -> str:
def native_unit_of_measurement(self) -> UnitOfTime:
""" Return seconds as the native unit """

return TIME_SECONDS
return UnitOfTime.SECONDS

@property
def state_class(self) -> SensorStateClass:
Expand Down Expand Up @@ -1050,10 +1049,10 @@ def native_value(self) -> int:
return self.device_data.wait_time

@property
def native_unit_of_measurement(self) -> str:
def native_unit_of_measurement(self) -> UnitOfTime:
""" Return minutes as the native unit """

return TIME_MINUTES
return UnitOfTime.MINUTES

@property
def entity_category(self) -> EntityCategory:
Expand Down
2 changes: 1 addition & 1 deletion hacs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Lavviebot S",
"render_readme": true,
"country": "US",
"homeassistant": "2022.11.0b0",
"homeassistant": "2023.12.0",
"zip_release": true,
"filename": "purrsong.zip"
}

0 comments on commit 57af722

Please sign in to comment.