TISControlProtocol 1.0.69__tar.gz → 1.0.71__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.
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/PKG-INFO +1 -1
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/pyproject.toml +1 -1
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/api.py +32 -9
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/apis/__init__.py +2 -0
- tiscontrolprotocol-1.0.71/src/TISControlProtocol/apis/toggle_connection_endpoint.py +52 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/.gitignore +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/.vscode/c_cpp_properties.json +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/.vscode/launch.json +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/.vscode/settings.json +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/.vscode/tasks.json +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/LICENSE +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/MANIFEST.in +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/README.md +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/dev/pump_version.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/BytesHelper.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/Protocols/__init__.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/Protocols/udp/AckCoordinator.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/Protocols/udp/PacketDispatcher.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/Protocols/udp/PacketExtractor.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/Protocols/udp/PacketHandlers/AnalogFeedbackHandler.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/Protocols/udp/PacketHandlers/AutoBinaryFeedbackHandler.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/Protocols/udp/PacketHandlers/BinaryFeedbackHandler.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/Protocols/udp/PacketHandlers/ClimateBinaryFeedbackHandler.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/Protocols/udp/PacketHandlers/ClimateControlFeedbackHandler.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/Protocols/udp/PacketHandlers/ControlResponseHandler.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/Protocols/udp/PacketHandlers/DiscoveryFeedbackHandler.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/Protocols/udp/PacketHandlers/EnergyFeedbackHandler.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/Protocols/udp/PacketHandlers/FloorBinaryFeedbackHandler.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/Protocols/udp/PacketHandlers/HealthFeedbackHandler.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/Protocols/udp/PacketHandlers/LunaTempFeedbackHandler.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/Protocols/udp/PacketHandlers/RealTimeFeedbackHandler.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/Protocols/udp/PacketHandlers/SearchResponseHandler.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/Protocols/udp/PacketHandlers/SecurityFeedbackHandler.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/Protocols/udp/PacketHandlers/UpdateResponseHandler.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/Protocols/udp/PacketHandlers/UpdateSecurityHandler.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/Protocols/udp/PacketHandlers/WeatherFeedbackHandler.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/Protocols/udp/PacketHandlers/__init__.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/Protocols/udp/PacketProtocol.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/Protocols/udp/PacketReceiver.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/Protocols/udp/PacketSender.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/Protocols/udp/ProtocolHandler.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/Protocols/udp/UpdateCoordinator.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/Protocols/udp/__init__.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/__init__.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/apis/bill_config_endpoint.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/apis/change_password_endpoint.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/apis/get_bill_config_endpoint.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/apis/get_key_endpoint.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/apis/password_dashboard.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/apis/password_form_endpoint.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/apis/passwords_endpoint.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/apis/restart_endpoint.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/apis/scan_devices_endpoint.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/apis/shared.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/apis/submit_password.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/apis/tis_endpoint.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/apis/update_endpoint.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/crc.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/display.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/logo.png +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/package-lock.json +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/package.json +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/postcss.config.mjs +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/public/__init__.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/public/dashboard.css +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/public/password_dashboard_loader.js +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/shared.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/views/__init__.py +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/views/password_dashboard/index.html +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/views/password_dashboard/styles.css +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/views/password_form/index.html +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/views/password_form/styles.css +0 -0
- {tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/tests/test.py +0 -0
|
@@ -19,6 +19,7 @@ from TISControlProtocol.shared import get_real_mac
|
|
|
19
19
|
from .apis import (
|
|
20
20
|
BillConfigEndpoint,
|
|
21
21
|
ChangeSecurityPassEndpoint,
|
|
22
|
+
ToggleConnectionEndpoint,
|
|
22
23
|
GetBillConfigEndpoint,
|
|
23
24
|
GetKeyEndpoint,
|
|
24
25
|
PasswordsEndpoint,
|
|
@@ -47,8 +48,10 @@ class TISApi:
|
|
|
47
48
|
"""Initialize the API class."""
|
|
48
49
|
self.host = host
|
|
49
50
|
self.port = port
|
|
51
|
+
self.loop = None
|
|
50
52
|
self.protocol = None
|
|
51
53
|
self.transport = None
|
|
54
|
+
self.sock = None
|
|
52
55
|
self.hass = hass
|
|
53
56
|
self.config_entries = {}
|
|
54
57
|
self.bill_configs = {}
|
|
@@ -60,20 +63,39 @@ class TISApi:
|
|
|
60
63
|
self.cms_url = "https://cms-tis.com"
|
|
61
64
|
self._cms_task_unsub = None
|
|
62
65
|
|
|
66
|
+
async def setup(self):
|
|
67
|
+
"""Setup the TIS API."""
|
|
68
|
+
try:
|
|
69
|
+
await self.connect()
|
|
70
|
+
await self._initialize_hass_data()
|
|
71
|
+
await self._register_http_views()
|
|
72
|
+
self.hass.async_add_executor_job(self.run_display)
|
|
73
|
+
except Exception as e:
|
|
74
|
+
logging.error("Error during setup: %s", e)
|
|
75
|
+
|
|
63
76
|
async def connect(self):
|
|
64
77
|
"""Connect to the TIS API."""
|
|
65
78
|
self.loop = self.hass.loop
|
|
66
79
|
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
80
|
+
|
|
67
81
|
try:
|
|
68
82
|
await self._setup_udp_protocol()
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
self.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
83
|
+
except Exception:
|
|
84
|
+
self.sock.close()
|
|
85
|
+
self.sock = None
|
|
86
|
+
self.loop = None
|
|
87
|
+
raise
|
|
88
|
+
|
|
89
|
+
async def disconnect(self):
|
|
90
|
+
"""Disconnect from the TIS API."""
|
|
91
|
+
if self.transport:
|
|
92
|
+
self.transport.close()
|
|
93
|
+
self.transport = None
|
|
94
|
+
self.protocol = None
|
|
95
|
+
self.loop = None
|
|
96
|
+
if hasattr(self, "sock") and self.sock:
|
|
97
|
+
self.sock.close()
|
|
98
|
+
self.sock = None
|
|
77
99
|
|
|
78
100
|
async def _setup_udp_protocol(self):
|
|
79
101
|
"""Setup the UDP protocol."""
|
|
@@ -107,6 +129,7 @@ class TISApi:
|
|
|
107
129
|
self.hass.http.register_view(BillConfigEndpoint(self))
|
|
108
130
|
self.hass.http.register_view(GetBillConfigEndpoint(self))
|
|
109
131
|
self.hass.http.register_view(PasswordsEndpoint(self))
|
|
132
|
+
self.hass.http.register_view(ToggleConnectionEndpoint(self))
|
|
110
133
|
except Exception as e:
|
|
111
134
|
logging.error("Error registering views %s", e)
|
|
112
135
|
raise ConnectionError
|
|
@@ -209,7 +232,7 @@ class TISApi:
|
|
|
209
232
|
|
|
210
233
|
if self.display is None:
|
|
211
234
|
self.display = TISDisplay(self.display_logo, self.version)
|
|
212
|
-
|
|
235
|
+
|
|
213
236
|
self.display.run_display()
|
|
214
237
|
|
|
215
238
|
async def parse_device_manager_request(self, data: dict) -> None:
|
{tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/apis/__init__.py
RENAMED
|
@@ -16,6 +16,7 @@ from .password_form_endpoint import PasswordFormEndpoint
|
|
|
16
16
|
from .submit_password import SubmitPasswordEndpoint
|
|
17
17
|
from .password_dashboard import PasswordDashboardEndpoint
|
|
18
18
|
from .passwords_endpoint import PasswordsEndpoint
|
|
19
|
+
from .toggle_connection_endpoint import ToggleConnectionEndpoint
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
__all__ = [
|
|
@@ -29,6 +30,7 @@ __all__ = [
|
|
|
29
30
|
"GetBillConfigEndpoint",
|
|
30
31
|
"SubmitPasswordEndpoint",
|
|
31
32
|
"PasswordsEndpoint",
|
|
33
|
+
"ToggleConnectionEndpoint",
|
|
32
34
|
]
|
|
33
35
|
|
|
34
36
|
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
from homeassistant.components.http import HomeAssistantView
|
|
2
|
+
from aiohttp import web
|
|
3
|
+
from TISControlProtocol.shared import get_real_mac
|
|
4
|
+
import logging
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class ToggleConnectionEndpoint(HomeAssistantView):
|
|
8
|
+
"""Connect or Disconnect the TIS API"""
|
|
9
|
+
|
|
10
|
+
url = "/api/toggle-connection"
|
|
11
|
+
name = "api:toggle-connection"
|
|
12
|
+
requires_auth = False
|
|
13
|
+
|
|
14
|
+
def __init__(self, tis_api):
|
|
15
|
+
self.tis_api = tis_api
|
|
16
|
+
|
|
17
|
+
async def post(self, request):
|
|
18
|
+
mac_address = request.query.get("mac_address")
|
|
19
|
+
|
|
20
|
+
if mac_address is None:
|
|
21
|
+
logging.info("Required parameters not found in query, parsing request body")
|
|
22
|
+
try:
|
|
23
|
+
data = await request.json()
|
|
24
|
+
mac_address = data.get("mac_address")
|
|
25
|
+
except Exception:
|
|
26
|
+
pass
|
|
27
|
+
|
|
28
|
+
mac = await get_real_mac("end0")
|
|
29
|
+
|
|
30
|
+
if mac_address is None:
|
|
31
|
+
return web.json_response(
|
|
32
|
+
{"error": "required parameters are missing"}, status=400
|
|
33
|
+
)
|
|
34
|
+
elif mac_address != mac:
|
|
35
|
+
return web.json_response({"error": "Unauthorized"}, status=403)
|
|
36
|
+
|
|
37
|
+
if self.tis_api.transport:
|
|
38
|
+
logging.info("Disconnecting from TIS API")
|
|
39
|
+
try:
|
|
40
|
+
await self.tis_api.disconnect()
|
|
41
|
+
return web.json_response({"message": "Disconnected"}, status=200)
|
|
42
|
+
except Exception as e:
|
|
43
|
+
logging.error(f"Error disconnecting: {e}")
|
|
44
|
+
return web.json_response({"error": "Failed to disconnect"}, status=500)
|
|
45
|
+
else:
|
|
46
|
+
logging.info("Connecting to TIS API")
|
|
47
|
+
try:
|
|
48
|
+
await self.tis_api.connect()
|
|
49
|
+
return web.json_response({"message": "Connected"}, status=200)
|
|
50
|
+
except Exception as e:
|
|
51
|
+
logging.error(f"Error connecting: {e}")
|
|
52
|
+
return web.json_response({"error": "Failed to connect"}, status=500)
|
|
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
|
{tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/BytesHelper.py
RENAMED
|
File without changes
|
{tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/Protocols/__init__.py
RENAMED
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/apis/shared.py
RENAMED
|
File without changes
|
|
File without changes
|
{tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/apis/tis_endpoint.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/package-lock.json
RENAMED
|
File without changes
|
|
File without changes
|
{tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/postcss.config.mjs
RENAMED
|
File without changes
|
{tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/public/__init__.py
RENAMED
|
File without changes
|
{tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/public/dashboard.css
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tiscontrolprotocol-1.0.69 → tiscontrolprotocol-1.0.71}/src/TISControlProtocol/views/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|