1 """Helper collection for myuplink."""
3 from myuplink
import DevicePoint
9 from .const
import F_SERIES
13 device_point: DevicePoint,
14 description: SensorEntityDescription | NumberEntityDescription |
None =
None,
16 """Find entity platform for a DevicePoint."""
18 len(device_point.enum_values) == 2
19 and device_point.enum_values[0][
"value"] ==
"0"
20 and device_point.enum_values[1][
"value"] ==
"1"
22 if device_point.writable:
23 return Platform.SWITCH
24 return Platform.BINARY_SENSOR
26 if len(device_point.enum_values) > 0
and device_point.writable:
27 return Platform.SELECT
31 and description.native_unit_of_measurement ==
"DM"
32 or (device_point.raw[
"maxValue"]
and device_point.raw[
"minValue"])
34 if device_point.writable:
35 return Platform.NUMBER
36 return Platform.SENSOR
38 return Platform.SENSOR
51 PARAMETER_ID_TO_EXCLUDE_F730 = (
97 PARAMETER_ID_TO_INCLUDE_SMO20 = (
108 """Check if entity should be skipped for this device model."""
109 if model ==
"SMO 20":
111 len(device_point.smart_home_categories) > 0
112 or device_point.parameter_id
in PARAMETER_ID_TO_INCLUDE_SMO20
116 if model.lower().startswith(
"f"):
119 if any(d
in device_point.parameter_name.lower()
for d
in WEEKDAYS):
121 if device_point.parameter_id
in PARAMETER_ID_TO_EXCLUDE_F730:
127 """Remap all F-series models."""
128 if prefix.lower().startswith(
"f"):
str transform_model_series(str prefix)
bool skip_entity(str model, DevicePoint device_point)
Platform find_matching_platform(DevicePoint device_point, SensorEntityDescription|NumberEntityDescription|None description=None)