python-mobius 0.10.0__py3-none-any.whl → 0.10.1__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 +1 -1
- mobius/device.py +52 -54
- {python_mobius-0.10.0.dist-info → python_mobius-0.10.1.dist-info}/METADATA +1 -1
- {python_mobius-0.10.0.dist-info → python_mobius-0.10.1.dist-info}/RECORD +7 -7
- {python_mobius-0.10.0.dist-info → python_mobius-0.10.1.dist-info}/WHEEL +0 -0
- {python_mobius-0.10.0.dist-info → python_mobius-0.10.1.dist-info}/entry_points.txt +0 -0
- {python_mobius-0.10.0.dist-info → python_mobius-0.10.1.dist-info}/licenses/LICENSE +0 -0
mobius/__init__.py
CHANGED
mobius/device.py
CHANGED
|
@@ -169,26 +169,18 @@ def _schedule_checksum_attr(which: int) -> C2Attribute:
|
|
|
169
169
|
return C2Attribute.Schedule1Checksum if which == 1 else C2Attribute.Schedule2Checksum
|
|
170
170
|
|
|
171
171
|
|
|
172
|
-
def
|
|
172
|
+
def _configuration_checksum_requests(
|
|
173
173
|
configuration: tuple, cache: Optional[ConfigurationCache], supported_attribute_ids: set,
|
|
174
|
-
) ->
|
|
175
|
-
"""
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
if checksum_usable and data_attr in cache.entries:
|
|
185
|
-
requests.append((checksum_attr, 0, 1))
|
|
186
|
-
continue
|
|
187
|
-
requests.append((data_attr, 0, ALL_ELEMENTS))
|
|
188
|
-
data_read.add(data_attr)
|
|
189
|
-
if checksum_usable:
|
|
190
|
-
requests.append((checksum_attr, 0, 1))
|
|
191
|
-
return requests, data_read
|
|
174
|
+
) -> list:
|
|
175
|
+
"""The checksum request of each (data attribute, checksum attribute) of
|
|
176
|
+
`configuration` that the cache can use. The data itself is never part
|
|
177
|
+
of the poll batch (see _read_configuration())."""
|
|
178
|
+
if cache is None:
|
|
179
|
+
return []
|
|
180
|
+
return [
|
|
181
|
+
(checksum_attr, 0, 1) for _data_attr, checksum_attr in configuration
|
|
182
|
+
if checksum_attr in supported_attribute_ids
|
|
183
|
+
]
|
|
192
184
|
|
|
193
185
|
|
|
194
186
|
def _apply_static_cache(cache: ConfigurationCache, by_attr_id: dict, static_read: bool) -> None:
|
|
@@ -2506,10 +2498,12 @@ class MobiusDevice:
|
|
|
2506
2498
|
get_device_info(), get_metadata_batch() and
|
|
2507
2499
|
get_light_poll_batch() or get_pump_schedule()/get_pump_telemetry().
|
|
2508
2500
|
|
|
2509
|
-
|
|
2510
|
-
the
|
|
2511
|
-
|
|
2512
|
-
|
|
2501
|
+
The schedule and ConfiguredScenes are read in requests of their
|
|
2502
|
+
own after the batch, as the app does: combined with the rest, a
|
|
2503
|
+
light's reply is too large to be relayed. `cache` (one per device,
|
|
2504
|
+
kept by the caller): they are then read only when their checksum,
|
|
2505
|
+
part of the batch, changed since the previous poll (see
|
|
2506
|
+
ConfigurationCache). With its static_refresh_interval
|
|
2513
2507
|
set, the STATIC_POLL_ATTRIBUTES are also read only that often.
|
|
2514
2508
|
Used by the batched path only.
|
|
2515
2509
|
"""
|
|
@@ -2537,7 +2531,7 @@ class MobiusDevice:
|
|
|
2537
2531
|
(schedule_attr, _schedule_checksum_attr(which)),
|
|
2538
2532
|
(C2Attribute.ConfiguredScenes, C2Attribute.ConfiguredScenesChecksum),
|
|
2539
2533
|
)
|
|
2540
|
-
configuration_requests
|
|
2534
|
+
configuration_requests = _configuration_checksum_requests(configuration, cache, supported_attribute_ids)
|
|
2541
2535
|
if cache is not None:
|
|
2542
2536
|
configuration_requests.append((C2Attribute.SupportedAttributesCRC, 0, 1))
|
|
2543
2537
|
requests = _DEVICE_INFO_REQUESTS + _METADATA_REQUESTS + configuration_requests + [
|
|
@@ -2558,9 +2552,7 @@ class MobiusDevice:
|
|
|
2558
2552
|
)
|
|
2559
2553
|
if attribute_table_changed:
|
|
2560
2554
|
cache.invalidate_static()
|
|
2561
|
-
|
|
2562
|
-
by_attr_id, cache, configuration, data_read, supported_attribute_ids,
|
|
2563
|
-
)
|
|
2555
|
+
data_read = await self._read_configuration(by_attr_id, cache, configuration, supported_attribute_ids)
|
|
2564
2556
|
|
|
2565
2557
|
def first(attr_id, index=0):
|
|
2566
2558
|
return _first_value(by_attr_id, attr_id, index)
|
|
@@ -2621,38 +2613,44 @@ class MobiusDevice:
|
|
|
2621
2613
|
static_read=static_read,
|
|
2622
2614
|
)
|
|
2623
2615
|
|
|
2624
|
-
async def
|
|
2625
|
-
self, by_attr_id: dict, cache: ConfigurationCache,
|
|
2626
|
-
configuration: tuple,
|
|
2616
|
+
async def _read_configuration(
|
|
2617
|
+
self, by_attr_id: dict, cache: Optional[ConfigurationCache],
|
|
2618
|
+
configuration: tuple, supported_attribute_ids: set,
|
|
2627
2619
|
) -> set:
|
|
2628
2620
|
"""
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2621
|
+
Fills each data attribute of `configuration` (the schedule, the
|
|
2622
|
+
scenes) into `by_attr_id`: from `cache` when the checksum in the
|
|
2623
|
+
poll batch matches the cached one, else with a request of its own
|
|
2624
|
+
(plus its checksum, stored in the cache with it). Returns the
|
|
2625
|
+
attributes read.
|
|
2626
|
+
|
|
2627
|
+
Each gets its own request, as in the app: a light's schedule or
|
|
2628
|
+
scenes alone are close to the largest reply a relay carries, and
|
|
2629
|
+
together with the rest of the poll a relayed reply is too large
|
|
2630
|
+
and never arrives.
|
|
2632
2631
|
"""
|
|
2633
|
-
|
|
2632
|
+
read = set()
|
|
2634
2633
|
for data_attr, checksum_attr in configuration:
|
|
2635
|
-
if data_attr not in supported_attribute_ids
|
|
2636
|
-
continue
|
|
2637
|
-
reported = _unpack(_first_value(by_attr_id, checksum_attr), "<H")
|
|
2638
|
-
if data_attr in data_read:
|
|
2639
|
-
_store_configuration(cache, data_attr, reported, by_attr_id)
|
|
2634
|
+
if data_attr not in supported_attribute_ids:
|
|
2640
2635
|
continue
|
|
2641
|
-
|
|
2642
|
-
if
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2636
|
+
checksum_usable = cache is not None and checksum_attr in supported_attribute_ids
|
|
2637
|
+
if checksum_usable:
|
|
2638
|
+
reported = _unpack(_first_value(by_attr_id, checksum_attr), "<H")
|
|
2639
|
+
cached = cache.entries.get(data_attr)
|
|
2640
|
+
if cached is not None and reported is not None and reported == cached[0]:
|
|
2641
|
+
by_attr_id[data_attr] = cached[1]
|
|
2642
|
+
continue
|
|
2643
|
+
requests = [(data_attr, 0, ALL_ELEMENTS)]
|
|
2644
|
+
if checksum_usable:
|
|
2645
|
+
requests.append((checksum_attr, 0, 1))
|
|
2646
|
+
response = await self._read_supported_batch(requests, supported_attribute_ids)
|
|
2647
|
+
by_attr_id[data_attr] = response.get(int(data_attr), [])
|
|
2648
|
+
if checksum_usable:
|
|
2649
|
+
_store_configuration(
|
|
2650
|
+
cache, data_attr, _unpack(_first_value(response, checksum_attr), "<H"), response,
|
|
2651
|
+
)
|
|
2652
|
+
read.add(data_attr)
|
|
2653
|
+
return read
|
|
2656
2654
|
|
|
2657
2655
|
async def _get_full_poll_via_individual_reads(
|
|
2658
2656
|
self, primitive: PrimitiveType, model: Optional[Model],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: python-mobius
|
|
3
|
-
Version: 0.10.
|
|
3
|
+
Version: 0.10.1
|
|
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=
|
|
1
|
+
mobius/__init__.py,sha256=eObxukBi0TREh8e0TD74L5CzOxSma-dPaj9YAB_8QAc,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=
|
|
7
|
+
mobius/device.py,sha256=tY4vSTiqHExwgfxQA2Z8FOGWS5RMUn1Zq6HAp0mdk-E,131600
|
|
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.
|
|
23
|
-
python_mobius-0.10.
|
|
24
|
-
python_mobius-0.10.
|
|
25
|
-
python_mobius-0.10.
|
|
26
|
-
python_mobius-0.10.
|
|
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,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|