diff --git a/custom_components/feedparser/sensor.py b/custom_components/feedparser/sensor.py index b4259b2..9d20304 100644 --- a/custom_components/feedparser/sensor.py +++ b/custom_components/feedparser/sensor.py @@ -82,6 +82,10 @@ async def async_setup_platform( class FeedParserSensor(SensorEntity): """Representation of a Feedparser sensor.""" + # force update the entity since the number of feed entries does not necessarily + # change, but we still want to update the extra_state_attributes + _attr_force_update = True + def __init__( self: FeedParserSensor, feed: str, @@ -105,7 +109,7 @@ def __init__( self._local_time = local_time self._entries: list[dict[str, str]] = [] self._attr_extra_state_attributes = {"entries": self._entries} - _attr_attribution = "Data retrieved using RSS feedparser" + self._attr_attribution = "Data retrieved using RSS feedparser" _LOGGER.debug("Feed %s: FeedParserSensor initialized - %s", self.name, self) def __repr__(self: FeedParserSensor) -> str: diff --git a/pyproject.toml b/pyproject.toml index bac2809..23ada42 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,7 @@ dependencies = ["python-dateutil", "feedparser==6.0.10", "homeassistant"] dev = [ "black", "homeassistant-stubs", - "pytest==7.4.0", + "pytest==7.4.3", "mypy", "ruff", "types-python-dateutil",