mirror of
https://github.com/home-assistant/core.git
synced 2025-05-29 10:17:08 +00:00

* Import roon code. * Fix flake8/pylint issues. * Fix lint issues, extend timeout, change contact infomation. * Add new files to .coveragerc * Make file executable. * Fix problem with integration not working after initial creation. * Improve logic unavailable players by caching data. * Review changes Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Review changes Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Review changes Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Review changes Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Review changes Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Review changes Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Review changes Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Review changes Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Review changes Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Review changes Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Update review suggestions * Rremove custom play action script. * Add test requirements. * Tidy manifest. * Missed fixes. * Refactor config_flow to use current pattern. * Add config_flow tests. * Refactor to use signal dispatch helpers. * Remove ToDo: for now. * Remove remaining zone / source logic for initial release, * Stop authenticate blocking, handle timeout. * Removed unneeded code. * Review comments update. * Fix comment. * Apply suggestions from code review Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Apply suggestions from code review Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Fix bug in seek. * Use sync rather than async update Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Upgrade library, remove exception now caught in library, * Review comments. * Review changes Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Check for duplicate host before adding. * Review comment. Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Remove unused code, revise turn_on/turn_off. * Sync translations. * Make interim timeout const. * Refactor tests. * Add tests with an existing config entry. * Apply suggestions from code review Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Remove CannotConnect Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
42 lines
1.1 KiB
Python
42 lines
1.1 KiB
Python
"""Roon (www.roonlabs.com) component."""
|
|
import logging
|
|
|
|
from homeassistant.const import CONF_HOST
|
|
from homeassistant.helpers import device_registry as dr
|
|
|
|
from .const import DOMAIN
|
|
from .server import RoonServer
|
|
|
|
_LOGGER = logging.getLogger(__name__)
|
|
|
|
|
|
async def async_setup(hass, config):
|
|
"""Set up the Roon platform."""
|
|
hass.data[DOMAIN] = {}
|
|
return True
|
|
|
|
|
|
async def async_setup_entry(hass, entry):
|
|
"""Set up a roonserver from a config entry."""
|
|
host = entry.data[CONF_HOST]
|
|
roonserver = RoonServer(hass, entry)
|
|
|
|
if not await roonserver.async_setup():
|
|
return False
|
|
|
|
hass.data[DOMAIN][entry.entry_id] = roonserver
|
|
device_registry = await dr.async_get_registry(hass)
|
|
device_registry.async_get_or_create(
|
|
config_entry_id=entry.entry_id,
|
|
identifiers={(DOMAIN, entry.entry_id)},
|
|
manufacturer="Roonlabs",
|
|
name=host,
|
|
)
|
|
return True
|
|
|
|
|
|
async def async_unload_entry(hass, entry):
|
|
"""Unload a config entry."""
|
|
roonserver = hass.data[DOMAIN].pop(entry.entry_id)
|
|
return await roonserver.async_reset()
|