Skip to content

Commit

Permalink
Disable sensor updates for now #59
Browse files Browse the repository at this point in the history
  • Loading branch information
FaserF committed Dec 16, 2024
1 parent 95135ca commit ad528d3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
19 changes: 15 additions & 4 deletions custom_components/deutschebahn/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ad528d3

Please sign in to comment.