Open Jopand opened 1 year ago
for me it is the CircleK sensor that are not updating
Logger: homeassistant.components.sensor
Source: custom_components/fuelprices_dk/fuelprices_dk_api.py:215
Integration: Sensor (documentation, issues)
First occurred: 14:21:22 (2 occurrences)
Last logged: 14:21:22
Error adding entities for domain sensor with platform fuelprices_dk
Error while setting up fuelprices_dk platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 455, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 731, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 846, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 585, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 649, in _async_write_ha_state
state = self._stringify_state(available)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 591, in _stringify_state
if (state := self.state) is None:
File "/config/custom_components/fuelprices_dk/sensor.py", line 91, in state
return float(self._fuelCompany.getProductPrice(self._productKey))
File "/config/custom_components/fuelprices_dk/fuelprices_dk_api.py", line 215, in getProductPrice
return self._products[productKey]["price"]
KeyError: 'price'
The fuel name has change at circleK, add a "." after the name and it is working
FUEL_COMPANIES = {
"circlek": {
"name": "Circle K",
"url": "https://www.circlek.dk/priser",
"products": {
OCTANE_95: {"name": "miles95."},
OCTANE_95_PLUS: {"name": "milesPLUS95."},
DIESEL: {"name": "miles Diesel B7."},
DIESEL_PLUS: {"name": "milesPLUS Diesel."},
ELECTRIC: {"name": "El Lynlader."},
In HA 2023.5.2 I get the following errors in the log (sensors are not updated):
First occurred: 8. maj 2023 kl. 13.29.09 (32 occurrences) Last logged: 21.44.45
Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 204, in _handle_refresh_interval await self._async_refresh(log_failures=True, scheduled=True) File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 349, in _async_refresh self.async_update_listeners() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 146, in async_update_listeners update_callback() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 585, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 649, in _async_write_ha_state state = self._stringify_state(available) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 591, in _stringify_state if (state := self.state) is None: File "/config/custom_components/fuelprices_dk/sensor.py", line 91, in state return float(self._fuelCompany.getProductPrice(self._productKey)) File "/config/custom_components/fuelprices_dk/fuelprices_dk_api.py", line 215, in getProductPrice return self._products[productKey]["price"] KeyError: 'price'