Fix bond fans without defined max_speed (#38382)

This commit is contained in:
Eugene Prystupa authored and GitHub committed 2020-07-30 14:44:26 +02:00
1 parent 00a4bcff3d
commit a00aa6740e
3 files changed
+22 -4

No files matched your search

+1 -1
View File
@@ -75,7 +75,7 @@ class BondFan(BondEntity, FanEntity):
return None
# map 1..max_speed Bond speed to 1..3 HA speed
max_speed = self._device.props.get("max_speed", 3)
max_speed = max(self._device.props.get("max_speed", 3), self._speed)
ha_speed = math.ceil(self._speed * (len(self.speed_list) - 1) / max_speed)
return self.speed_list[ha_speed]