From ec84b405deb17722430a9a8bc8e3d3f52a929b73 Mon Sep 17 00:00:00 2001 From: Jules Dejaeghere Date: Sun, 27 Oct 2024 11:40:15 +0100 Subject: [PATCH] Update dependencies --- custom_components/irm_kmi/__init__.py | 12 ++++-------- custom_components/irm_kmi/manifest.json | 2 +- requirements.txt | 8 ++++---- requirements_tests.txt | 4 ++-- tests/test_coordinator.py | 4 ++-- tests/test_sensors.py | 3 ++- 6 files changed, 15 insertions(+), 18 deletions(-) diff --git a/custom_components/irm_kmi/__init__.py b/custom_components/irm_kmi/__init__.py index 59074f2..f7bb08a 100644 --- a/custom_components/irm_kmi/__init__.py +++ b/custom_components/irm_kmi/__init__.py @@ -62,23 +62,19 @@ async def async_migrate_entry(hass, config_entry: ConfigEntry): new = {**config_entry.data} if config_entry.version == 1: new = new | {CONF_STYLE: OPTION_STYLE_STD, CONF_DARK_MODE: True} - config_entry.version = 2 - hass.config_entries.async_update_entry(config_entry, data=new) + hass.config_entries.async_update_entry(config_entry, data=new, version=2) if config_entry.version == 2: new = new | {CONF_USE_DEPRECATED_FORECAST: OPTION_DEPRECATED_FORECAST_NOT_USED} - config_entry.version = 3 - hass.config_entries.async_update_entry(config_entry, data=new) + hass.config_entries.async_update_entry(config_entry, data=new, version=3) if config_entry.version == 3: new = new | {CONF_LANGUAGE_OVERRIDE: None} - config_entry.version = 4 - hass.config_entries.async_update_entry(config_entry, data=new) + hass.config_entries.async_update_entry(config_entry, data=new, version=4) if config_entry.version == 4: new[CONF_LANGUAGE_OVERRIDE] = 'none' if new[CONF_LANGUAGE_OVERRIDE] is None else new[CONF_LANGUAGE_OVERRIDE] - config_entry.version = 5 - hass.config_entries.async_update_entry(config_entry, data=new) + hass.config_entries.async_update_entry(config_entry, data=new, version=5) _LOGGER.debug(f"Migration to version {config_entry.version} successful") diff --git a/custom_components/irm_kmi/manifest.json b/custom_components/irm_kmi/manifest.json index 1a785ba..83e17b2 100644 --- a/custom_components/irm_kmi/manifest.json +++ b/custom_components/irm_kmi/manifest.json @@ -10,7 +10,7 @@ "issue_tracker": "https://github.com/jdejaegh/irm-kmi-ha/issues", "requirements": [ "svgwrite==1.4.3", - "aiofile==3.8.8" + "aiofile==3.9.0" ], "version": "0.2.19" } \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 7c38968..eca44c7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ -aiohttp==3.9.5 +aiohttp==3.10.8 async-timeout==4.0.3 -homeassistant==2024.6.4 -voluptuous==0.13.1 +homeassistant==2024.10.4 +voluptuous==0.15.2 svgwrite==1.4.3 -aiofile==3.8.8 \ No newline at end of file +aiofile==3.9.0 \ No newline at end of file diff --git a/requirements_tests.txt b/requirements_tests.txt index 368efd0..40a10c0 100644 --- a/requirements_tests.txt +++ b/requirements_tests.txt @@ -1,5 +1,5 @@ -homeassistant==2024.6.4 -pytest_homeassistant_custom_component==0.13.136 +homeassistant==2024.10.4 +pytest_homeassistant_custom_component==0.13.175 pytest freezegun isort \ No newline at end of file diff --git a/tests/test_coordinator.py b/tests/test_coordinator.py index 95fa4d9..0781592 100644 --- a/tests/test_coordinator.py +++ b/tests/test_coordinator.py @@ -93,8 +93,8 @@ async def test_daily_forecast( mock_config_entry: MockConfigEntry ) -> None: api_data = get_api_data("forecast.json").get('for', {}).get('daily') - - mock_config_entry.data = mock_config_entry.data | {CONF_LANGUAGE_OVERRIDE: 'fr'} + await hass.config_entries.async_add(mock_config_entry) + hass.config_entries.async_update_entry(mock_config_entry, data=mock_config_entry.data | {CONF_LANGUAGE_OVERRIDE: 'fr'}) coordinator = IrmKmiCoordinator(hass, mock_config_entry) result = await coordinator.daily_list_to_forecast(api_data) diff --git a/tests/test_sensors.py b/tests/test_sensors.py index f96d5fb..1c4d2d4 100644 --- a/tests/test_sensors.py +++ b/tests/test_sensors.py @@ -67,7 +67,8 @@ async def test_next_warning_when_data_available( mock_config_entry: MockConfigEntry ) -> None: api_data = get_api_data("be_forecast_warning.json") - mock_config_entry.data = mock_config_entry.data | {CONF_LANGUAGE_OVERRIDE: 'de'} + await hass.config_entries.async_add(mock_config_entry) + hass.config_entries.async_update_entry(mock_config_entry, data=mock_config_entry.data | {CONF_LANGUAGE_OVERRIDE: 'de'}) coordinator = IrmKmiCoordinator(hass, mock_config_entry)