python-mobius 0.1.3__tar.gz → 0.1.4__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.
Files changed (50) hide show
  1. {python_mobius-0.1.3 → python_mobius-0.1.4}/CHANGELOG.md +13 -0
  2. {python_mobius-0.1.3 → python_mobius-0.1.4}/PKG-INFO +1 -1
  3. {python_mobius-0.1.3 → python_mobius-0.1.4}/pyproject.toml +1 -1
  4. {python_mobius-0.1.3 → python_mobius-0.1.4}/src/mobius/__init__.py +1 -1
  5. {python_mobius-0.1.3 → python_mobius-0.1.4}/src/mobius/device.py +15 -0
  6. {python_mobius-0.1.3 → python_mobius-0.1.4}/tests/test_connection_cleanup.py +14 -0
  7. {python_mobius-0.1.3 → python_mobius-0.1.4}/.gitignore +0 -0
  8. {python_mobius-0.1.3 → python_mobius-0.1.4}/LICENSE +0 -0
  9. {python_mobius-0.1.3 → python_mobius-0.1.4}/README.md +0 -0
  10. {python_mobius-0.1.3 → python_mobius-0.1.4}/documentation/00-overview.md +0 -0
  11. {python_mobius-0.1.3 → python_mobius-0.1.4}/documentation/01-ble-transport.md +0 -0
  12. {python_mobius-0.1.3 → python_mobius-0.1.4}/documentation/02-framing-and-crc.md +0 -0
  13. {python_mobius-0.1.3 → python_mobius-0.1.4}/documentation/03-attributes-and-opcodes.md +0 -0
  14. {python_mobius-0.1.3 → python_mobius-0.1.4}/documentation/04-device-identity.md +0 -0
  15. {python_mobius-0.1.3 → python_mobius-0.1.4}/documentation/05-scenes.md +0 -0
  16. {python_mobius-0.1.3 → python_mobius-0.1.4}/documentation/06-light-schedule.md +0 -0
  17. {python_mobius-0.1.3 → python_mobius-0.1.4}/documentation/07-pump-schedule.md +0 -0
  18. {python_mobius-0.1.3 → python_mobius-0.1.4}/documentation/08-manufacturer-data.md +0 -0
  19. {python_mobius-0.1.3 → python_mobius-0.1.4}/documentation/09-thread-coap-relay.md +0 -0
  20. {python_mobius-0.1.3 → python_mobius-0.1.4}/documentation/10-known-gaps-and-open-questions.md +0 -0
  21. {python_mobius-0.1.3 → python_mobius-0.1.4}/documentation/11-device-status-attributes.md +0 -0
  22. {python_mobius-0.1.3 → python_mobius-0.1.4}/documentation/12-device-identity-and-address-stability.md +0 -0
  23. {python_mobius-0.1.3 → python_mobius-0.1.4}/src/mobius/cli.py +0 -0
  24. {python_mobius-0.1.3 → python_mobius-0.1.4}/src/mobius/constants.py +0 -0
  25. {python_mobius-0.1.3 → python_mobius-0.1.4}/src/mobius/crc.py +0 -0
  26. {python_mobius-0.1.3 → python_mobius-0.1.4}/src/mobius/device_status.py +0 -0
  27. {python_mobius-0.1.3 → python_mobius-0.1.4}/src/mobius/discovery.py +0 -0
  28. {python_mobius-0.1.3 → python_mobius-0.1.4}/src/mobius/frame.py +0 -0
  29. {python_mobius-0.1.3 → python_mobius-0.1.4}/src/mobius/manufacturer.py +0 -0
  30. {python_mobius-0.1.3 → python_mobius-0.1.4}/src/mobius/modifiers.py +0 -0
  31. {python_mobius-0.1.3 → python_mobius-0.1.4}/src/mobius/power.py +0 -0
  32. {python_mobius-0.1.3 → python_mobius-0.1.4}/src/mobius/pump_status.py +0 -0
  33. {python_mobius-0.1.3 → python_mobius-0.1.4}/src/mobius/schedule.py +0 -0
  34. {python_mobius-0.1.3 → python_mobius-0.1.4}/tests/test_device_status.py +0 -0
  35. {python_mobius-0.1.3 → python_mobius-0.1.4}/tests/test_device_summary.py +0 -0
  36. {python_mobius-0.1.3 → python_mobius-0.1.4}/tests/test_firmware_versions.py +0 -0
  37. {python_mobius-0.1.3 → python_mobius-0.1.4}/tests/test_frame.py +0 -0
  38. {python_mobius-0.1.3 → python_mobius-0.1.4}/tests/test_hyperdrive_device.py +0 -0
  39. {python_mobius-0.1.3 → python_mobius-0.1.4}/tests/test_insolation_detection.py +0 -0
  40. {python_mobius-0.1.3 → python_mobius-0.1.4}/tests/test_light_intensity_branching.py +0 -0
  41. {python_mobius-0.1.3 → python_mobius-0.1.4}/tests/test_light_schedule.py +0 -0
  42. {python_mobius-0.1.3 → python_mobius-0.1.4}/tests/test_manufacturer.py +0 -0
  43. {python_mobius-0.1.3 → python_mobius-0.1.4}/tests/test_manufacturer_lookup.py +0 -0
  44. {python_mobius-0.1.3 → python_mobius-0.1.4}/tests/test_modifiers.py +0 -0
  45. {python_mobius-0.1.3 → python_mobius-0.1.4}/tests/test_power.py +0 -0
  46. {python_mobius-0.1.3 → python_mobius-0.1.4}/tests/test_pump_schedule.py +0 -0
  47. {python_mobius-0.1.3 → python_mobius-0.1.4}/tests/test_pump_status.py +0 -0
  48. {python_mobius-0.1.3 → python_mobius-0.1.4}/tests/test_schedule_intensity_scalar.py +0 -0
  49. {python_mobius-0.1.3 → python_mobius-0.1.4}/tests/test_serial_decoding.py +0 -0
  50. {python_mobius-0.1.3 → python_mobius-0.1.4}/tests/test_serial_identity.py +0 -0
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.4
4
+
5
+ - Added `MobiusDevice.is_connected` property -- lets callers check
6
+ connection state before deciding whether to read directly or reconnect
7
+ first, enabling a persistent-connection usage pattern (connect() once,
8
+ read many times, only reconnect on an actual failure) instead of
9
+ connecting/disconnecting on every read. `connect()`/`disconnect()` were
10
+ already separate public methods (not just wrapped by `__aenter__`/
11
+ `__aexit__`), so this required no other changes -- just a convenience
12
+ property exposing what was previously only checked internally via
13
+ `self._client.is_connected`. Added for `ha-mobius`'s move to persistent
14
+ connections. 1 new test.
15
+
3
16
  ## 0.1.3
4
17
 
5
18
  - **Added firmware/hardware version reading.** `get_firmware_versions()`
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-mobius
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: Reverse-engineered Python client for the Mobius BLE protocol (EcoTech Marine VorTech/Radion, AquaIllumination, Neptune Systems, NYOS)
5
5
  Project-URL: Homepage, https://code.r3pek.org/r3pek/python-mobius
6
6
  Project-URL: Documentation, https://code.r3pek.org/r3pek/python-mobius/src/branch/main/documentation
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "python-mobius"
7
- version = "0.1.3"
7
+ version = "0.1.4"
8
8
  description = "Reverse-engineered Python client for the Mobius BLE protocol (EcoTech Marine VorTech/Radion, AquaIllumination, Neptune Systems, NYOS)"
9
9
  readme = "README.md"
10
10
  license = { text = "GPL-2.0-only" }
@@ -51,7 +51,7 @@ from .discovery import (
51
51
  dedupe_by_serial, find_device_by_serial,
52
52
  )
53
53
 
54
- __version__ = "0.1.3"
54
+ __version__ = "0.1.4"
55
55
 
56
56
  __all__ = [
57
57
  "__version__",
@@ -237,6 +237,21 @@ class MobiusDevice:
237
237
  if self._client and self._client.is_connected:
238
238
  await self._client.disconnect()
239
239
 
240
+ @property
241
+ def is_connected(self) -> bool:
242
+ """
243
+ True if there's currently a live BLE connection. connect()/
244
+ disconnect() are already separate public methods (not just
245
+ wrapped by __aenter__/__aexit__), so this device can be used as a
246
+ persistent, long-lived connection -- connect() once, read many
247
+ times, disconnect() only when actually done -- rather than
248
+ reconnecting on every read. Callers doing this should check this
249
+ property before each read and reconnect (ideally via `serial=`,
250
+ not a cached address -- see documentation/
251
+ 12-device-identity-and-address-stability.md) if it's False.
252
+ """
253
+ return self._client is not None and self._client.is_connected
254
+
240
255
  def _on_rx_data(self, _handle, data: bytearray):
241
256
  self._rx_buffer.extend(data)
242
257
 
@@ -105,3 +105,17 @@ async def test_pump_telemetry_speed_percent_is_always_nonnegative():
105
105
 
106
106
  assert telemetry["speed"] == -447
107
107
  assert telemetry["speed_percent"] == 44.7
108
+
109
+
110
+ @pytest.mark.asyncio
111
+ async def test_is_connected_reflects_client_state():
112
+ device = MobiusDevice(_fake_ble_device())
113
+ assert device.is_connected is False # never connected
114
+
115
+ fake_client = MagicMock()
116
+ fake_client.is_connected = True
117
+ device._client = fake_client
118
+ assert device.is_connected is True
119
+
120
+ fake_client.is_connected = False
121
+ assert device.is_connected is False
File without changes
File without changes
File without changes