oil-tankstationer.dk parser failing
Opened this issue · 1 comments
mm98 commented
Hi,
It looks like https://www.oil-tankstationer.dk/de-gaeldende-braendstofpriser/
is breaking this integration. Which results in all fuelprices being unavailable
. It seams like the required span
tag (line 131) has been removed on their website.
Fuelprices_DK/custom_components/fuelprices_dk/fuelprices_dk_parsers.py
Lines 116 to 137 in 6018094
2023-08-01 17:40:39.131 ERROR (MainThread) [custom_components.fuelprices_dk.sensor] Unexpected error fetching sensor data: list index out of range
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 283, in _async_refresh
self.data = await self._async_update_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 242, in _async_update_data
return await self.update_method()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/fuelprices_dk/sensor.py", line 39, in async_update_data
await hass.async_add_executor_job(company.refreshPrices)
File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/fuelprices_dk/fuelprices_dk_api.py", line 202, in refreshPrices
self._products = getattr(self._parser, self._key)(self._url, self._products)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/fuelprices_dk/fuelprices_dk_parsers.py", line 135, in oil
priceSegments[0].text + "." + priceSegments[1].text,
Temporary fix for:
Fuelprices_DK/custom_components/fuelprices_dk/fuelprices_dk_parsers.py
Lines 129 to 137 in 6018094
if found:
priceSegments = cells[2].findAll(
"span", style=["text-align:right;", "text-align:left;"]
)
+ if priceSegments:
+ products[productKey] = self._addPriceToProduct(
+ productDict,
+ priceSegments[0].text + "." + priceSegments[1].text,
+ )
return products