Skip to content

Commit d449242

Browse files
authored
Merge pull request #118 from SpanPanel/2_3_1
v2.3.1 catch connect failure to the MQTT broker
2 parents 30ed264 + 2fe143c commit d449242

3 files changed

Lines changed: 20 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [2.3.1] - 03/2026
8+
9+
### Fixed
10+
11+
- **MQTT connection errors now wrapped as `SpanPanelConnectionError`**`OSError` subclasses raised during MQTT broker connection (DNS resolution failure, connection refused, network unreachable, etc.) are now caught and wrapped as
12+
`SpanPanelConnectionError`. Previously these propagated as unhandled exceptions, preventing consumers from handling them gracefully.
13+
14+
## [2.3.0] - 03/2026
15+
16+
### Removed
17+
18+
- **Simulation engine removed**`DynamicSimulationEngine`, `SimulationConfig`, and all simulation-related modules have been removed from the library. Simulation is now handled by the standalone SPAN Panel Simulator add-on.
19+
720
## [2.2.4] - 03/2026
821

922
### Fixed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "span-panel-api"
3-
version = "2.3.0"
3+
version = "2.3.1"
44
description = "A client library for SPAN Panel API"
55
authors = [
66
{name = "SpanPanel"}

src/span_panel_api/mqtt/connection.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,12 @@ def _blocking_tls_and_connect() -> None:
175175
self._client.on_socket_open = self._on_socket_open_sync
176176
self._client.on_socket_register_write = self._on_socket_register_write_sync
177177
_LOGGER.debug("BRIDGE: Running TLS+connect in executor to %s:%s", self._host, self._port)
178-
await self._loop.run_in_executor(None, _blocking_tls_and_connect)
178+
try:
179+
await self._loop.run_in_executor(None, _blocking_tls_and_connect)
180+
except OSError as exc:
181+
raise SpanPanelConnectionError(
182+
f"Cannot connect to MQTT broker at {self._host}:{self._port}: {exc}"
183+
) from exc
179184
_LOGGER.debug("BRIDGE: Executor connect returned, waiting for CONNACK...")
180185
finally:
181186
# Switch to async-only socket callbacks now that we are

0 commit comments

Comments
 (0)