heiman-connect 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,98 @@
1
+ Metadata-Version: 2.4
2
+ Name: heiman-connect
3
+ Version: 1.0.0
4
+ Summary: Python library for Heiman smart home devices
5
+ Author-email: Heiman Team <support@heiman.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/yourusername/heiman-connect
8
+ Project-URL: Bug Tracker, https://github.com/yourusername/heiman-connect/issues
9
+ Project-URL: Documentation, https://github.com/yourusername/heiman-connect/blob/main/README.md
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Home Automation
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+ Requires-Dist: aiohttp>=3.8.0
22
+ Requires-Dist: aiomqtt>=2.0.0
23
+ Provides-Extra: dev
24
+ Requires-Dist: pytest>=7.0; extra == "dev"
25
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
26
+ Requires-Dist: black>=22.0; extra == "dev"
27
+ Requires-Dist: ruff>=0.0.200; extra == "dev"
28
+ Requires-Dist: mypy>=0.950; extra == "dev"
29
+
30
+ # Heiman Connect Library
31
+
32
+ Python library for communicating with Heiman smart home devices.
33
+
34
+ ## Installation
35
+
36
+ ```bash
37
+ pip install heiman-connect
38
+ ```
39
+
40
+ ## Usage
41
+
42
+ ```python
43
+ import asyncio
44
+ from heimanconnect import HeimanAuth, HeimanCloudClient, HeimanHttpClient
45
+ from heimanconnect.models import AuthInfo
46
+
47
+ async def main():
48
+ # Initialize OAuth client
49
+ oauth_client = HeimanOauthClient(
50
+ client_id="app",
51
+ redirect_url="http://localhost:8123/auth/external_callback",
52
+ )
53
+
54
+ # Generate auth URL for user authorization
55
+ auth_url = oauth_client.gen_auth_url()
56
+ print(f"Authorize at: {auth_url}")
57
+
58
+ # After getting code from OAuth callback
59
+ auth_info = await oauth_client.get_access_token_async(code="your_code")
60
+
61
+ # Create HTTP client
62
+ http_client = HeimanHttpClient(
63
+ api_url="https://api.heiman.cn",
64
+ client_id="app",
65
+ access_token=auth_info.access_token,
66
+ )
67
+
68
+ # Create cloud client
69
+ auth = HeimanAuth(oauth_client, auth_info)
70
+ cloud_client = HeimanCloudClient(http_client, auth)
71
+
72
+ # Get homes
73
+ homes = await cloud_client.async_get_homes()
74
+
75
+ # Get devices
76
+ devices = await cloud_client.async_get_devices(home_id=homes[0].home_id)
77
+
78
+ # Control device
79
+ await cloud_client.async_control_device(
80
+ device_id=device_id,
81
+ property_identifier="Switch",
82
+ value=True,
83
+ )
84
+
85
+ asyncio.run(main())
86
+ ```
87
+
88
+ ## Features
89
+
90
+ - OAuth2 authentication
91
+ - HTTP API client
92
+ - MQTT real-time communication
93
+ - Device management
94
+ - Property control
95
+
96
+ ## License
97
+
98
+ MIT License
@@ -0,0 +1,69 @@
1
+ # Heiman Connect Library
2
+
3
+ Python library for communicating with Heiman smart home devices.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install heiman-connect
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```python
14
+ import asyncio
15
+ from heimanconnect import HeimanAuth, HeimanCloudClient, HeimanHttpClient
16
+ from heimanconnect.models import AuthInfo
17
+
18
+ async def main():
19
+ # Initialize OAuth client
20
+ oauth_client = HeimanOauthClient(
21
+ client_id="app",
22
+ redirect_url="http://localhost:8123/auth/external_callback",
23
+ )
24
+
25
+ # Generate auth URL for user authorization
26
+ auth_url = oauth_client.gen_auth_url()
27
+ print(f"Authorize at: {auth_url}")
28
+
29
+ # After getting code from OAuth callback
30
+ auth_info = await oauth_client.get_access_token_async(code="your_code")
31
+
32
+ # Create HTTP client
33
+ http_client = HeimanHttpClient(
34
+ api_url="https://api.heiman.cn",
35
+ client_id="app",
36
+ access_token=auth_info.access_token,
37
+ )
38
+
39
+ # Create cloud client
40
+ auth = HeimanAuth(oauth_client, auth_info)
41
+ cloud_client = HeimanCloudClient(http_client, auth)
42
+
43
+ # Get homes
44
+ homes = await cloud_client.async_get_homes()
45
+
46
+ # Get devices
47
+ devices = await cloud_client.async_get_devices(home_id=homes[0].home_id)
48
+
49
+ # Control device
50
+ await cloud_client.async_control_device(
51
+ device_id=device_id,
52
+ property_identifier="Switch",
53
+ value=True,
54
+ )
55
+
56
+ asyncio.run(main())
57
+ ```
58
+
59
+ ## Features
60
+
61
+ - OAuth2 authentication
62
+ - HTTP API client
63
+ - MQTT real-time communication
64
+ - Device management
65
+ - Property control
66
+
67
+ ## License
68
+
69
+ MIT License
@@ -0,0 +1,75 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "heiman-connect"
7
+ version = "1.0.0"
8
+ description = "Python library for Heiman smart home devices"
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ authors = [
12
+ {name = "Heiman Team", email = "support@heiman.com"}
13
+ ]
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Intended Audience :: Developers",
17
+ "Topic :: Software Development :: Libraries :: Python Modules",
18
+ "License :: OSI Approved :: MIT License",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3.10",
21
+ "Programming Language :: Python :: 3.11",
22
+ "Programming Language :: Python :: 3.12",
23
+ "Topic :: Home Automation",
24
+ ]
25
+ requires-python = ">=3.10"
26
+ dependencies = [
27
+ "aiohttp>=3.8.0",
28
+ "aiomqtt>=2.0.0",
29
+ ]
30
+
31
+ [project.optional-dependencies]
32
+ dev = [
33
+ "pytest>=7.0",
34
+ "pytest-asyncio>=0.21.0",
35
+ "black>=22.0",
36
+ "ruff>=0.0.200",
37
+ "mypy>=0.950",
38
+ ]
39
+
40
+ [project.urls]
41
+ Homepage = "https://github.com/yourusername/heiman-connect"
42
+ "Bug Tracker" = "https://github.com/yourusername/heiman-connect/issues"
43
+ Documentation = "https://github.com/yourusername/heiman-connect/blob/main/README.md"
44
+
45
+ [tool.setuptools.packages.find]
46
+ where = ["src"]
47
+ exclude = ["tests", "tests.*"]
48
+
49
+ [tool.setuptools.package-data]
50
+ heimanconnect = ["py.typed"]
51
+
52
+ [tool.black]
53
+ line-length = 88
54
+ target-version = ['py310', 'py311', 'py312']
55
+
56
+ [tool.ruff]
57
+ line-length = 88
58
+ select = [
59
+ "E", # pycodestyle errors
60
+ "W", # pycodestyle warnings
61
+ "F", # pyflakes
62
+ "I", # isort
63
+ "B", # flake8-bugbear
64
+ "C4", # flake8-comprehensions
65
+ ]
66
+ ignore = [
67
+ "E501", # line too long (handled by black)
68
+ "B008", # do not perform function calls in argument defaults
69
+ ]
70
+
71
+ [tool.mypy]
72
+ python_version = "3.10"
73
+ warn_return_any = true
74
+ warn_unused_configs = true
75
+ disallow_untyped_defs = false
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,98 @@
1
+ Metadata-Version: 2.4
2
+ Name: heiman-connect
3
+ Version: 1.0.0
4
+ Summary: Python library for Heiman smart home devices
5
+ Author-email: Heiman Team <support@heiman.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/yourusername/heiman-connect
8
+ Project-URL: Bug Tracker, https://github.com/yourusername/heiman-connect/issues
9
+ Project-URL: Documentation, https://github.com/yourusername/heiman-connect/blob/main/README.md
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Home Automation
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+ Requires-Dist: aiohttp>=3.8.0
22
+ Requires-Dist: aiomqtt>=2.0.0
23
+ Provides-Extra: dev
24
+ Requires-Dist: pytest>=7.0; extra == "dev"
25
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
26
+ Requires-Dist: black>=22.0; extra == "dev"
27
+ Requires-Dist: ruff>=0.0.200; extra == "dev"
28
+ Requires-Dist: mypy>=0.950; extra == "dev"
29
+
30
+ # Heiman Connect Library
31
+
32
+ Python library for communicating with Heiman smart home devices.
33
+
34
+ ## Installation
35
+
36
+ ```bash
37
+ pip install heiman-connect
38
+ ```
39
+
40
+ ## Usage
41
+
42
+ ```python
43
+ import asyncio
44
+ from heimanconnect import HeimanAuth, HeimanCloudClient, HeimanHttpClient
45
+ from heimanconnect.models import AuthInfo
46
+
47
+ async def main():
48
+ # Initialize OAuth client
49
+ oauth_client = HeimanOauthClient(
50
+ client_id="app",
51
+ redirect_url="http://localhost:8123/auth/external_callback",
52
+ )
53
+
54
+ # Generate auth URL for user authorization
55
+ auth_url = oauth_client.gen_auth_url()
56
+ print(f"Authorize at: {auth_url}")
57
+
58
+ # After getting code from OAuth callback
59
+ auth_info = await oauth_client.get_access_token_async(code="your_code")
60
+
61
+ # Create HTTP client
62
+ http_client = HeimanHttpClient(
63
+ api_url="https://api.heiman.cn",
64
+ client_id="app",
65
+ access_token=auth_info.access_token,
66
+ )
67
+
68
+ # Create cloud client
69
+ auth = HeimanAuth(oauth_client, auth_info)
70
+ cloud_client = HeimanCloudClient(http_client, auth)
71
+
72
+ # Get homes
73
+ homes = await cloud_client.async_get_homes()
74
+
75
+ # Get devices
76
+ devices = await cloud_client.async_get_devices(home_id=homes[0].home_id)
77
+
78
+ # Control device
79
+ await cloud_client.async_control_device(
80
+ device_id=device_id,
81
+ property_identifier="Switch",
82
+ value=True,
83
+ )
84
+
85
+ asyncio.run(main())
86
+ ```
87
+
88
+ ## Features
89
+
90
+ - OAuth2 authentication
91
+ - HTTP API client
92
+ - MQTT real-time communication
93
+ - Device management
94
+ - Property control
95
+
96
+ ## License
97
+
98
+ MIT License
@@ -0,0 +1,13 @@
1
+ README.md
2
+ pyproject.toml
3
+ src/heiman_connect.egg-info/PKG-INFO
4
+ src/heiman_connect.egg-info/SOURCES.txt
5
+ src/heiman_connect.egg-info/dependency_links.txt
6
+ src/heiman_connect.egg-info/requires.txt
7
+ src/heiman_connect.egg-info/top_level.txt
8
+ src/heimanconnect/__init__.py
9
+ src/heimanconnect/auth.py
10
+ src/heimanconnect/exceptions.py
11
+ src/heimanconnect/http_client.py
12
+ src/heimanconnect/models.py
13
+ src/heimanconnect/mqtt_client.py
@@ -0,0 +1,9 @@
1
+ aiohttp>=3.8.0
2
+ aiomqtt>=2.0.0
3
+
4
+ [dev]
5
+ pytest>=7.0
6
+ pytest-asyncio>=0.21.0
7
+ black>=22.0
8
+ ruff>=0.0.200
9
+ mypy>=0.950
@@ -0,0 +1 @@
1
+ heimanconnect
@@ -0,0 +1,50 @@
1
+ """Heiman Connect - Core library for Heiman Home Assistant integration.
2
+
3
+ This module provides the core functionality for communicating with Heiman devices
4
+ via HTTP API and MQTT protocol.
5
+ """
6
+
7
+ from .auth import HeimanAuth, HeimanOauthClient
8
+ from .http_client import HeimanHttpClient, HeimanCloudClient
9
+ from .mqtt_client import HeimanMqttClient
10
+ from .models import (
11
+ HeimanDevice,
12
+ HeimanHome,
13
+ HeimanUser,
14
+ DeviceProperty,
15
+ AuthInfo,
16
+ )
17
+ from .exceptions import (
18
+ HeimanException,
19
+ HeimanAuthError,
20
+ HeimanConnectionError,
21
+ HeimanApiError,
22
+ HeimanMQTTError,
23
+ )
24
+
25
+ __version__ = "1.0.0"
26
+
27
+ __all__ = [
28
+ # Version
29
+ "__version__",
30
+ # Auth
31
+ "HeimanAuth",
32
+ "HeimanOauthClient",
33
+ # HTTP Client
34
+ "HeimanHttpClient",
35
+ "HeimanCloudClient",
36
+ # MQTT Client
37
+ "HeimanMqttClient",
38
+ # Models
39
+ "HeimanDevice",
40
+ "HeimanHome",
41
+ "HeimanUser",
42
+ "DeviceProperty",
43
+ "AuthInfo",
44
+ # Exceptions
45
+ "HeimanException",
46
+ "HeimanAuthError",
47
+ "HeimanConnectionError",
48
+ "HeimanApiError",
49
+ "HeimanMQTTError",
50
+ ]