def battery_level(self):
        """Return the battery level of the device."""
        if not self._miot_service:
            return None
        sls = [self._miot_service, *self._miot_service.spec.get_services('battery')]
        for srv in sls:
            prop = srv.get_property('battery_level')
            if prop:
                return prop.from_device(self.device)
        return None
Return the battery level of the device.
custom_components/xiaomi_miot/device_tracker.py