$ show JoDehli/PyLoxone
PyLoxone is a Home Assistant integration that enables communication with Loxone Miniserver systems. It allows Home Assistant to discover, monitor, and control Loxone devices (lights, switches, sensors, climate systems, etc.) through both HTTP API and WebSocket connections. The architecture separates Home Assistant-specific logic from the Loxone communication protocol via a dedicated pyloxone_api library. Key features include automatic token-based authentication with refresh capabilities, real-time state updates via WebSocket, entity creation across multiple Home Assistant platforms (sensor, binary_sensor, switch, cover, climate, media_player, etc.), and services for sending direct commands to Loxone devices. The integration handles connection lifecycle management, device discovery, and provides diagnostics and system health information.
The LLM identified 3 files worth highlighting for reuse:
Implements parsing of various message types from the Loxone Miniserver WebSocket connection. Handles TEXT, BINARY, VALUE_STATES, TEXT_STATES, and other message types with binary protocol parsing. Demonstrates strong protocol implementation skills with clean separation of concerns. Could be extracted for use in any project needing to communicate with Loxone Miniserver with minimal dependencies (only standard library and pyloxone_api.exceptions).
Contains reusable helper functions including a simple device registry pattern (get_or_create_device), range mapping functions, and Home Assistant/Loxone value conversion utilities. The device registry implements a clean, self-contained pattern for tracking device information that could be reused in other projects. The unit conversion functions (hass_to_lox, lox_to_hass) demonstrate domain-specific knowledge in a reusable format.
Implements mapping of Loxone Radio blocks to Home Assistant Select entities. The build_option_maps function is particularly noteworthy as it handles the complex mapping of Loxone output numbers to select options, including deduplication of duplicate option names and handling of 'all off' states. This function is largely HA-independent and could be reused in other projects dealing with similar option mapping challenges. Shows good handling of edge cases and data transformation.