pyControl4 1.2.0__tar.gz → 1.3.0__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.
- {pycontrol4-1.2.0 → pycontrol4-1.3.0}/PKG-INFO +12 -2
- {pycontrol4-1.2.0 → pycontrol4-1.3.0}/pyControl4/alarm.py +1 -2
- {pycontrol4-1.2.0 → pycontrol4-1.3.0}/pyControl4/blind.py +1 -2
- pycontrol4-1.3.0/pyControl4/climate.py +109 -0
- {pycontrol4-1.2.0 → pycontrol4-1.3.0}/pyControl4/director.py +2 -2
- pycontrol4-1.3.0/pyControl4/fan.py +81 -0
- {pycontrol4-1.2.0 → pycontrol4-1.3.0}/pyControl4/light.py +1 -2
- {pycontrol4-1.2.0 → pycontrol4-1.3.0}/pyControl4/relay.py +1 -2
- {pycontrol4-1.2.0 → pycontrol4-1.3.0}/pyControl4/room.py +1 -2
- {pycontrol4-1.2.0 → pycontrol4-1.3.0}/pyControl4.egg-info/PKG-INFO +12 -2
- {pycontrol4-1.2.0 → pycontrol4-1.3.0}/pyControl4.egg-info/SOURCES.txt +2 -0
- {pycontrol4-1.2.0 → pycontrol4-1.3.0}/setup.py +1 -1
- {pycontrol4-1.2.0 → pycontrol4-1.3.0}/LICENSE +0 -0
- {pycontrol4-1.2.0 → pycontrol4-1.3.0}/README.md +0 -0
- {pycontrol4-1.2.0 → pycontrol4-1.3.0}/pyControl4/__init__.py +0 -0
- {pycontrol4-1.2.0 → pycontrol4-1.3.0}/pyControl4/account.py +0 -0
- {pycontrol4-1.2.0 → pycontrol4-1.3.0}/pyControl4/error_handling.py +0 -0
- {pycontrol4-1.2.0 → pycontrol4-1.3.0}/pyControl4/websocket.py +0 -0
- {pycontrol4-1.2.0 → pycontrol4-1.3.0}/pyControl4.egg-info/dependency_links.txt +0 -0
- {pycontrol4-1.2.0 → pycontrol4-1.3.0}/pyControl4.egg-info/requires.txt +0 -0
- {pycontrol4-1.2.0 → pycontrol4-1.3.0}/pyControl4.egg-info/top_level.txt +0 -0
- {pycontrol4-1.2.0 → pycontrol4-1.3.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: pyControl4
|
|
3
|
-
Version: 1.
|
|
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
|
[](https://badge.fury.io/py/pyControl4)[](https://pepy.tech/project/pycontrol4)
|
|
@@ -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
|
+
)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"""Handles communication with a Control4 Director, and provides functions for
|
|
2
|
-
|
|
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",
|
|
137
|
+
"/api/v1/items/{}/commands".format(item_id), "GET_SETUP", {}, False
|
|
138
138
|
)
|
|
139
139
|
|
|
140
140
|
async def getItemVariables(self, item_id):
|
|
@@ -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
|
+
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: pyControl4
|
|
3
|
-
Version: 1.
|
|
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
|
[](https://badge.fury.io/py/pyControl4)[](https://pepy.tech/project/pycontrol4)
|
|
@@ -5,8 +5,10 @@ pyControl4/__init__.py
|
|
|
5
5
|
pyControl4/account.py
|
|
6
6
|
pyControl4/alarm.py
|
|
7
7
|
pyControl4/blind.py
|
|
8
|
+
pyControl4/climate.py
|
|
8
9
|
pyControl4/director.py
|
|
9
10
|
pyControl4/error_handling.py
|
|
11
|
+
pyControl4/fan.py
|
|
10
12
|
pyControl4/light.py
|
|
11
13
|
pyControl4/relay.py
|
|
12
14
|
pyControl4/room.py
|
|
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
|
|
5
5
|
|
|
6
6
|
setuptools.setup(
|
|
7
7
|
name="pyControl4", # Replace with your own username
|
|
8
|
-
version="1.
|
|
8
|
+
version="1.3.0",
|
|
9
9
|
author="lawtancool",
|
|
10
10
|
author_email="contact@lawrencetan.ca",
|
|
11
11
|
description="Python 3 asyncio package for interacting with Control4 systems",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|