Fix implicit-return in squeezebox (#122928)

This commit is contained in:
epenet 2024-08-01 09:19:16 +02:00 committed by GitHub
parent 55e5428443
commit 2fd3c42e63
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 3 deletions

View File

@ -3,7 +3,7 @@
import asyncio
from http import HTTPStatus
import logging
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Any
from pysqueezebox import Server, async_discover
import voluptuous as vol
@ -102,7 +102,7 @@ class SqueezeboxConfigFlow(ConfigFlow, domain=DOMAIN):
# update with suggested values from discovery
self.data_schema = _base_schema(self.discovery_info)
async def _validate_input(self, data):
async def _validate_input(self, data: dict[str, Any]) -> str | None:
"""Validate the user input allows us to connect.
Retrieve unique id and abort if already configured.
@ -129,6 +129,8 @@ class SqueezeboxConfigFlow(ConfigFlow, domain=DOMAIN):
await self.async_set_unique_id(status["uuid"])
self._abort_if_unique_id_configured()
return None
async def async_step_user(self, user_input=None):
"""Handle a flow initialized by the user."""
errors = {}

View File

@ -281,10 +281,11 @@ class SqueezeBoxEntity(MediaPlayerEntity):
self.hass.data[DOMAIN][KNOWN_PLAYERS].remove(self)
@property
def volume_level(self):
def volume_level(self) -> float | None:
"""Volume level of the media player (0..1)."""
if self._player.volume:
return int(float(self._player.volume)) / 100.0
return None
@property
def is_volume_muted(self):