Skip to content

Commit

Permalink
feat: refactor to use sensor-state-data 2 (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Jul 21, 2022
1 parent 8f86754 commit 53afe59
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
8 changes: 4 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Sphinx = {version = "^5.0", optional = true}
sphinx-rtd-theme = {version = "^1.0", optional = true}
myst-parser = {version = "^0.18", optional = true}
home-assistant-bluetooth = ">=1.3.0"
sensor-state-data = ">=1.11.1"
sensor-state-data = ">=2.0"

[tool.poetry.extras]
docs = [
Expand Down
5 changes: 2 additions & 3 deletions src/bluetooth_sensor_state_data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
from abc import abstractmethod

from home_assistant_bluetooth import BluetoothServiceInfo
from sensor_state_data import DeviceClass, SensorData, SensorUpdate
from sensor_state_data.units import SIGNAL_STRENGTH_DECIBELS_MILLIWATT
from sensor_state_data import DeviceClass, SensorData, SensorUpdate, Units

SIGNAL_STRENGTH_KEY = DeviceClass.SIGNAL_STRENGTH.value

Expand Down Expand Up @@ -36,7 +35,7 @@ def update_signal_strength(self, native_value: int | float) -> None:
for device_id in self._device_id_to_type:
self.update_sensor(
key=DeviceClass.SIGNAL_STRENGTH.value,
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
native_unit_of_measurement=Units.SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
native_value=native_value,
device_class=DeviceClass.SIGNAL_STRENGTH,
device_id=device_id,
Expand Down

0 comments on commit 53afe59

Please sign in to comment.