Skip to content

Commit

Permalink
Now Number includes device_class and unit_of_measurement
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbarcelo committed Jul 3, 2023
1 parent 4913f2e commit c363dfc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions examples/simple_number.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
class SimpleNumber(OptimisticNumber):
name = "Awesomest Number"
short_id = "moreawesome"
device_class = "data_size"
unit_of_measurement = "MiB"

def callback(self, state: float):
super().callback(state)
Expand Down
2 changes: 1 addition & 1 deletion src/ham/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.5.5"
__version__ = "0.5.6"

from .manager import MqttManager

Expand Down
5 changes: 4 additions & 1 deletion src/ham/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ class Number(Thing):
min: float
max: float
step: float
device_class: str
unit_of_measurement: str

config_fields = ["min", "max", "step"]
config_fields = ["min", "max", "step",
"device_class", "unit_of_measurement"]

_state: float = 1.0

Expand Down

0 comments on commit c363dfc

Please sign in to comment.