mirror of
https://github.com/home-assistant/core.git
synced 2025-08-04 13:15:18 +02:00
Clean up Volumio code (#38400)
This commit is contained in:
@@ -71,9 +71,9 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
errors = {}
|
errors = {}
|
||||||
if user_input is not None:
|
if user_input is not None:
|
||||||
info = None
|
info = None
|
||||||
|
self._host = user_input[CONF_HOST]
|
||||||
|
self._port = user_input[CONF_PORT]
|
||||||
try:
|
try:
|
||||||
self._host = user_input[CONF_HOST]
|
|
||||||
self._port = user_input[CONF_PORT]
|
|
||||||
info = await validate_input(self.hass, self._host, self._port)
|
info = await validate_input(self.hass, self._host, self._port)
|
||||||
except CannotConnect:
|
except CannotConnect:
|
||||||
errors["base"] = "cannot_connect"
|
errors["base"] = "cannot_connect"
|
||||||
@@ -83,7 +83,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
|
|
||||||
if info is not None:
|
if info is not None:
|
||||||
self._name = info.get("name", self._host)
|
self._name = info.get("name", self._host)
|
||||||
self._uuid = info.get("id", None)
|
self._uuid = info.get("id")
|
||||||
if self._uuid is not None:
|
if self._uuid is not None:
|
||||||
await self._set_uid_and_abort()
|
await self._set_uid_and_abort()
|
||||||
|
|
||||||
|
@@ -63,16 +63,15 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||||||
uid = config_entry.data[CONF_ID]
|
uid = config_entry.data[CONF_ID]
|
||||||
name = config_entry.data[CONF_NAME]
|
name = config_entry.data[CONF_NAME]
|
||||||
|
|
||||||
entity = Volumio(hass, volumio, uid, name, info)
|
entity = Volumio(volumio, uid, name, info)
|
||||||
async_add_entities([entity])
|
async_add_entities([entity])
|
||||||
|
|
||||||
|
|
||||||
class Volumio(MediaPlayerEntity):
|
class Volumio(MediaPlayerEntity):
|
||||||
"""Volumio Player Object."""
|
"""Volumio Player Object."""
|
||||||
|
|
||||||
def __init__(self, hass, volumio, uid, name, info):
|
def __init__(self, volumio, uid, name, info):
|
||||||
"""Initialize the media player."""
|
"""Initialize the media player."""
|
||||||
self._hass = hass
|
|
||||||
self._volumio = volumio
|
self._volumio = volumio
|
||||||
self._uid = uid
|
self._uid = uid
|
||||||
self._name = name
|
self._name = name
|
||||||
|
Reference in New Issue
Block a user