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.
@@ -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