Skip to content

Commit

Permalink
Fix path spacing for different Mammotion models
Browse files Browse the repository at this point in the history
Fixes mikey0000#125

Update `path_spacing` entity to dynamically set min and max values based on Mammotion model.

* Set `min_value` to 15 and `max_value` to 30 for Yuka model.
* Set `min_value` to 20 and `max_value` to 35 for Luba model.
* Use `DeviceType` utility to determine the model type.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/mikey0000/Mammotion-HA/issues/125?shareId=XXXX-XXXX-XXXX-XXXX).
  • Loading branch information
hurtigit committed Sep 19, 2024
1 parent ac76aa7 commit 77f915d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions custom_components/mammotion/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ class MammotionConfigNumberEntityDescription(NumberEntityDescription):
step=1,
device_class=NumberDeviceClass.DISTANCE,
native_unit_of_measurement=UnitOfLength.CENTIMETERS,
min_value=20,
max_value=35,
min_value=15 if DeviceType.is_yuka(coordinator.device_name) else 20,
max_value=30 if DeviceType.is_yuka(coordinator.device_name) else 35,
set_fn=lambda coordinator, value: setattr(
coordinator.operation_settings, "channel_width", value
),
Expand Down

0 comments on commit 77f915d

Please sign in to comment.