diff --git a/.gitignore b/.gitignore index 8d979a0..0b20552 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .DS_Store .idea/* +__pycache__ \ No newline at end of file diff --git a/custom_components/omnik_inverter/__init__.py b/custom_components/omnik_inverter/__init__.py index 6fb741e..52b56b2 100644 --- a/custom_components/omnik_inverter/__init__.py +++ b/custom_components/omnik_inverter/__init__.py @@ -18,12 +18,12 @@ from .const import ( CONF_SCAN_INTERVAL, CONF_SOURCE_TYPE, + CONFIGFLOW_VERSION, DEFAULT_SCAN_INTERVAL, DOMAIN, LOGGER, SERVICE_DEVICE, SERVICE_INVERTER, - CONFIGFLOW_VERSION, ) PLATFORMS = (SENSOR_DOMAIN,) @@ -59,10 +59,15 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: return unload_ok + async def async_migrate_entry(hass: HomeAssistant, config_entry: ConfigEntry): """Migrate old entry.""" if config_entry.version <= 2: - LOGGER.warning("Impossible to migrate config version from version %s to version %s.\r\nPlease consider to delete and re-add the integration.", config_entry.version, CONFIGFLOW_VERSION) + LOGGER.warning( + "Impossible to migrate config version from version %s to version %s.\r\nPlease consider to delete and re-add the integration.", + config_entry.version, + CONFIGFLOW_VERSION, + ) return False @@ -105,11 +110,11 @@ def __init__( session=async_get_clientsession(hass), ) else: - self.omnikinverter = OmnikInverter( - host=self.config_entry.data[CONF_HOST], - source_type=self.config_entry.data[CONF_SOURCE_TYPE], - session=async_get_clientsession(hass), - ) + self.omnikinverter = OmnikInverter( + host=self.config_entry.data[CONF_HOST], + source_type=self.config_entry.data[CONF_SOURCE_TYPE], + session=async_get_clientsession(hass), + ) async def _async_update_data(self) -> OmnikInverterData: """Fetch data from Omnik Inverter.""" diff --git a/custom_components/omnik_inverter/config_flow.py b/custom_components/omnik_inverter/config_flow.py index 343574b..7643771 100644 --- a/custom_components/omnik_inverter/config_flow.py +++ b/custom_components/omnik_inverter/config_flow.py @@ -19,11 +19,11 @@ from homeassistant.helpers.aiohttp_client import async_get_clientsession from .const import ( - DOMAIN, - CONFIGFLOW_VERSION, CONF_SCAN_INTERVAL, CONF_SOURCE_TYPE, + CONFIGFLOW_VERSION, DEFAULT_SCAN_INTERVAL, + DOMAIN, )