def set_percentage(self, percentage: int):
        """Set the speed of the fan, as a percentage."""
        if self._miot_property.value_range:
            stp = self._miot_property.range_step()
            top = self._miot_property.range_max()
            val = round(top * (percentage / 100) / stp) * stp
            return self.call_parent('set_property', self._miot_property.full_name, val)
        return False
Set the speed of the fan, as a percentage.
custom_components/xiaomi_miot/fan.py