lghorizon 0.9.0.dev2__py3-none-any.whl → 0.9.0.dev4__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.
- lghorizon/__init__.py +39 -1
- lghorizon/const.py +4 -11
- lghorizon/helpers.py +1 -1
- lghorizon/lghorizon_api.py +506 -237
- lghorizon/models.py +768 -0
- {lghorizon-0.9.0.dev2.dist-info → lghorizon-0.9.0.dev4.dist-info}/METADATA +1 -1
- lghorizon-0.9.0.dev4.dist-info/RECORD +12 -0
- lghorizon/lghorizon_device.py +0 -336
- lghorizon/lghorizon_device_state_processor.py +0 -301
- lghorizon/lghorizon_message_factory.py +0 -39
- lghorizon/lghorizon_models.py +0 -1331
- lghorizon/lghorizon_mqtt_client.py +0 -123
- lghorizon/lghorizon_recording_factory.py +0 -41
- lghorizon-0.9.0.dev2.dist-info/RECORD +0 -17
- {lghorizon-0.9.0.dev2.dist-info → lghorizon-0.9.0.dev4.dist-info}/WHEEL +0 -0
- {lghorizon-0.9.0.dev2.dist-info → lghorizon-0.9.0.dev4.dist-info}/licenses/LICENSE +0 -0
- {lghorizon-0.9.0.dev2.dist-info → lghorizon-0.9.0.dev4.dist-info}/top_level.txt +0 -0
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"LG Horizon Message Factory."
|
|
2
|
-
|
|
3
|
-
from .lghorizon_models import (
|
|
4
|
-
LGHorizonMessage,
|
|
5
|
-
LGHorizonStatusMessage,
|
|
6
|
-
LGHorizonUnknownMessage,
|
|
7
|
-
LGHorizonUIStatusMessage,
|
|
8
|
-
LGHorizonMessageType, # Import LGHorizonMessageType from here
|
|
9
|
-
)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class LGHorizonMessageFactory:
|
|
13
|
-
"""Handle incoming MQTT messages for LG Horizon devices."""
|
|
14
|
-
|
|
15
|
-
def __init__(self):
|
|
16
|
-
"""Initialize the LG Horizon Message Factory."""
|
|
17
|
-
|
|
18
|
-
async def create_message(self, topic: str, payload: dict) -> LGHorizonMessage:
|
|
19
|
-
"""Create an LG Horizon message based on the topic and payload."""
|
|
20
|
-
message_type = await self._get_message_type(topic, payload)
|
|
21
|
-
match message_type:
|
|
22
|
-
case LGHorizonMessageType.STATUS:
|
|
23
|
-
return LGHorizonStatusMessage(payload, topic)
|
|
24
|
-
case LGHorizonMessageType.UI_STATUS:
|
|
25
|
-
# Placeholder for UI_STATUS message handling
|
|
26
|
-
return LGHorizonUIStatusMessage(payload, topic)
|
|
27
|
-
case LGHorizonMessageType.UNKNOWN:
|
|
28
|
-
return LGHorizonUnknownMessage(payload, topic)
|
|
29
|
-
|
|
30
|
-
async def _get_message_type(
|
|
31
|
-
self, topic: str, payload: dict
|
|
32
|
-
) -> LGHorizonMessageType:
|
|
33
|
-
"""Determine the message type based on topic and payload."""
|
|
34
|
-
if "status" in topic:
|
|
35
|
-
return LGHorizonMessageType.STATUS
|
|
36
|
-
if "type" in payload:
|
|
37
|
-
if payload["type"] == "CPE.uiStatus":
|
|
38
|
-
return LGHorizonMessageType.UI_STATUS
|
|
39
|
-
return LGHorizonMessageType.UNKNOWN
|