diff --git a/custom_components/fuel_prices/manifest.json b/custom_components/fuel_prices/manifest.json index 8665592..9719fe0 100644 --- a/custom_components/fuel_prices/manifest.json +++ b/custom_components/fuel_prices/manifest.json @@ -11,7 +11,7 @@ "issue_tracker": "https://github.com/pantherale0/ha-fuelprices/issues", "requirements": [ "these-united-states==1.1.0.21", - "pyfuelprices==2.5.1" + "pyfuelprices==2.6.0" ], "ssdp": [], "version": "0.0.0", diff --git a/custom_components/fuel_prices/sensor.py b/custom_components/fuel_prices/sensor.py index 53c2c9c..98d6781 100644 --- a/custom_components/fuel_prices/sensor.py +++ b/custom_components/fuel_prices/sensor.py @@ -142,7 +142,8 @@ async def async_update(self) -> None: self._cached_data = data[int(self._count)-1] return True self._cached_data = None - self._next_update = datetime.now() + timedelta(days=1) + self._last_update = datetime.now() + self._next_update = datetime.now() + timedelta(minutes=5) @property def native_value(self) -> str | float: @@ -168,5 +169,7 @@ def extra_state_attributes(self) -> Mapping[str, Any] | None: """Return extra state attributes.""" return { "area": self._area, - **self._cached_data + **self._cached_data, + "last_updated": self._last_update, + "next_update": self._next_update } diff --git a/requirements.txt b/requirements.txt index 971c250..1d85c34 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,4 @@ colorlog==6.7.0 homeassistant==2024.3.3 pip>=21.0,<23.2 ruff==0.0.292 -pyfuelprices==2.5.1 \ No newline at end of file +pyfuelprices==2.6.0 \ No newline at end of file