Skip to content

Commit 35bfce4

Browse files
committed
Refactored DeviceValue into a separate class for each device type.
1 parent c370ea1 commit 35bfce4

File tree

10 files changed

+3784
-3188
lines changed

10 files changed

+3784
-3188
lines changed

inelsmqtt/devices/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from typing import Any, Callable
77

8-
from inelsmqtt.util import DeviceValue
8+
from inelsmqtt.utils.core import DeviceValue
99
from inelsmqtt import InelsMqtt
1010
from inelsmqtt.const import (
1111
DEVICE_TYPE_DICT,
@@ -235,6 +235,7 @@ def last_values(self) -> DeviceValue:
235235
dev_value = DeviceValue(
236236
self.__device_type,
237237
self.__inels_type,
238+
self.__device_class,
238239
inels_value=(val.decode() if val is not None else None),
239240
)
240241
return dev_value
@@ -254,6 +255,7 @@ def __get_value(self, val: Any) -> DeviceValue:
254255
dev_value = DeviceValue(
255256
self.__device_type,
256257
self.__inels_type,
258+
self.__device_class,
257259
inels_value=(val.decode() if val is not None else None),
258260
last_value=self.last_values
259261
)
@@ -284,6 +286,7 @@ def set_ha_value(self, value: Any) -> bool:
284286
dev = DeviceValue(
285287
self.__device_type,
286288
self.__inels_type,
289+
self.__device_class,
287290
ha_value=value,
288291
last_value=self.__state,
289292
)

inelsmqtt/protocols/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)