def percentage(self):
        """Return the current speed as a percentage."""
        if self._prop_percentage:
            val = self._prop_percentage.from_device(self.device)
            if val is not None:
                return val
        lst = [v for v in self.speed_list if v not in OFF_SPEED_VALUES]
        try:
            return ordered_list_item_to_percentage(lst, self.speed)
        except ValueError:
            return None
Return the current speed as a percentage.
custom_components/xiaomi_miot/fan.py