python-mobius 0.10.1__py3-none-any.whl → 0.10.2__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.
mobius/__init__.py CHANGED
@@ -87,7 +87,7 @@ from .mob import (
87
87
  MAX_PUMP_PRIMITIVE_SIZE,
88
88
  )
89
89
 
90
- __version__ = "0.10.1"
90
+ __version__ = "0.10.2"
91
91
 
92
92
  __all__ = [
93
93
  "__version__",
mobius/device.py CHANGED
@@ -1842,7 +1842,7 @@ class MobiusDevice:
1842
1842
  return None
1843
1843
  return raw
1844
1844
 
1845
- async def discover_mesh_peers(self) -> list[MeshPeer]:
1845
+ async def discover_mesh_peers(self, raise_errors: bool = False) -> list[MeshPeer]:
1846
1846
  """
1847
1847
  Mesh peers from the ShortAddressArray/SerialNumberArray/
1848
1848
  DeviceModelArray (3700/3701/3702) parallel arrays, with addresses
@@ -1852,10 +1852,12 @@ class MobiusDevice:
1852
1852
  UnsupportedAttribute and this returns []. Whether the connected
1853
1853
  device lists itself is not known. Empty slots (serial
1854
1854
  "00000000000000") and short entries are skipped. Returns [] on any
1855
- failure.
1855
+ failure, or raises it with raise_errors=True.
1856
1856
  """
1857
1857
  own_address = await self.get_own_mesh_address()
1858
1858
  if own_address is None:
1859
+ if raise_errors:
1860
+ raise IOError("own mesh address (MeshLocalAddresses) not readable")
1859
1861
  return []
1860
1862
  prefix = mesh_local_prefix_from_own_address(own_address)
1861
1863
 
@@ -1864,6 +1866,8 @@ class MobiusDevice:
1864
1866
  models_raw = await self.get_attribute(C2Attribute.DeviceModelArray, index=0, count=ALL_ELEMENTS)
1865
1867
  shorts_raw = await self.get_attribute(C2Attribute.ShortAddressArray, index=0, count=ALL_ELEMENTS)
1866
1868
  except Exception:
1869
+ if raise_errors:
1870
+ raise
1867
1871
  return []
1868
1872
 
1869
1873
  peers: list[MeshPeer] = []
@@ -1882,7 +1886,7 @@ class MobiusDevice:
1882
1886
  ))
1883
1887
  return peers
1884
1888
 
1885
- async def discover_networked_thread_devices(self) -> list[MeshPeer]:
1889
+ async def discover_networked_thread_devices(self, raise_errors: bool = False) -> list[MeshPeer]:
1886
1890
  """
1887
1891
  Every device on this device's Thread mesh, including itself, from
1888
1892
  MLPrefix (2128) and NetworkedThreadDevices (1001). Supported more
@@ -1896,7 +1900,8 @@ class MobiusDevice:
1896
1900
  12-13 model id, i16 LE
1897
1901
  14-27 serial, ASCII
1898
1902
  Empty slots are all zeros and are skipped, as are entries of any
1899
- other length. Returns [] on any failure.
1903
+ other length. Returns [] on any failure, or raises it with
1904
+ raise_errors=True.
1900
1905
  """
1901
1906
  try:
1902
1907
  mlprefix_raw = await self.get_attribute(C2Attribute.MLPrefix)
@@ -1904,8 +1909,15 @@ class MobiusDevice:
1904
1909
  C2Attribute.NetworkedThreadDevices, index=0, count=ALL_ELEMENTS,
1905
1910
  )
1906
1911
  except Exception:
1912
+ if raise_errors:
1913
+ raise
1907
1914
  return []
1908
1915
  if not mlprefix_raw or len(mlprefix_raw[0]) != 24:
1916
+ if raise_errors:
1917
+ raise IOError(
1918
+ f"unexpected MLPrefix: {mlprefix_raw[0].hex() if mlprefix_raw else 'empty'} "
1919
+ f"(expected 24 bytes)"
1920
+ )
1909
1921
  return []
1910
1922
  prefix = mesh_local_prefix_from_mlprefix(mlprefix_raw[0])
1911
1923
 
@@ -1928,18 +1940,35 @@ class MobiusDevice:
1928
1940
  ))
1929
1941
  return peers
1930
1942
 
1931
- async def discover_mesh_peers_auto(self) -> list[MeshPeer]:
1943
+ async def discover_mesh_peers_auto(self, raise_errors: bool = False) -> list[MeshPeer]:
1932
1944
  """
1933
1945
  discover_networked_thread_devices(), falling back to
1934
1946
  discover_mesh_peers() when it finds nothing. The recommended entry
1935
1947
  point. mobius.discovery.discover_mesh_peers_via_direct_connect() is
1936
1948
  the remaining fallback, but it needs scan results and has to be
1937
1949
  called explicitly.
1950
+
1951
+ raise_errors=True: a failure raises instead of looking like an
1952
+ empty mesh. The fallback is then only tried when
1953
+ NetworkedThreadDevices can't be read (an MXM hub), and the error
1954
+ raised names both attempts.
1938
1955
  """
1939
- peers = await self.discover_networked_thread_devices()
1940
- if peers:
1941
- return peers
1942
- return await self.discover_mesh_peers()
1956
+ if not raise_errors:
1957
+ peers = await self.discover_networked_thread_devices()
1958
+ if peers:
1959
+ return peers
1960
+ return await self.discover_mesh_peers()
1961
+
1962
+ try:
1963
+ return await self.discover_networked_thread_devices(raise_errors=True)
1964
+ except Exception as networked_error:
1965
+ try:
1966
+ return await self.discover_mesh_peers(raise_errors=True)
1967
+ except Exception as arrays_error:
1968
+ raise IOError(
1969
+ f"NetworkedThreadDevices: {networked_error or type(networked_error).__name__}; "
1970
+ f"peer arrays: {arrays_error or type(arrays_error).__name__}"
1971
+ ) from networked_error
1943
1972
 
1944
1973
  async def get_firmware_versions(self, model: Optional[Model] = None) -> dict:
1945
1974
  """{label: version} for every firmware component (FirmwareVersion,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: python-mobius
3
- Version: 0.10.1
3
+ Version: 0.10.2
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
@@ -1,10 +1,10 @@
1
- mobius/__init__.py,sha256=eObxukBi0TREh8e0TD74L5CzOxSma-dPaj9YAB_8QAc,8555
1
+ mobius/__init__.py,sha256=ownwnGpQ6cybzgLY8bzjmBG4D7JOQ1bw_m9hMPMdvA8,8555
2
2
  mobius/checksums.py,sha256=PB9RqvaZu9AqfT6tU6NI2qbbZXrqaHUnow3Qi_6UFHs,5191
3
3
  mobius/cli.py,sha256=tyft0SzbuLgbmzps-Ym1hCzcr6A9D5MsALkg6o4ynBs,57876
4
4
  mobius/coap.py,sha256=-XV3kI4q-JoL8r0oLFNnHAdZAc_yUP-aICagKh-qbf4,4862
5
5
  mobius/constants.py,sha256=pcG9Su_b81pmMA_GxR41lZz9UM9BjtV0T6nuslMICko,41138
6
6
  mobius/crc.py,sha256=LOCHZe3a1UnR5thdpZ4S4SFP8BdmoMEnhDNiNMd0iJI,2508
7
- mobius/device.py,sha256=tY4vSTiqHExwgfxQA2Z8FOGWS5RMUn1Zq6HAp0mdk-E,131600
7
+ mobius/device.py,sha256=1awCx8TIzSFHHEnkGMbuItbpQtAt1DINdmSnLJqENWI,133014
8
8
  mobius/device_status.py,sha256=XclYijAknrgT8SdSW4XvyBemWHUQqw6UPE4tmwq6Yug,15658
9
9
  mobius/discovery.py,sha256=poNeXGekB44cpHOFbGyps9d4mwW_hJptmJODwSMTUSg,7176
10
10
  mobius/dump.py,sha256=eQBYoi8J6CxRd2ojgWK5QoB8z416oywLRTBnnh0pLwo,9253
@@ -19,8 +19,8 @@ mobius/relay.py,sha256=trGkWQSarwURF05gXHeb5jTJ9UvWbQGu8NarEP6sRqE,10107
19
19
  mobius/scenes.py,sha256=VLfDdTKSv3qTsBt2bJGg8iPtUkfNEmNgu0TTtYT6jJE,4274
20
20
  mobius/schedule.py,sha256=si9uJdYOj5vh6owuxxMyMyZRY0-tAmCPt3s6ROAeRww,13243
21
21
  mobius/timezone.py,sha256=Q7oPKtCdEYcEHXLx4lt-VPq6KH-MNgQwVnDtIXJV-kQ,2267
22
- python_mobius-0.10.1.dist-info/METADATA,sha256=B1lQHhsAB0OH_ViOqQChhl4_zJ1o496C73dFM8Cc8t4,5829
23
- python_mobius-0.10.1.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
24
- python_mobius-0.10.1.dist-info/entry_points.txt,sha256=Q2hlcek-bWm70zvd12v32essflPgC2su-dKDHAqbPoE,48
25
- python_mobius-0.10.1.dist-info/licenses/LICENSE,sha256=7a72Msu2Q-TnoiFxemxEGkwafJGObk1W3rw9hzmyM_Y,17984
26
- python_mobius-0.10.1.dist-info/RECORD,,
22
+ python_mobius-0.10.2.dist-info/METADATA,sha256=O31L0MYu8ryhtqYYdQoXfTE9B23dqI4H2OJrWVH5EZI,5829
23
+ python_mobius-0.10.2.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
24
+ python_mobius-0.10.2.dist-info/entry_points.txt,sha256=Q2hlcek-bWm70zvd12v32essflPgC2su-dKDHAqbPoE,48
25
+ python_mobius-0.10.2.dist-info/licenses/LICENSE,sha256=7a72Msu2Q-TnoiFxemxEGkwafJGObk1W3rw9hzmyM_Y,17984
26
+ python_mobius-0.10.2.dist-info/RECORD,,