* Add arcam_fmj support * Just use use state in player avoid direct client access * Avoid leaking exceptions on invalid data * Fix return value for volume in case of 0 * Mark component as having no coverage * Add new requirement * Add myself as maintainer * Correct linting errors * Use async_create_task instead of async_add_job * Use new style string format instead of concat * Don't call init of base class without init * Annotate callbacks with @callback Otherwise they won't be called in loop * Reduce log level to debug * Use async_timeout instead of wait_for * Bump to version of arcam_fmj supporting 3.5 * Fix extra spaces * Drop somewhat flaky unique_id * Un-blackify ident to satisy pylint * Un-blackify ident to satisy pylint * Move default name calculation to config validation * Add test folder * Drop unused code * Add tests for config flow import
27 lines
920 B
Python
27 lines
920 B
Python
"""Config flow to configure the Arcam FMJ component."""
|
|
from operator import itemgetter
|
|
|
|
from homeassistant import config_entries
|
|
from homeassistant.const import CONF_HOST, CONF_PORT
|
|
|
|
from .const import DOMAIN
|
|
|
|
_GETKEY = itemgetter(CONF_HOST, CONF_PORT)
|
|
|
|
|
|
@config_entries.HANDLERS.register(DOMAIN)
|
|
class ArcamFmjFlowHandler(config_entries.ConfigFlow):
|
|
"""Handle a SimpliSafe config flow."""
|
|
|
|
VERSION = 1
|
|
CONNECTION_CLASS = config_entries.CONN_CLASS_LOCAL_POLL
|
|
|
|
async def async_step_import(self, import_config):
|
|
"""Import a config entry from configuration.yaml."""
|
|
entries = self.hass.config_entries.async_entries(DOMAIN)
|
|
import_key = _GETKEY(import_config)
|
|
for entry in entries:
|
|
if _GETKEY(entry.data) == import_key:
|
|
return self.async_abort(reason="already_setup")
|
|
|
|
return self.async_create_entry(title="Arcam FMJ", data=import_config)
|