diff --git a/custom_components/irm_kmi/api.py b/custom_components/irm_kmi/api.py index c1a360e..09d7648 100644 --- a/custom_components/irm_kmi/api.py +++ b/custom_components/irm_kmi/api.py @@ -51,7 +51,6 @@ class IrmKmiApiClient: async def get_image(self, url, params: dict | None = None) -> bytes: """Get the image at the specified url with the parameters""" - # TODO support etag and head request before requesting content r: ClientResponse = await self._api_wrapper(base_url=url, params={} if params is None else params) return await r.read() diff --git a/custom_components/irm_kmi/coordinator.py b/custom_components/irm_kmi/coordinator.py index b81eb45..46d4a0a 100644 --- a/custom_components/irm_kmi/coordinator.py +++ b/custom_components/irm_kmi/coordinator.py @@ -301,7 +301,7 @@ class IrmKmiCoordinator(DataUpdateCoordinator): country: str, images_from_api: Tuple[bytes], ) -> RainGraph: - + """Create a RainGraph object that is ready to output animated and still SVG images""" sequence: List[AnimationFrameData] = list() tz = pytz.timezone(self.hass.config.time_zone) current_time = datetime.now(tz=tz) diff --git a/custom_components/irm_kmi/rain_graph.py b/custom_components/irm_kmi/rain_graph.py index 28fac81..7bee76c 100644 --- a/custom_components/irm_kmi/rain_graph.py +++ b/custom_components/irm_kmi/rain_graph.py @@ -135,6 +135,7 @@ class RainGraph: self.write_time_and_rain(paragraph, rain_level, time) def write_time_and_rain(self, paragraph, rain_level, time): + """Using the paragraph object, write the time and rain level data""" paragraph.add(self._dwg.text(f"{time}", insert=(self._offset, self._top_text_y_pos), text_anchor="start", font_size="16px", @@ -186,6 +187,7 @@ class RainGraph: self.draw_chance_precip(list_higher_points, list_lower_points) def draw_chance_precip(self, list_higher_points: List, list_lower_points: List): + """Draw the blue solid line representing the actual rain forecast""" precip_higher_chance_path = self._dwg.path(fill='#63c8fa', stroke='none', opacity=.3) list_higher_points[-1] = tuple(list(list_higher_points[-1]) + ['last']) diff --git a/custom_components/irm_kmi/translations/en.json b/custom_components/irm_kmi/translations/en.json index ae1f010..a6cc089 100644 --- a/custom_components/irm_kmi/translations/en.json +++ b/custom_components/irm_kmi/translations/en.json @@ -44,5 +44,11 @@ } } } + }, + "issues": { + "zone_moved": { + "title": "Zone moved", + "description": "Hey!" + } } } diff --git a/custom_components/irm_kmi/utils.py b/custom_components/irm_kmi/utils.py index 62d0957..05d62d0 100644 --- a/custom_components/irm_kmi/utils.py +++ b/custom_components/irm_kmi/utils.py @@ -9,19 +9,18 @@ _LOGGER = logging.getLogger(__name__) def disable_from_config(hass: HomeAssistant, config_entry: ConfigEntry): - modify_from_config(hass, config_entry, False) + modify_from_config(hass, config_entry.entry_id, False) def enable_from_config(hass: HomeAssistant, config_entry: ConfigEntry): - modify_from_config(hass, config_entry, True) + modify_from_config(hass, config_entry.entry_id, True) -def modify_from_config(hass: HomeAssistant, config_entry: ConfigEntry, enable: bool): +def modify_from_config(hass: HomeAssistant, config_entry_id: str, enable: bool): dr = device_registry.async_get(hass) - devices = device_registry.async_entries_for_config_entry(dr, config_entry.entry_id) - _LOGGER.info(f"Trying to {'enable' if enable else 'disable'} {config_entry.entry_id}: {len(devices)} device(s)") + devices = device_registry.async_entries_for_config_entry(dr, config_entry_id) + _LOGGER.info(f"Trying to {'enable' if enable else 'disable'} {config_entry_id}: {len(devices)} device(s)") for device in devices: - _LOGGER.info(f"Disabling device {device.name} because it is out of Benelux") dr.async_update_device(device_id=device.id, disabled_by=None if enable else device_registry.DeviceEntryDisabler.INTEGRATION)