Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the Emby platform."""
host = config.get(CONF_HOST)
key = config.get(CONF_API_KEY)
port = config.get(CONF_PORT)
ssl = config.get(CONF_SSL)
auto_hide = config.get(CONF_AUTO_HIDE)
if port is None:
port = DEFAULT_SSL_PORT if ssl else DEFAULT_PORT
_LOGGER.debug("Setting up Emby server at: %s:%s", host, port)
emby = EmbyServer(host, key, port, ssl, hass.loop)
active_emby_devices = {}
inactive_emby_devices = {}
@callback
def device_update_callback(data):
"""Handle devices which are added to Emby."""
new_devices = []
active_devices = []
for dev_id in emby.devices:
active_devices.append(dev_id)
if (
dev_id not in active_emby_devices
and dev_id not in inactive_emby_devices
):
new = EmbyDevice(emby, dev_id)