#Integration Configure update not updating on UI

1 messages · Page 1 of 1 (latest)

native flume
#

init.py

from homeassistant.core import HomeAssistant
from homeassistant import config_entries
from .const import DOMAIN, DEFAULT_SCAN_INTERVAL

import logging

_LOGGER = logging.getLogger(__name__)

async def async_setup(hass: HomeAssistant, config: dict):
    """Set up the integration using YAML if needed."""
    return True

async def async_setup_entry(hass, entry):
    if not entry.options or "address" not in entry.options or "scan_interval" not in entry.options:
        updated_options = {
            "address": entry.data.get("address", ""),
            "scan_interval": entry.data.get("scan_interval", DEFAULT_SCAN_INTERVAL)
        }
        _LOGGER.debug("Migrating legacy data to options: %s", updated_options)
        hass.config_entries.async_update_entry(entry, options=updated_options)

    address = entry.options.get("address")
    scan_interval = entry.options.get("scan_interval", DEFAULT_SCAN_INTERVAL)

    _LOGGER.debug("Setting up with address: %s, scan_interval: %s", address, scan_interval)

    hass.data.setdefault(DOMAIN, {})[entry.entry_id] = {
        "address": address,
        "scan_interval": scan_interval,
    }

    await hass.config_entries.async_forward_entry_setups(entry, ["sensor"])

    return True

async def async_unload_entry(hass: HomeAssistant, entry: config_entries.ConfigEntry):
    """Unload a config entry."""
    unload_ok = await hass.config_entries.async_unload_platforms(entry, ["sensor"])
    if unload_ok:
        hass.data.get(DOMAIN, {}).pop(entry.entry_id, None)
    return unload_ok
jaunty basin
#

Please post in the developer channels

native flume
#

Which is dev channel?

jaunty basin
#

I just gave you the dev role, but you'll probably need to add them manually from the Channels & Roles link at the top of the channel list