clevertouch 0.4.2b2__tar.gz → 0.4.2b4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: clevertouch
3
- Version: 0.4.2b2
3
+ Version: 0.4.2b4
4
4
  Summary: A Python API for interacting with LVI/Purmo Touch E3-connected radiators
5
5
  License: MIT
6
6
  Keywords: LVI,home automation,heating
@@ -13,7 +13,7 @@ log_cli_level = "DEBUG"
13
13
 
14
14
  [project]
15
15
  name = "clevertouch"
16
- version = "0.4.2b2"
16
+ version = "0.4.2b4"
17
17
  description = "A Python API for interacting with LVI/Purmo Touch E3-connected radiators"
18
18
  keywords = [
19
19
  "LVI",
@@ -18,3 +18,11 @@ class DeviceTypeId(IntEnum):
18
18
  LIGHT = 1
19
19
  OUTLET = 12
20
20
  UNDEFINED = -1
21
+
22
+ class DeviceTypeChar(StrEnum):
23
+ """Recognized device type ids"""
24
+
25
+ RADIATOR = "C"
26
+ LIGHT = "E"
27
+ OUTLET = "O"
28
+ UNDEFINED = "U"
@@ -15,7 +15,7 @@ class Device:
15
15
  home: HomeInfo,
16
16
  data: dict[str, Any],
17
17
  device_type: str,
18
- device_type_id: int,
18
+ device_type_id: str,
19
19
  *,
20
20
  do_update: bool = True
21
21
  ) -> None:
@@ -23,7 +23,7 @@ class Device:
23
23
  self._session: ApiSession = session
24
24
  self.home: HomeInfo = home
25
25
  self.device_id: str = Device.get_id(data)
26
- self.device_type_id: int = device_type_id
26
+ self.device_type_id: str = device_type_id
27
27
  if do_update:
28
28
  self.update(data)
29
29
 
@@ -5,19 +5,20 @@ from typing import Any
5
5
  from ..api import ApiSession
6
6
  from ..info import HomeInfo
7
7
  from .device import Device
8
- from .const import DeviceType, DeviceTypeId
8
+ from .const import DeviceType, DeviceTypeId, DeviceTypeChar
9
9
  from .onoff import Light, Outlet
10
10
  from .radiator import Radiator
11
11
 
12
12
 
13
13
  def create_device(session: ApiSession, home: HomeInfo, data: dict[str, Any]) -> Device:
14
14
  """Create a device of of specific types based on the provided data."""
15
- device_type_id = int(data["nv_mode"] or DeviceTypeId.UNDEFINED)
16
- if device_type_id == DeviceTypeId.RADIATOR:
15
+ # device_type_id = int(data["nv_mode"] or DeviceTypeId.UNDEFINED)
16
+ device_type_char = str(data.get("id_device", "U")[0])
17
+ if device_type_char == DeviceTypeChar.RADIATOR:
17
18
  return Radiator(session, home, data)
18
- elif device_type_id == DeviceTypeId.LIGHT:
19
+ elif device_type_char == DeviceTypeChar.LIGHT:
19
20
  return Light(session, home, data)
20
- elif device_type_id == DeviceTypeId.OUTLET:
21
+ elif device_type_char == DeviceTypeChar.OUTLET:
21
22
  return Outlet(session, home, data)
22
23
  else:
23
- return Device(session, home, data, DeviceType.UNKNOWN, device_type_id)
24
+ return Device(session, home, data, DeviceType.UNKNOWN, device_type_char)
@@ -37,8 +37,8 @@ class OnOffDevice(Device):
37
37
  query_params = {}
38
38
  query_params["id_device"] = self.id_local
39
39
  query_params["on_off"] = "1" if turn_on else "0"
40
- query_params["nv_mode"] = self.device_type_id
41
- query_params["gv_mode"] = self.device_type_id
40
+ #query_params["nv_mode"] = self.device_type_id
41
+ #query_params["gv_mode"] = self.device_type_id
42
42
 
43
43
  await self._session.write_query(self.home.home_id, query_params)
44
44
 
@@ -45,7 +45,7 @@ class Radiator(Device):
45
45
  _DEVICE_TO_MODE_TYPE: dict[str, _ModeInfo] = {
46
46
  "0": _ModeInfo(HeatMode.COMFORT, TempType.COMFORT),
47
47
  "1": _ModeInfo(HeatMode.OFF, TempType.NONE),
48
- "2": _ModeInfo(HeatMode.COMFORT, TempType.COMFORT),
48
+ "2": _ModeInfo(HeatMode.FROST, TempType.FROST),
49
49
  "3": _ModeInfo(HeatMode.ECO, TempType.ECO),
50
50
  "4": _ModeInfo(HeatMode.BOOST, TempType.BOOST),
51
51
  # "5": ModeInfo("fan", None),
File without changes
File without changes