homecom-alt 1.0.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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 serbanb11
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,3 @@
1
+ include LICENSE README.md
2
+ include requirements.txt
3
+ include requirements-test.txt
@@ -0,0 +1,135 @@
1
+ Metadata-Version: 2.1
2
+ Name: homecom_alt
3
+ Version: 1.0.0
4
+ Summary: Python wrapper for controlling devices managed by HomeCom Easy APP.
5
+ Home-page: https://github.com/serbanb11/homecom-alt
6
+ Author: serbanb11
7
+ License: MIT
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Programming Language :: Python
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Typing :: Typed
17
+ Requires-Python: >=3.12
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+
21
+ # homecom-alt
22
+
23
+ Python wrapper for controlling devices managed by HomeCom Easy APP.
24
+
25
+ ## How to use package
26
+ [Check example.py](example.py)
27
+
28
+ or
29
+
30
+ ```python
31
+ """An example of using HomeCom alt package."""
32
+ import asyncio
33
+ import logging
34
+
35
+ from aiohttp import ClientConnectorError, ClientError, ClientSession
36
+
37
+ from homecom_alt import (
38
+ ApiError,
39
+ AuthFailedError,
40
+ ConnectionOptions,
41
+ InvalidSensorDataError,
42
+ HomeComAlt,
43
+ BHCDevice,
44
+ )
45
+
46
+ logging.basicConfig(level=logging.DEBUG)
47
+
48
+ USERNAME = "user"
49
+ PASSWORD = "password"
50
+
51
+ def print_status(data: BHCDevice):
52
+ print("firmware: {data.firmware}")
53
+ print("notifications: {data.notifications}")
54
+ for ref in data.stardard_functions:
55
+ normalized_id = ref["id"].split("/", 2)[-1]
56
+
57
+ match normalized_id:
58
+ case "operationMode":
59
+ print(f"operationMode current_value: {ref["value"]}, allowed_values: {ref["allowedValues"]}")
60
+ case "acControl":
61
+ print(f"acControl current_value: {ref["value"]}, allowed_values: {ref["allowedValues"]}")
62
+ case "fanSpeed":
63
+ print(f"fanSpeed current_value: {ref["value"]}, allowed_values: {ref["allowedValues"]}")
64
+ case "airFlowHorizontal":
65
+ print(f"airFlowHorizontal current_value: {ref["value"]}, allowed_values: {ref["allowedValues"]}")
66
+ case "airFlowVertical":
67
+ print(f"airFlowVertical current_value: {ref["value"]}, allowed_values: {ref["allowedValues"]}")
68
+ case "temperatureSetpoint":
69
+ print(f"temperatureSetpoint current_value: {ref["value"]}{ref["unitOfMeasure"]}")
70
+ print(f"temperatureSetpoint min_value: {ref["minValue"]} max_value: {ref["maxValue"]}")
71
+ case "roomTemperature":
72
+ print(f"roomTemperature current_value: {ref["value"]}{ref["unitOfMeasure"]}")
73
+ case _:
74
+ pass
75
+
76
+ for ref in data.advanced_functions:
77
+ normalized_id = ref["id"].split("/", 2)[-1]
78
+
79
+ match normalized_id:
80
+ case "airPurificationMode":
81
+ print(f"plasmacluster current_value: {ref["value"]}")
82
+ case "fullPowerMode":
83
+ print(f"boost current_value: {ref["value"]}")
84
+ case "ecoMode":
85
+ print(f"eco mode current_value: {ref["value"]}")
86
+ case "timers/on":
87
+ print(f"timer turn on current_value: {ref["value"]} {ref["unitOfMeasure"]}")
88
+ print(f"timer turn on min_value: {ref["minValue"]} max_value: {ref["maxValue"]}")
89
+ case "timers/off":
90
+ print(f"timer turn off current_value: {ref["value"]} {ref["unitOfMeasure"]}")
91
+ print(f"timer turn off min_value: {ref["minValue"]} max_value: {ref["maxValue"]}")
92
+ case _:
93
+ pass
94
+
95
+ for ref in data.switch_programs:
96
+ normalized_id = ref["id"].split("/", 2)[-1]
97
+
98
+ match normalized_id:
99
+ case "switchPrograms/enabled":
100
+ print(f"programs current_value: {ref["value"]}")
101
+ case "switchPrograms/activeProgram":
102
+ print(f"program current_value: {ref["value"]}, allowed_values: {ref["allowedValues"]}")
103
+ case _:
104
+ pass
105
+
106
+ async def main():
107
+ """Run main function."""
108
+ options = ConnectionOptions(username=USERNAME, password=PASSWORD)
109
+
110
+ async with ClientSession() as websession:
111
+ bhc = await HomeComAlt.create(websession, options)
112
+
113
+ try:
114
+ data: dict[str, BHCDevice] = {}
115
+ device_ids: list[str] = []
116
+ # get devices synced with homecom easy
117
+ devices = await bhc.async_get_devices()
118
+ # get status for each device discovered
119
+ for device in await devices:
120
+ print(f"Device={device["deviceId"]}, type={device["deviceType"]}")
121
+ device_ids.append(device["deviceId"])
122
+ while True:
123
+ device_id = input(f"Enter the device you want to control: {', '.join(device_ids)}")
124
+ if device_id not in device_ids:
125
+ print("device_id not in the list of devices")
126
+ continue
127
+ data: BHCDevice = await bhc.async_update(device_id)
128
+ print_status(data)
129
+ break
130
+
131
+ loop = asyncio.new_event_loop()
132
+ loop.run_until_complete(main())
133
+ loop.close()
134
+
135
+ ```
@@ -0,0 +1,115 @@
1
+ # homecom-alt
2
+
3
+ Python wrapper for controlling devices managed by HomeCom Easy APP.
4
+
5
+ ## How to use package
6
+ [Check example.py](example.py)
7
+
8
+ or
9
+
10
+ ```python
11
+ """An example of using HomeCom alt package."""
12
+ import asyncio
13
+ import logging
14
+
15
+ from aiohttp import ClientConnectorError, ClientError, ClientSession
16
+
17
+ from homecom_alt import (
18
+ ApiError,
19
+ AuthFailedError,
20
+ ConnectionOptions,
21
+ InvalidSensorDataError,
22
+ HomeComAlt,
23
+ BHCDevice,
24
+ )
25
+
26
+ logging.basicConfig(level=logging.DEBUG)
27
+
28
+ USERNAME = "user"
29
+ PASSWORD = "password"
30
+
31
+ def print_status(data: BHCDevice):
32
+ print("firmware: {data.firmware}")
33
+ print("notifications: {data.notifications}")
34
+ for ref in data.stardard_functions:
35
+ normalized_id = ref["id"].split("/", 2)[-1]
36
+
37
+ match normalized_id:
38
+ case "operationMode":
39
+ print(f"operationMode current_value: {ref["value"]}, allowed_values: {ref["allowedValues"]}")
40
+ case "acControl":
41
+ print(f"acControl current_value: {ref["value"]}, allowed_values: {ref["allowedValues"]}")
42
+ case "fanSpeed":
43
+ print(f"fanSpeed current_value: {ref["value"]}, allowed_values: {ref["allowedValues"]}")
44
+ case "airFlowHorizontal":
45
+ print(f"airFlowHorizontal current_value: {ref["value"]}, allowed_values: {ref["allowedValues"]}")
46
+ case "airFlowVertical":
47
+ print(f"airFlowVertical current_value: {ref["value"]}, allowed_values: {ref["allowedValues"]}")
48
+ case "temperatureSetpoint":
49
+ print(f"temperatureSetpoint current_value: {ref["value"]}{ref["unitOfMeasure"]}")
50
+ print(f"temperatureSetpoint min_value: {ref["minValue"]} max_value: {ref["maxValue"]}")
51
+ case "roomTemperature":
52
+ print(f"roomTemperature current_value: {ref["value"]}{ref["unitOfMeasure"]}")
53
+ case _:
54
+ pass
55
+
56
+ for ref in data.advanced_functions:
57
+ normalized_id = ref["id"].split("/", 2)[-1]
58
+
59
+ match normalized_id:
60
+ case "airPurificationMode":
61
+ print(f"plasmacluster current_value: {ref["value"]}")
62
+ case "fullPowerMode":
63
+ print(f"boost current_value: {ref["value"]}")
64
+ case "ecoMode":
65
+ print(f"eco mode current_value: {ref["value"]}")
66
+ case "timers/on":
67
+ print(f"timer turn on current_value: {ref["value"]} {ref["unitOfMeasure"]}")
68
+ print(f"timer turn on min_value: {ref["minValue"]} max_value: {ref["maxValue"]}")
69
+ case "timers/off":
70
+ print(f"timer turn off current_value: {ref["value"]} {ref["unitOfMeasure"]}")
71
+ print(f"timer turn off min_value: {ref["minValue"]} max_value: {ref["maxValue"]}")
72
+ case _:
73
+ pass
74
+
75
+ for ref in data.switch_programs:
76
+ normalized_id = ref["id"].split("/", 2)[-1]
77
+
78
+ match normalized_id:
79
+ case "switchPrograms/enabled":
80
+ print(f"programs current_value: {ref["value"]}")
81
+ case "switchPrograms/activeProgram":
82
+ print(f"program current_value: {ref["value"]}, allowed_values: {ref["allowedValues"]}")
83
+ case _:
84
+ pass
85
+
86
+ async def main():
87
+ """Run main function."""
88
+ options = ConnectionOptions(username=USERNAME, password=PASSWORD)
89
+
90
+ async with ClientSession() as websession:
91
+ bhc = await HomeComAlt.create(websession, options)
92
+
93
+ try:
94
+ data: dict[str, BHCDevice] = {}
95
+ device_ids: list[str] = []
96
+ # get devices synced with homecom easy
97
+ devices = await bhc.async_get_devices()
98
+ # get status for each device discovered
99
+ for device in await devices:
100
+ print(f"Device={device["deviceId"]}, type={device["deviceType"]}")
101
+ device_ids.append(device["deviceId"])
102
+ while True:
103
+ device_id = input(f"Enter the device you want to control: {', '.join(device_ids)}")
104
+ if device_id not in device_ids:
105
+ print("device_id not in the list of devices")
106
+ continue
107
+ data: BHCDevice = await bhc.async_update(device_id)
108
+ print_status(data)
109
+ break
110
+
111
+ loop = asyncio.new_event_loop()
112
+ loop.run_until_complete(main())
113
+ loop.close()
114
+
115
+ ```