aiohomematic 2025.10.0__py3-none-any.whl → 2025.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.
Potentially problematic release.
This version of aiohomematic might be problematic. Click here for more details.
- aiohomematic/async_support.py +7 -7
- aiohomematic/caches/dynamic.py +31 -26
- aiohomematic/caches/persistent.py +34 -32
- aiohomematic/caches/visibility.py +19 -7
- aiohomematic/central/__init__.py +90 -74
- aiohomematic/central/decorators.py +2 -2
- aiohomematic/central/xml_rpc_server.py +27 -24
- aiohomematic/client/__init__.py +72 -56
- aiohomematic/client/_rpc_errors.py +3 -3
- aiohomematic/client/json_rpc.py +33 -25
- aiohomematic/client/xml_rpc.py +14 -9
- aiohomematic/const.py +3 -1
- aiohomematic/converter.py +19 -19
- aiohomematic/exceptions.py +2 -1
- aiohomematic/model/__init__.py +4 -3
- aiohomematic/model/calculated/__init__.py +1 -1
- aiohomematic/model/calculated/climate.py +9 -9
- aiohomematic/model/calculated/data_point.py +13 -7
- aiohomematic/model/calculated/operating_voltage_level.py +2 -2
- aiohomematic/model/calculated/support.py +7 -7
- aiohomematic/model/custom/__init__.py +3 -3
- aiohomematic/model/custom/climate.py +57 -34
- aiohomematic/model/custom/cover.py +44 -20
- aiohomematic/model/custom/data_point.py +9 -7
- aiohomematic/model/custom/definition.py +23 -17
- aiohomematic/model/custom/light.py +52 -23
- aiohomematic/model/custom/lock.py +16 -12
- aiohomematic/model/custom/siren.py +6 -3
- aiohomematic/model/custom/switch.py +3 -2
- aiohomematic/model/custom/valve.py +3 -2
- aiohomematic/model/data_point.py +62 -49
- aiohomematic/model/device.py +48 -42
- aiohomematic/model/event.py +6 -5
- aiohomematic/model/generic/__init__.py +6 -4
- aiohomematic/model/generic/action.py +1 -1
- aiohomematic/model/generic/data_point.py +7 -5
- aiohomematic/model/generic/number.py +3 -3
- aiohomematic/model/generic/select.py +1 -1
- aiohomematic/model/generic/sensor.py +2 -2
- aiohomematic/model/generic/switch.py +3 -3
- aiohomematic/model/hub/__init__.py +17 -16
- aiohomematic/model/hub/data_point.py +12 -7
- aiohomematic/model/hub/number.py +3 -3
- aiohomematic/model/hub/select.py +3 -3
- aiohomematic/model/hub/text.py +2 -2
- aiohomematic/model/support.py +8 -7
- aiohomematic/model/update.py +6 -6
- aiohomematic/support.py +44 -38
- aiohomematic/validator.py +6 -6
- {aiohomematic-2025.10.0.dist-info → aiohomematic-2025.10.2.dist-info}/METADATA +1 -1
- aiohomematic-2025.10.2.dist-info/RECORD +78 -0
- aiohomematic_support/client_local.py +19 -12
- aiohomematic-2025.10.0.dist-info/RECORD +0 -78
- {aiohomematic-2025.10.0.dist-info → aiohomematic-2025.10.2.dist-info}/WHEEL +0 -0
- {aiohomematic-2025.10.0.dist-info → aiohomematic-2025.10.2.dist-info}/licenses/LICENSE +0 -0
- {aiohomematic-2025.10.0.dist-info → aiohomematic-2025.10.2.dist-info}/top_level.txt +0 -0
|
@@ -100,6 +100,7 @@ class CustomDpCover(CustomDataPoint):
|
|
|
100
100
|
"_dp_group_level",
|
|
101
101
|
"_dp_level",
|
|
102
102
|
"_dp_stop",
|
|
103
|
+
"_use_group_channel_for_cover_state",
|
|
103
104
|
)
|
|
104
105
|
_category = DataPointCategory.COVER
|
|
105
106
|
_closed_level: float = _CLOSED_LEVEL
|
|
@@ -118,11 +119,16 @@ class CustomDpCover(CustomDataPoint):
|
|
|
118
119
|
self._dp_group_level: DpSensor[float | None] = self._get_data_point(
|
|
119
120
|
field=Field.GROUP_LEVEL, data_point_type=DpSensor[float | None]
|
|
120
121
|
)
|
|
122
|
+
self._use_group_channel_for_cover_state = self.central.config.use_group_channel_for_cover_state
|
|
121
123
|
|
|
122
124
|
@property
|
|
123
125
|
def _group_level(self) -> float:
|
|
124
126
|
"""Return the channel level of the cover."""
|
|
125
|
-
if
|
|
127
|
+
if (
|
|
128
|
+
self._use_group_channel_for_cover_state
|
|
129
|
+
and self._dp_group_level.value is not None
|
|
130
|
+
and self.usage == DataPointUsage.CDP_PRIMARY
|
|
131
|
+
):
|
|
126
132
|
return float(self._dp_group_level.value)
|
|
127
133
|
return self._dp_level.value if self._dp_level.value is not None else self._closed_level
|
|
128
134
|
|
|
@@ -143,6 +149,7 @@ class CustomDpCover(CustomDataPoint):
|
|
|
143
149
|
@bind_collector()
|
|
144
150
|
async def set_position(
|
|
145
151
|
self,
|
|
152
|
+
*,
|
|
146
153
|
position: int | None = None,
|
|
147
154
|
tilt_position: int | None = None,
|
|
148
155
|
collector: CallParameterCollector | None = None,
|
|
@@ -159,6 +166,7 @@ class CustomDpCover(CustomDataPoint):
|
|
|
159
166
|
|
|
160
167
|
async def _set_level(
|
|
161
168
|
self,
|
|
169
|
+
*,
|
|
162
170
|
level: float | None = None,
|
|
163
171
|
tilt_level: float | None = None,
|
|
164
172
|
collector: CallParameterCollector | None = None,
|
|
@@ -188,21 +196,21 @@ class CustomDpCover(CustomDataPoint):
|
|
|
188
196
|
return None
|
|
189
197
|
|
|
190
198
|
@bind_collector()
|
|
191
|
-
async def open(self, collector: CallParameterCollector | None = None) -> None:
|
|
199
|
+
async def open(self, *, collector: CallParameterCollector | None = None) -> None:
|
|
192
200
|
"""Open the cover."""
|
|
193
201
|
if not self.is_state_change(open=True):
|
|
194
202
|
return
|
|
195
203
|
await self._set_level(level=self._open_level, collector=collector)
|
|
196
204
|
|
|
197
205
|
@bind_collector()
|
|
198
|
-
async def close(self, collector: CallParameterCollector | None = None) -> None:
|
|
206
|
+
async def close(self, *, collector: CallParameterCollector | None = None) -> None:
|
|
199
207
|
"""Close the cover."""
|
|
200
208
|
if not self.is_state_change(close=True):
|
|
201
209
|
return
|
|
202
210
|
await self._set_level(level=self._closed_level, collector=collector)
|
|
203
211
|
|
|
204
212
|
@bind_collector(enabled=False)
|
|
205
|
-
async def stop(self, collector: CallParameterCollector | None = None) -> None:
|
|
213
|
+
async def stop(self, *, collector: CallParameterCollector | None = None) -> None:
|
|
206
214
|
"""Stop the device if in motion."""
|
|
207
215
|
await self._dp_stop.send_value(value=True, collector=collector)
|
|
208
216
|
|
|
@@ -237,6 +245,7 @@ class CustomDpWindowDrive(CustomDpCover):
|
|
|
237
245
|
|
|
238
246
|
async def _set_level(
|
|
239
247
|
self,
|
|
248
|
+
*,
|
|
240
249
|
level: float | None = None,
|
|
241
250
|
tilt_level: float | None = None,
|
|
242
251
|
collector: CallParameterCollector | None = None,
|
|
@@ -276,7 +285,11 @@ class CustomDpBlind(CustomDpCover):
|
|
|
276
285
|
@property
|
|
277
286
|
def _group_tilt_level(self) -> float:
|
|
278
287
|
"""Return the group level of the tilt."""
|
|
279
|
-
if
|
|
288
|
+
if (
|
|
289
|
+
self._use_group_channel_for_cover_state
|
|
290
|
+
and self._dp_group_level_2.value is not None
|
|
291
|
+
and self.usage == DataPointUsage.CDP_PRIMARY
|
|
292
|
+
):
|
|
280
293
|
return float(self._dp_group_level_2.value)
|
|
281
294
|
return self._dp_level_2.value if self._dp_level_2.value is not None else self._closed_level
|
|
282
295
|
|
|
@@ -311,6 +324,7 @@ class CustomDpBlind(CustomDpCover):
|
|
|
311
324
|
@bind_collector(enabled=False)
|
|
312
325
|
async def set_position(
|
|
313
326
|
self,
|
|
327
|
+
*,
|
|
314
328
|
position: int | None = None,
|
|
315
329
|
tilt_position: int | None = None,
|
|
316
330
|
collector: CallParameterCollector | None = None,
|
|
@@ -332,6 +346,7 @@ class CustomDpBlind(CustomDpCover):
|
|
|
332
346
|
|
|
333
347
|
async def _set_level(
|
|
334
348
|
self,
|
|
349
|
+
*,
|
|
335
350
|
level: float | None = None,
|
|
336
351
|
tilt_level: float | None = None,
|
|
337
352
|
collector: CallParameterCollector | None = None,
|
|
@@ -382,6 +397,7 @@ class CustomDpBlind(CustomDpCover):
|
|
|
382
397
|
@bind_collector()
|
|
383
398
|
async def _send_level(
|
|
384
399
|
self,
|
|
400
|
+
*,
|
|
385
401
|
level: float,
|
|
386
402
|
tilt_level: float,
|
|
387
403
|
collector: CallParameterCollector | None = None,
|
|
@@ -398,7 +414,7 @@ class CustomDpBlind(CustomDpCover):
|
|
|
398
414
|
await super()._set_level(level=level, collector=collector)
|
|
399
415
|
|
|
400
416
|
@bind_collector(enabled=False)
|
|
401
|
-
async def open(self, collector: CallParameterCollector | None = None) -> None:
|
|
417
|
+
async def open(self, *, collector: CallParameterCollector | None = None) -> None:
|
|
402
418
|
"""Open the cover and open the tilt."""
|
|
403
419
|
if not self.is_state_change(open=True, tilt_open=True):
|
|
404
420
|
return
|
|
@@ -409,7 +425,7 @@ class CustomDpBlind(CustomDpCover):
|
|
|
409
425
|
)
|
|
410
426
|
|
|
411
427
|
@bind_collector(enabled=False)
|
|
412
|
-
async def close(self, collector: CallParameterCollector | None = None) -> None:
|
|
428
|
+
async def close(self, *, collector: CallParameterCollector | None = None) -> None:
|
|
413
429
|
"""Close the cover and close the tilt."""
|
|
414
430
|
if not self.is_state_change(close=True, tilt_close=True):
|
|
415
431
|
return
|
|
@@ -420,7 +436,7 @@ class CustomDpBlind(CustomDpCover):
|
|
|
420
436
|
)
|
|
421
437
|
|
|
422
438
|
@bind_collector(enabled=False)
|
|
423
|
-
async def stop(self, collector: CallParameterCollector | None = None) -> None:
|
|
439
|
+
async def stop(self, *, collector: CallParameterCollector | None = None) -> None:
|
|
424
440
|
"""Stop the device if in motion."""
|
|
425
441
|
try:
|
|
426
442
|
acquired: bool = await asyncio.wait_for(
|
|
@@ -436,26 +452,26 @@ class CustomDpBlind(CustomDpCover):
|
|
|
436
452
|
self._command_processing_lock.release()
|
|
437
453
|
|
|
438
454
|
@bind_collector(enabled=False)
|
|
439
|
-
async def _stop(self, collector: CallParameterCollector | None = None) -> None:
|
|
455
|
+
async def _stop(self, *, collector: CallParameterCollector | None = None) -> None:
|
|
440
456
|
"""Stop the device if in motion. Do only call with _command_processing_lock held."""
|
|
441
457
|
await super().stop(collector=collector)
|
|
442
458
|
|
|
443
459
|
@bind_collector(enabled=False)
|
|
444
|
-
async def open_tilt(self, collector: CallParameterCollector | None = None) -> None:
|
|
460
|
+
async def open_tilt(self, *, collector: CallParameterCollector | None = None) -> None:
|
|
445
461
|
"""Open the tilt."""
|
|
446
462
|
if not self.is_state_change(tilt_open=True):
|
|
447
463
|
return
|
|
448
464
|
await self._set_level(tilt_level=self._open_tilt_level, collector=collector)
|
|
449
465
|
|
|
450
466
|
@bind_collector(enabled=False)
|
|
451
|
-
async def close_tilt(self, collector: CallParameterCollector | None = None) -> None:
|
|
467
|
+
async def close_tilt(self, *, collector: CallParameterCollector | None = None) -> None:
|
|
452
468
|
"""Close the tilt."""
|
|
453
469
|
if not self.is_state_change(tilt_close=True):
|
|
454
470
|
return
|
|
455
471
|
await self._set_level(tilt_level=self._closed_level, collector=collector)
|
|
456
472
|
|
|
457
473
|
@bind_collector(enabled=False)
|
|
458
|
-
async def stop_tilt(self, collector: CallParameterCollector | None = None) -> None:
|
|
474
|
+
async def stop_tilt(self, *, collector: CallParameterCollector | None = None) -> None:
|
|
459
475
|
"""Stop the device if in motion. Use only when command_processing_lock is held."""
|
|
460
476
|
await self.stop(collector=collector)
|
|
461
477
|
|
|
@@ -471,16 +487,16 @@ class CustomDpBlind(CustomDpCover):
|
|
|
471
487
|
return True
|
|
472
488
|
return super().is_state_change(**kwargs)
|
|
473
489
|
|
|
474
|
-
def _get_combined_value(self, level: float | None = None, tilt_level: float | None = None) -> str | None:
|
|
490
|
+
def _get_combined_value(self, *, level: float | None = None, tilt_level: float | None = None) -> str | None:
|
|
475
491
|
"""Return the combined parameter."""
|
|
476
492
|
if level is None and tilt_level is None:
|
|
477
493
|
return None
|
|
478
494
|
levels: list[str] = []
|
|
479
495
|
# the resulting hex value is based on the doubled position
|
|
480
496
|
if level is not None:
|
|
481
|
-
levels.append(convert_hm_level_to_cpv(
|
|
497
|
+
levels.append(convert_hm_level_to_cpv(value=level))
|
|
482
498
|
if tilt_level is not None:
|
|
483
|
-
levels.append(convert_hm_level_to_cpv(
|
|
499
|
+
levels.append(convert_hm_level_to_cpv(value=tilt_level))
|
|
484
500
|
|
|
485
501
|
if levels:
|
|
486
502
|
return ",".join(levels)
|
|
@@ -503,7 +519,7 @@ class CustomDpIpBlind(CustomDpBlind):
|
|
|
503
519
|
"""Return operation mode of cover."""
|
|
504
520
|
return self._dp_operation_mode.value
|
|
505
521
|
|
|
506
|
-
def _get_combined_value(self, level: float | None = None, tilt_level: float | None = None) -> str | None:
|
|
522
|
+
def _get_combined_value(self, *, level: float | None = None, tilt_level: float | None = None) -> str | None:
|
|
507
523
|
"""Return the combined parameter."""
|
|
508
524
|
if level is None and tilt_level is None:
|
|
509
525
|
return None
|
|
@@ -553,6 +569,7 @@ class CustomDpGarage(CustomDataPoint):
|
|
|
553
569
|
@bind_collector()
|
|
554
570
|
async def set_position(
|
|
555
571
|
self,
|
|
572
|
+
*,
|
|
556
573
|
position: int | None = None,
|
|
557
574
|
tilt_position: int | None = None,
|
|
558
575
|
collector: CallParameterCollector | None = None,
|
|
@@ -589,26 +606,26 @@ class CustomDpGarage(CustomDataPoint):
|
|
|
589
606
|
return None
|
|
590
607
|
|
|
591
608
|
@bind_collector()
|
|
592
|
-
async def open(self, collector: CallParameterCollector | None = None) -> None:
|
|
609
|
+
async def open(self, *, collector: CallParameterCollector | None = None) -> None:
|
|
593
610
|
"""Open the garage door."""
|
|
594
611
|
if not self.is_state_change(open=True):
|
|
595
612
|
return
|
|
596
613
|
await self._dp_door_command.send_value(value=_GarageDoorCommand.OPEN, collector=collector)
|
|
597
614
|
|
|
598
615
|
@bind_collector()
|
|
599
|
-
async def close(self, collector: CallParameterCollector | None = None) -> None:
|
|
616
|
+
async def close(self, *, collector: CallParameterCollector | None = None) -> None:
|
|
600
617
|
"""Close the garage door."""
|
|
601
618
|
if not self.is_state_change(close=True):
|
|
602
619
|
return
|
|
603
620
|
await self._dp_door_command.send_value(value=_GarageDoorCommand.CLOSE, collector=collector)
|
|
604
621
|
|
|
605
622
|
@bind_collector(enabled=False)
|
|
606
|
-
async def stop(self, collector: CallParameterCollector | None = None) -> None:
|
|
623
|
+
async def stop(self, *, collector: CallParameterCollector | None = None) -> None:
|
|
607
624
|
"""Stop the device if in motion."""
|
|
608
625
|
await self._dp_door_command.send_value(value=_GarageDoorCommand.STOP, collector=collector)
|
|
609
626
|
|
|
610
627
|
@bind_collector()
|
|
611
|
-
async def vent(self, collector: CallParameterCollector | None = None) -> None:
|
|
628
|
+
async def vent(self, *, collector: CallParameterCollector | None = None) -> None:
|
|
612
629
|
"""Move the garage door to vent position."""
|
|
613
630
|
if not self.is_state_change(vent=True):
|
|
614
631
|
return
|
|
@@ -626,6 +643,7 @@ class CustomDpGarage(CustomDataPoint):
|
|
|
626
643
|
|
|
627
644
|
|
|
628
645
|
def make_ip_cover(
|
|
646
|
+
*,
|
|
629
647
|
channel: hmd.Channel,
|
|
630
648
|
custom_config: CustomConfig,
|
|
631
649
|
) -> None:
|
|
@@ -639,6 +657,7 @@ def make_ip_cover(
|
|
|
639
657
|
|
|
640
658
|
|
|
641
659
|
def make_rf_cover(
|
|
660
|
+
*,
|
|
642
661
|
channel: hmd.Channel,
|
|
643
662
|
custom_config: CustomConfig,
|
|
644
663
|
) -> None:
|
|
@@ -652,6 +671,7 @@ def make_rf_cover(
|
|
|
652
671
|
|
|
653
672
|
|
|
654
673
|
def make_ip_blind(
|
|
674
|
+
*,
|
|
655
675
|
channel: hmd.Channel,
|
|
656
676
|
custom_config: CustomConfig,
|
|
657
677
|
) -> None:
|
|
@@ -665,6 +685,7 @@ def make_ip_blind(
|
|
|
665
685
|
|
|
666
686
|
|
|
667
687
|
def make_ip_garage(
|
|
688
|
+
*,
|
|
668
689
|
channel: hmd.Channel,
|
|
669
690
|
custom_config: CustomConfig,
|
|
670
691
|
) -> None:
|
|
@@ -678,6 +699,7 @@ def make_ip_garage(
|
|
|
678
699
|
|
|
679
700
|
|
|
680
701
|
def make_ip_hdm(
|
|
702
|
+
*,
|
|
681
703
|
channel: hmd.Channel,
|
|
682
704
|
custom_config: CustomConfig,
|
|
683
705
|
) -> None:
|
|
@@ -691,6 +713,7 @@ def make_ip_hdm(
|
|
|
691
713
|
|
|
692
714
|
|
|
693
715
|
def make_rf_blind(
|
|
716
|
+
*,
|
|
694
717
|
channel: hmd.Channel,
|
|
695
718
|
custom_config: CustomConfig,
|
|
696
719
|
) -> None:
|
|
@@ -704,6 +727,7 @@ def make_rf_blind(
|
|
|
704
727
|
|
|
705
728
|
|
|
706
729
|
def make_rf_window_drive(
|
|
730
|
+
*,
|
|
707
731
|
channel: hmd.Channel,
|
|
708
732
|
custom_config: CustomConfig,
|
|
709
733
|
) -> None:
|
|
@@ -46,6 +46,7 @@ class CustomDataPoint(BaseDataPoint):
|
|
|
46
46
|
|
|
47
47
|
def __init__(
|
|
48
48
|
self,
|
|
49
|
+
*,
|
|
49
50
|
channel: hmd.Channel,
|
|
50
51
|
unique_id: str,
|
|
51
52
|
device_profile: DeviceProfile,
|
|
@@ -183,7 +184,7 @@ class CustomDataPoint(BaseDataPoint):
|
|
|
183
184
|
"""Return the signature of the data_point."""
|
|
184
185
|
return f"{self._category}/{self._channel.device.model}/{self.data_point_name_postfix}"
|
|
185
186
|
|
|
186
|
-
async def load_data_point_value(self, call_source: CallSource, direct_call: bool = False) -> None:
|
|
187
|
+
async def load_data_point_value(self, *, call_source: CallSource, direct_call: bool = False) -> None:
|
|
187
188
|
"""Init the data point values."""
|
|
188
189
|
for dp in self._readable_data_points:
|
|
189
190
|
await dp.load_data_point_value(call_source=call_source, direct_call=direct_call)
|
|
@@ -242,7 +243,7 @@ class CustomDataPoint(BaseDataPoint):
|
|
|
242
243
|
if hmed.get_include_default_data_points(device_profile=self._device_profile):
|
|
243
244
|
self._mark_data_points(custom_data_point_def=hmed.get_default_data_points())
|
|
244
245
|
|
|
245
|
-
def _add_data_points(self, field_dict_name: hmed.CDPD, is_visible: bool | None = None) -> None:
|
|
246
|
+
def _add_data_points(self, *, field_dict_name: hmed.CDPD, is_visible: bool | None = None) -> None:
|
|
246
247
|
"""Add data points to custom data point."""
|
|
247
248
|
fields = self._device_def.get(field_dict_name, {})
|
|
248
249
|
for channel_no, channel in fields.items():
|
|
@@ -253,6 +254,7 @@ class CustomDataPoint(BaseDataPoint):
|
|
|
253
254
|
|
|
254
255
|
def _add_data_point(
|
|
255
256
|
self,
|
|
257
|
+
*,
|
|
256
258
|
field: Field,
|
|
257
259
|
data_point: hmge.GenericDataPoint | None,
|
|
258
260
|
is_visible: bool | None = None,
|
|
@@ -270,7 +272,7 @@ class CustomDataPoint(BaseDataPoint):
|
|
|
270
272
|
)
|
|
271
273
|
self._data_points[field] = data_point
|
|
272
274
|
|
|
273
|
-
def _unregister_data_point_updated_callback(self, cb: Callable, custom_id: str) -> None:
|
|
275
|
+
def _unregister_data_point_updated_callback(self, *, cb: Callable, custom_id: str) -> None:
|
|
274
276
|
"""Unregister update callback."""
|
|
275
277
|
for unregister in self._unregister_callbacks:
|
|
276
278
|
if unregister is not None:
|
|
@@ -278,7 +280,7 @@ class CustomDataPoint(BaseDataPoint):
|
|
|
278
280
|
|
|
279
281
|
super()._unregister_data_point_updated_callback(cb=cb, custom_id=custom_id)
|
|
280
282
|
|
|
281
|
-
def _mark_data_points(self, custom_data_point_def: Mapping[int | tuple[int, ...], tuple[str, ...]]) -> None:
|
|
283
|
+
def _mark_data_points(self, *, custom_data_point_def: Mapping[int | tuple[int, ...], tuple[str, ...]]) -> None:
|
|
282
284
|
"""Mark data points to be created, even though a custom data point is present."""
|
|
283
285
|
if not custom_data_point_def:
|
|
284
286
|
return
|
|
@@ -289,7 +291,7 @@ class CustomDataPoint(BaseDataPoint):
|
|
|
289
291
|
for channel_no in channel_nos:
|
|
290
292
|
self._mark_data_point(channel_no=channel_no, parameters=parameters)
|
|
291
293
|
|
|
292
|
-
def _mark_data_point(self, channel_no: int | None, parameters: tuple[str, ...]) -> None:
|
|
294
|
+
def _mark_data_point(self, *, channel_no: int | None, parameters: tuple[str, ...]) -> None:
|
|
293
295
|
"""Mark data point to be created, even though a custom data point is present."""
|
|
294
296
|
channel_address = get_channel_address(device_address=self._device.address, channel_no=channel_no)
|
|
295
297
|
|
|
@@ -298,7 +300,7 @@ class CustomDataPoint(BaseDataPoint):
|
|
|
298
300
|
dp.force_usage(forced_usage=DataPointUsage.DATA_POINT)
|
|
299
301
|
|
|
300
302
|
def _get_data_point[DataPointT: hmge.GenericDataPoint](
|
|
301
|
-
self, field: Field, data_point_type: type[DataPointT]
|
|
303
|
+
self, *, field: Field, data_point_type: type[DataPointT]
|
|
302
304
|
) -> DataPointT:
|
|
303
305
|
"""Get data point."""
|
|
304
306
|
if dp := self._data_points.get(field):
|
|
@@ -318,7 +320,7 @@ class CustomDataPoint(BaseDataPoint):
|
|
|
318
320
|
NoneTypeDataPoint(),
|
|
319
321
|
)
|
|
320
322
|
|
|
321
|
-
def has_data_point_key(self, data_point_keys: set[DataPointKey]) -> bool:
|
|
323
|
+
def has_data_point_key(self, *, data_point_keys: set[DataPointKey]) -> bool:
|
|
322
324
|
"""Return if a data_point with one of the data points is part of this data_point."""
|
|
323
325
|
result = [dp for dp in self._data_points.values() if dp.dpk in data_point_keys]
|
|
324
326
|
return len(result) > 0
|
|
@@ -594,6 +594,7 @@ def validate_custom_data_point_definition() -> Any:
|
|
|
594
594
|
|
|
595
595
|
|
|
596
596
|
def make_custom_data_point(
|
|
597
|
+
*,
|
|
597
598
|
channel: hmd.Channel,
|
|
598
599
|
data_point_class: type,
|
|
599
600
|
device_profile: DeviceProfile,
|
|
@@ -620,6 +621,7 @@ def make_custom_data_point(
|
|
|
620
621
|
|
|
621
622
|
|
|
622
623
|
def _create_custom_data_point(
|
|
624
|
+
*,
|
|
623
625
|
channel: hmd.Channel,
|
|
624
626
|
custom_data_point_class: type,
|
|
625
627
|
device_profile: DeviceProfile,
|
|
@@ -650,9 +652,9 @@ def _create_custom_data_point(
|
|
|
650
652
|
) from exc
|
|
651
653
|
|
|
652
654
|
|
|
653
|
-
def _rebase_pri_channels(device_profile: DeviceProfile, custom_config: CustomConfig) -> CustomConfig:
|
|
655
|
+
def _rebase_pri_channels(*, device_profile: DeviceProfile, custom_config: CustomConfig) -> CustomConfig:
|
|
654
656
|
"""Re base primary channel of custom config."""
|
|
655
|
-
device_def = _get_device_group(device_profile, 0)
|
|
657
|
+
device_def = _get_device_group(device_profile=device_profile, group_no=0)
|
|
656
658
|
if (pri_def := device_def[CDPD.PRIMARY_CHANNEL]) is None:
|
|
657
659
|
return custom_config
|
|
658
660
|
pri_channels = [cu + pri_def for cu in custom_config.channels]
|
|
@@ -663,9 +665,9 @@ def _rebase_pri_channels(device_profile: DeviceProfile, custom_config: CustomCon
|
|
|
663
665
|
)
|
|
664
666
|
|
|
665
667
|
|
|
666
|
-
def _relevant_channels(device_profile: DeviceProfile, custom_config: CustomConfig) -> tuple[int | None, ...]:
|
|
668
|
+
def _relevant_channels(*, device_profile: DeviceProfile, custom_config: CustomConfig) -> tuple[int | None, ...]:
|
|
667
669
|
"""Return the relevant channels."""
|
|
668
|
-
device_def = _get_device_group(device_profile, 0)
|
|
670
|
+
device_def = _get_device_group(device_profile=device_profile, group_no=0)
|
|
669
671
|
def_channels = [device_def[CDPD.PRIMARY_CHANNEL]]
|
|
670
672
|
if sec_channels := device_def.get(CDPD.SECONDARY_CHANNELS):
|
|
671
673
|
def_channels.extend(sec_channels)
|
|
@@ -681,10 +683,10 @@ def _relevant_channels(device_profile: DeviceProfile, custom_config: CustomConfi
|
|
|
681
683
|
|
|
682
684
|
|
|
683
685
|
def add_channel_groups_to_device(
|
|
684
|
-
device: hmd.Device, device_profile: DeviceProfile, custom_config: CustomConfig
|
|
686
|
+
*, device: hmd.Device, device_profile: DeviceProfile, custom_config: CustomConfig
|
|
685
687
|
) -> None:
|
|
686
688
|
"""Return the relevant channels."""
|
|
687
|
-
device_def = _get_device_group(device_profile, 0)
|
|
689
|
+
device_def = _get_device_group(device_profile=device_profile, group_no=0)
|
|
688
690
|
if (pri_channel := device_def[CDPD.PRIMARY_CHANNEL]) is None:
|
|
689
691
|
return
|
|
690
692
|
for conf_channel in custom_config.channels:
|
|
@@ -699,7 +701,7 @@ def add_channel_groups_to_device(
|
|
|
699
701
|
device.add_channel_to_group(channel_no=conf_channel + sec_channel, group_no=group_no)
|
|
700
702
|
|
|
701
703
|
|
|
702
|
-
def get_channel_group_no(device: hmd.Device, channel_no: int | None) -> int | None:
|
|
704
|
+
def get_channel_group_no(*, device: hmd.Device, channel_no: int | None) -> int | None:
|
|
703
705
|
"""Get channel group of sub_device."""
|
|
704
706
|
return device.get_channel_group_no(channel_no=channel_no)
|
|
705
707
|
|
|
@@ -711,13 +713,13 @@ def get_default_data_points() -> Mapping[int | tuple[int, ...], tuple[Parameter,
|
|
|
711
713
|
)
|
|
712
714
|
|
|
713
715
|
|
|
714
|
-
def get_include_default_data_points(device_profile: DeviceProfile) -> bool:
|
|
716
|
+
def get_include_default_data_points(*, device_profile: DeviceProfile) -> bool:
|
|
715
717
|
"""Return if default data points should be included."""
|
|
716
|
-
device = _get_device_definition(device_profile)
|
|
718
|
+
device = _get_device_definition(device_profile=device_profile)
|
|
717
719
|
return bool(device.get(CDPD.INCLUDE_DEFAULT_DPS, DEFAULT_INCLUDE_DEFAULT_DPS))
|
|
718
720
|
|
|
719
721
|
|
|
720
|
-
def _get_device_definition(device_profile: DeviceProfile) -> Mapping[CDPD, Any]:
|
|
722
|
+
def _get_device_definition(*, device_profile: DeviceProfile) -> Mapping[CDPD, Any]:
|
|
721
723
|
"""Return device from data_point definitions."""
|
|
722
724
|
return cast(
|
|
723
725
|
Mapping[CDPD, Any],
|
|
@@ -725,9 +727,9 @@ def _get_device_definition(device_profile: DeviceProfile) -> Mapping[CDPD, Any]:
|
|
|
725
727
|
)
|
|
726
728
|
|
|
727
729
|
|
|
728
|
-
def _get_device_group(device_profile: DeviceProfile, group_no: int | None) -> Mapping[CDPD, Any]:
|
|
730
|
+
def _get_device_group(*, device_profile: DeviceProfile, group_no: int | None) -> Mapping[CDPD, Any]:
|
|
729
731
|
"""Return the device group."""
|
|
730
|
-
device = _get_device_definition(device_profile)
|
|
732
|
+
device = _get_device_definition(device_profile=device_profile)
|
|
731
733
|
group = cast(dict[CDPD, Any], device[CDPD.DEVICE_GROUP])
|
|
732
734
|
# Create a deep copy of the group due to channel rebase
|
|
733
735
|
group = deepcopy(group)
|
|
@@ -750,7 +752,7 @@ def _get_device_group(device_profile: DeviceProfile, group_no: int | None) -> Ma
|
|
|
750
752
|
|
|
751
753
|
|
|
752
754
|
def _rebase_data_point_dict(
|
|
753
|
-
data_point_dict: CDPD, group: Mapping[CDPD, Any], group_no: int
|
|
755
|
+
*, data_point_dict: CDPD, group: Mapping[CDPD, Any], group_no: int
|
|
754
756
|
) -> Mapping[int | None, Any]:
|
|
755
757
|
"""Rebase data_point_dict with group_no."""
|
|
756
758
|
new_fields: dict[int | None, Any] = {}
|
|
@@ -763,7 +765,9 @@ def _rebase_data_point_dict(
|
|
|
763
765
|
return new_fields
|
|
764
766
|
|
|
765
767
|
|
|
766
|
-
def _get_device_data_points(
|
|
768
|
+
def _get_device_data_points(
|
|
769
|
+
*, device_profile: DeviceProfile, group_no: int | None
|
|
770
|
+
) -> Mapping[int, tuple[Parameter, ...]]:
|
|
767
771
|
"""Return the device data points."""
|
|
768
772
|
if (
|
|
769
773
|
additional_dps := VALID_CUSTOM_DATA_POINT_DEFINITION[CDPD.DEVICE_DEFINITIONS]
|
|
@@ -779,6 +783,7 @@ def _get_device_data_points(device_profile: DeviceProfile, group_no: int | None)
|
|
|
779
783
|
|
|
780
784
|
|
|
781
785
|
def get_custom_configs(
|
|
786
|
+
*,
|
|
782
787
|
model: str,
|
|
783
788
|
category: DataPointCategory | None = None,
|
|
784
789
|
) -> tuple[CustomConfig, ...]:
|
|
@@ -807,6 +812,7 @@ def get_custom_configs(
|
|
|
807
812
|
|
|
808
813
|
|
|
809
814
|
def _get_data_point_config_by_category(
|
|
815
|
+
*,
|
|
810
816
|
category_devices: Mapping[str, CustomConfig | tuple[CustomConfig, ...]],
|
|
811
817
|
model: str,
|
|
812
818
|
) -> CustomConfig | tuple[CustomConfig, ...] | None:
|
|
@@ -822,7 +828,7 @@ def _get_data_point_config_by_category(
|
|
|
822
828
|
return None
|
|
823
829
|
|
|
824
830
|
|
|
825
|
-
def is_multi_channel_device(model: str, category: DataPointCategory) -> bool:
|
|
831
|
+
def is_multi_channel_device(*, model: str, category: DataPointCategory) -> bool:
|
|
826
832
|
"""Return true, if device has multiple channels."""
|
|
827
833
|
channels: list[int | None] = []
|
|
828
834
|
for custom_config in get_custom_configs(model=model, category=category):
|
|
@@ -830,9 +836,9 @@ def is_multi_channel_device(model: str, category: DataPointCategory) -> bool:
|
|
|
830
836
|
return len(channels) > 1
|
|
831
837
|
|
|
832
838
|
|
|
833
|
-
def data_point_definition_exists(model: str) -> bool:
|
|
839
|
+
def data_point_definition_exists(*, model: str) -> bool:
|
|
834
840
|
"""Check if device desc exits."""
|
|
835
|
-
return len(get_custom_configs(model)) > 0
|
|
841
|
+
return len(get_custom_configs(model=model)) > 0
|
|
836
842
|
|
|
837
843
|
|
|
838
844
|
def get_required_parameters() -> tuple[Parameter, ...]:
|