From ad528d3b024d75627c8a292dd5d9517737397bb5 Mon Sep 17 00:00:00 2001 From: Fabian Seitz Date: Mon, 16 Dec 2024 18:58:03 +0100 Subject: [PATCH] Disable sensor updates for now #59 --- README.md | 6 +++--- custom_components/deutschebahn/sensor.py | 19 +++++++++++++++---- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index f366a2d..bca7c7f 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ [![hacs_badge](https://img.shields.io/badge/HACS-Default-41BDF5.svg?style=for-the-badge)](https://github.com/hacs/integration) -# DEPRECATION WARNING!!! -Unfortunatly bahn.de has shut down their websites that this integration used for web scraping. Therefore this integration wont work anymore since 15th december 2024. [More details](https://github.com/kennell/schiene/pull/36#issuecomment-2546101589) +# BREAKING WARNING!!! +Unfortunatly bahn.de has shut down their websites that this integration used for web scraping. Therefore this integration wont work anymore since 15th december 2024. [More details](https://github.com/kennell/schiene/pull/36#issuecomment-2546101589) & [here](https://github.com/FaserF/ha-deutschebahn/issues/59#issuecomment-2546087237). Until a new method has found this integration wont work anymore. There is NO ETA. -I recommend switching to those integrations: +I recommend switching to those integrations for now: - [hacs-hafas by @klimnik](https://github.com/akloeckner/hacs-hafas) diff --git a/custom_components/deutschebahn/sensor.py b/custom_components/deutschebahn/sensor.py index ad6f2de..76a7969 100644 --- a/custom_components/deutschebahn/sensor.py +++ b/custom_components/deutschebahn/sensor.py @@ -122,17 +122,28 @@ def extra_state_attributes(self): async def async_added_to_hass(self): """Call when entity is added to hass.""" await super().async_added_to_hass() - self.async_on_remove( - async_track_time_interval( - self.hass, self._async_refresh_data, self.scan_interval - ) + _LOGGER.warning( + f"The DeutscheBahn integration is currently non-functional due to: https://github.com/FaserF/ha-deutschebahn?tab=readme-ov-file#deprecation-warning " + f"Please disable the integration temporarily until a fix is available." ) + #self.async_on_remove( + # async_track_time_interval( + # self.hass, self._async_refresh_data, self.scan_interval + # ) + #) async def _async_refresh_data(self, now=None): """Refresh the data.""" await self.async_update_ha_state(force_refresh=True) async def async_update(self): + """Skip updates and log a warning.""" + _LOGGER.warning( + "Skipping update for DeutscheBahn sensor '%s' due to known issues with the data source: https://github.com/FaserF/ha-deutschebahn?tab=readme-ov-file#breaking-warning" + % self._name + ) + + async def async_update_disabled(self): try: with async_timeout.timeout(30): hass = self.hass