pyControl4 1.2.0__py3-none-any.whl → 1.3.0__py3-none-any.whl

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.
pyControl4/alarm.py CHANGED
@@ -1,5 +1,4 @@
1
- """Controls Control4 security panel and contact sensor (door, window, motion) devices.
2
- """
1
+ """Controls Control4 security panel and contact sensor (door, window, motion) devices."""
3
2
 
4
3
  import json
5
4
  from pyControl4 import C4Entity
pyControl4/blind.py CHANGED
@@ -1,5 +1,4 @@
1
- """Controls Control4 blind devices.
2
- """
1
+ """Controls Control4 blind devices."""
3
2
 
4
3
  from pyControl4 import C4Entity
5
4
 
pyControl4/climate.py ADDED
@@ -0,0 +1,109 @@
1
+ """Controls Control4 Climate Control devices."""
2
+
3
+ from pyControl4 import C4Entity
4
+
5
+
6
+ class C4Climate(C4Entity):
7
+ # ------------------------
8
+ # HVAC and Fan States
9
+ # ------------------------
10
+
11
+ async def getHVACState(self):
12
+ """Returns the current HVAC state (e.g., on/off or active mode)."""
13
+ return await self.director.getItemVariableValue(self.item_id, "HVAC_STATE")
14
+
15
+ async def getFANState(self):
16
+ """Returns the current power state of the fan (True=on, False=off)."""
17
+ return await self.director.getItemVariableValue(self.item_id, "FAN_STATE")
18
+
19
+ # ------------------------
20
+ # Mode Getters
21
+ # ------------------------
22
+
23
+ async def getHVACMode(self):
24
+ """Returns the currently active HVAC mode."""
25
+ return await self.director.getItemVariableValue(self.item_id, "HVAC_MODE")
26
+
27
+ async def getHVACModes(self):
28
+ """Returns a list of supported HVAC modes."""
29
+ return await self.director.getItemVariableValue(self.item_id, "HVAC_MODES_LIST")
30
+
31
+ async def getFANMode(self):
32
+ """Returns the currently active fan mode."""
33
+ return await self.director.getItemVariableValue(self.item_id, "FAN_MODE")
34
+
35
+ async def getFANModes(self):
36
+ """Returns a list of supported fan modes."""
37
+ return await self.director.getItemVariableValue(self.item_id, "FAN_MODES_LIST")
38
+
39
+ # ------------------------
40
+ # Setpoint Getters
41
+ # ------------------------
42
+
43
+ async def getCoolSetpointF(self):
44
+ """Returns the cooling setpoint temperature in Fahrenheit."""
45
+ return await self.director.getItemVariableValue(self.item_id, "COOL_SETPOINT_F")
46
+
47
+ async def getHeatSetpointF(self):
48
+ """Returns the heating setpoint temperature in Fahrenheit."""
49
+ return await self.director.getItemVariableValue(self.item_id, "HEAT_SETPOINT_F")
50
+
51
+ # ------------------------
52
+ # Sensor Readings
53
+ # ------------------------
54
+
55
+ async def getHumidity(self):
56
+ """Returns the current humidity percentage."""
57
+ return await self.director.getItemVariableValue(self.item_id, "HUMIDITY")
58
+
59
+ async def getCurrentTemperature(self):
60
+ """Returns the current ambient temperature in Fahrenheit."""
61
+ return await self.director.getItemVariableValue(self.item_id, "TEMPERATURE_F")
62
+
63
+ # ------------------------
64
+ # Setters / Commands
65
+ # ------------------------
66
+
67
+ async def setTemperature(self, temp):
68
+ """Sets the cooling setpoint temperature in Fahrenheit."""
69
+ await self.setCoolSetpoint(temp) # Delegates to the proper method
70
+
71
+ async def setCoolSetpoint(self, temp):
72
+ """Sets the cooling setpoint temperature in Fahrenheit."""
73
+ await self.director.sendPostRequest(
74
+ f"/api/v1/items/{self.item_id}/commands",
75
+ "SET_SETPOINT_COOL",
76
+ {"FAHRENHEIT": temp},
77
+ )
78
+
79
+ async def setHeatSetpoint(self, temp):
80
+ """Sets the heating setpoint temperature in Fahrenheit."""
81
+ await self.director.sendPostRequest(
82
+ f"/api/v1/items/{self.item_id}/commands",
83
+ "SET_SETPOINT_HEAT",
84
+ {"FAHRENHEIT": temp},
85
+ )
86
+
87
+ async def setHvacMode(self, mode):
88
+ """Sets the HVAC operating mode (e.g., heat, cool, auto)."""
89
+ await self.director.sendPostRequest(
90
+ f"/api/v1/items/{self.item_id}/commands",
91
+ "SET_MODE_HVAC",
92
+ {"MODE": mode},
93
+ )
94
+
95
+ async def setFanMode(self, mode):
96
+ """Sets the fan operating mode (e.g., auto, on, circulate)."""
97
+ await self.director.sendPostRequest(
98
+ f"/api/v1/items/{self.item_id}/commands",
99
+ "SET_MODE_FAN",
100
+ {"MODE": mode},
101
+ )
102
+
103
+ async def setPreset(self, preset):
104
+ """Applies a predefined climate preset by name."""
105
+ await self.director.sendPostRequest(
106
+ f"/api/v1/items/{self.item_id}/commands",
107
+ "SET_PRESET",
108
+ {"NAME": preset},
109
+ )
pyControl4/director.py CHANGED
@@ -1,5 +1,5 @@
1
1
  """Handles communication with a Control4 Director, and provides functions for
2
- getting details about items on the Director.
2
+ getting details about items on the Director.
3
3
  """
4
4
 
5
5
  import aiohttp
@@ -134,7 +134,7 @@ class C4Director:
134
134
  `item_id` - The Control4 item ID.
135
135
  """
136
136
  return await self.sendPostRequest(
137
- "/api/v1/items/{}/commands".format(item_id), "GET_SETUP", "{}", False
137
+ "/api/v1/items/{}/commands".format(item_id), "GET_SETUP", {}, False
138
138
  )
139
139
 
140
140
  async def getItemVariables(self, item_id):
pyControl4/fan.py ADDED
@@ -0,0 +1,81 @@
1
+ """Controls Control4 Fan devices."""
2
+
3
+ from pyControl4 import C4Entity
4
+
5
+
6
+ class C4Fan(C4Entity):
7
+ # ------------------------
8
+ # Fan State Getters
9
+ # ------------------------
10
+
11
+ async def getState(self):
12
+ """
13
+ Returns the current power state of the fan.
14
+
15
+ Returns:
16
+ bool: True if the fan is on, False otherwise.
17
+ """
18
+ value = await self.director.getItemVariableValue(self.item_id, "IS_ON")
19
+ return bool(value)
20
+
21
+ async def getSpeed(self):
22
+ """
23
+ Returns the current speed of the fan controller.
24
+
25
+ Valid speed values:
26
+ 0 - Off
27
+ 1 - Low
28
+ 2 - Medium
29
+ 3 - Medium High
30
+ 4 - High
31
+
32
+ Note:
33
+ Only valid for fan controllers. On non-dimmer switches,
34
+ use `getState()` instead.
35
+
36
+ Returns:
37
+ int: Current fan speed (0–4).
38
+ """
39
+ value = await self.director.getItemVariableValue(self.item_id, "CURRENT_SPEED")
40
+ return int(value)
41
+
42
+ # ------------------------
43
+ # Fan Control Setters
44
+ # ------------------------
45
+
46
+ async def setSpeed(self, speed: int):
47
+ """
48
+ Sets the fan speed or turns it off.
49
+
50
+ Parameters:
51
+ speed (int): Fan speed level:
52
+ 0 - Off
53
+ 1 - Low
54
+ 2 - Medium
55
+ 3 - Medium High
56
+ 4 - High
57
+ """
58
+ await self.director.sendPostRequest(
59
+ f"/api/v1/items/{self.item_id}/commands",
60
+ "SET_SPEED",
61
+ {"SPEED": speed},
62
+ )
63
+
64
+ async def setPreset(self, preset: int):
65
+ """
66
+ Sets the fan's preset speed — the speed used when the fan is
67
+ turned on without specifying speed.
68
+
69
+ Parameters:
70
+ preset (int): Preset fan speed level:
71
+ 0 - Off
72
+ 1 - Low
73
+ 2 - Medium
74
+ 3 - Medium High
75
+ 4 - High
76
+ """
77
+ await self.director.sendPostRequest(
78
+ f"/api/v1/items/{self.item_id}/commands",
79
+ "DESIGNATE_PRESET",
80
+ {"PRESET": preset},
81
+ )
pyControl4/light.py CHANGED
@@ -1,5 +1,4 @@
1
- """Controls Control4 Light devices.
2
- """
1
+ """Controls Control4 Light devices."""
3
2
 
4
3
  from pyControl4 import C4Entity
5
4
 
pyControl4/relay.py CHANGED
@@ -1,5 +1,4 @@
1
- """Controls Control4 Relay devices. These can include locks, and potentially other types of devices.
2
- """
1
+ """Controls Control4 Relay devices. These can include locks, and potentially other types of devices."""
3
2
 
4
3
  from pyControl4 import C4Entity
5
4
 
pyControl4/room.py CHANGED
@@ -1,5 +1,4 @@
1
- """Controls Control4 Room devices.
2
- """
1
+ """Controls Control4 Room devices."""
3
2
 
4
3
  from pyControl4 import C4Entity
5
4
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: pyControl4
3
- Version: 1.2.0
3
+ Version: 1.3.0
4
4
  Summary: Python 3 asyncio package for interacting with Control4 systems
5
5
  Home-page: https://github.com/lawtancool/pyControl4
6
6
  Author: lawtancool
@@ -15,6 +15,16 @@ Requires-Dist: aiohttp
15
15
  Requires-Dist: xmltodict
16
16
  Requires-Dist: python-socketio-v4
17
17
  Requires-Dist: websocket-client
18
+ Dynamic: author
19
+ Dynamic: author-email
20
+ Dynamic: classifier
21
+ Dynamic: description
22
+ Dynamic: description-content-type
23
+ Dynamic: home-page
24
+ Dynamic: license-file
25
+ Dynamic: requires-dist
26
+ Dynamic: requires-python
27
+ Dynamic: summary
18
28
 
19
29
  # pyControl4
20
30
  [![PyPI version](https://badge.fury.io/py/pyControl4.svg)](https://badge.fury.io/py/pyControl4)[![Downloads](https://pepy.tech/badge/pycontrol4)](https://pepy.tech/project/pycontrol4)
@@ -0,0 +1,17 @@
1
+ pyControl4/__init__.py,sha256=JR6zFcZJ-M1o8g28gdU71uZHYzh-b21x7rg3EWrf3hg,394
2
+ pyControl4/account.py,sha256=eyWkGaDla4_gLvv8GHBxmJ2iBMxpdY7ax53JryWOtcE,9760
3
+ pyControl4/alarm.py,sha256=KcZreUOocncgoIoRVHl9ZL1zesrXuVYPfXVvDuUpXcs,7153
4
+ pyControl4/blind.py,sha256=7Aat1FyT-OJyv_xES-ol2U-70nKpQbymGUfTTsB3VDk,4436
5
+ pyControl4/climate.py,sha256=QsTJbp5vYNpfphGFqQBVV5FTsTja5mJtzxz4pIIkFWc,3963
6
+ pyControl4/director.py,sha256=QY6Re-fGgV-V340rTjpkSCfqvVRD_kbnDEHScoGJ0gk,10718
7
+ pyControl4/error_handling.py,sha256=3VpZ4JsF5kgrSNASHYVEQVIJq_vs8kvMk0-bDsd_FXU,3866
8
+ pyControl4/fan.py,sha256=MldA1E5VDkLJrS2Zp-5tUBEgPsUGYH7D6J-i2OdFJ5I,2140
9
+ pyControl4/light.py,sha256=qc8AGFiM9wnS-gi1tecWGGBRo-9dPZzYBHvE0QenW8w,1587
10
+ pyControl4/relay.py,sha256=GWYxdaB9sG3ixD87IY2yV3UKulIB7mkq1xyjxtUDW1Q,2225
11
+ pyControl4/room.py,sha256=nGhVxTw1QjX3UFmFZEO8TYBPCUae-NqObuVTPShEkqs,5195
12
+ pyControl4/websocket.py,sha256=9UsxO8tFUENuya1tzwTYk2haWnnDutUgQ5jTLTlr5dU,8823
13
+ pycontrol4-1.3.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
14
+ pycontrol4-1.3.0.dist-info/METADATA,sha256=WEAbFu5iVvjZ-iKRNG2u2BYlNDPytORQ4dX1Zpm_hmU,3285
15
+ pycontrol4-1.3.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
+ pycontrol4-1.3.0.dist-info/top_level.txt,sha256=8hJWE4Vz6ySUM1pzgZQCyngE7zVDW8qp7qe_4JXKRpY,11
17
+ pycontrol4-1.3.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (74.0.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,15 +0,0 @@
1
- pyControl4/__init__.py,sha256=JR6zFcZJ-M1o8g28gdU71uZHYzh-b21x7rg3EWrf3hg,394
2
- pyControl4/account.py,sha256=eyWkGaDla4_gLvv8GHBxmJ2iBMxpdY7ax53JryWOtcE,9760
3
- pyControl4/alarm.py,sha256=NHsrdzILMRf9-PdRIQr-7kZnsupcmH1o1khM3-iY08M,7154
4
- pyControl4/blind.py,sha256=lgiWMdw3xxPO2VZd-ozX6QMAnhdj5-Z07NGTF-Tj3Ao,4437
5
- pyControl4/director.py,sha256=xu1AyG_4KNs7oZ5kJA-qopoKF6KOUlVdtpi7bldGMP0,10723
6
- pyControl4/error_handling.py,sha256=3VpZ4JsF5kgrSNASHYVEQVIJq_vs8kvMk0-bDsd_FXU,3866
7
- pyControl4/light.py,sha256=gShT4QWhudVEYRWB0AGQYh-53FMwhuyjD6zUVXM142I,1588
8
- pyControl4/relay.py,sha256=O8dGVF2b2Gfi1623en9jDMPbUPESwavTt-AYdQhOIQ4,2226
9
- pyControl4/room.py,sha256=OyKoCyMst00RWSgNy7yBX9rS-0d2MUNd8_hvpJ-rSvg,5196
10
- pyControl4/websocket.py,sha256=9UsxO8tFUENuya1tzwTYk2haWnnDutUgQ5jTLTlr5dU,8823
11
- pyControl4-1.2.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
12
- pyControl4-1.2.0.dist-info/METADATA,sha256=agMc_4RJNgJfmk3o3ZoLSGA-9J2xySdLXXEvn3Fd4Nw,3066
13
- pyControl4-1.2.0.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
14
- pyControl4-1.2.0.dist-info/top_level.txt,sha256=8hJWE4Vz6ySUM1pzgZQCyngE7zVDW8qp7qe_4JXKRpY,11
15
- pyControl4-1.2.0.dist-info/RECORD,,