Skip to content

Commit c363dfc

Browse files
committed
Now Number includes device_class and unit_of_measurement
1 parent 4913f2e commit c363dfc

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

examples/simple_number.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
class SimpleNumber(OptimisticNumber):
2222
name = "Awesomest Number"
2323
short_id = "moreawesome"
24+
device_class = "data_size"
25+
unit_of_measurement = "MiB"
2426

2527
def callback(self, state: float):
2628
super().callback(state)

src/ham/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.5.5"
1+
__version__ = "0.5.6"
22

33
from .manager import MqttManager
44

src/ham/number.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ class Number(Thing):
99
min: float
1010
max: float
1111
step: float
12+
device_class: str
13+
unit_of_measurement: str
1214

13-
config_fields = ["min", "max", "step"]
15+
config_fields = ["min", "max", "step",
16+
"device_class", "unit_of_measurement"]
1417

1518
_state: float = 1.0
1619

0 commit comments

Comments
 (0)