Skip to content

Commit

Permalink
Merge pull request #110 from ogajduse/fix/force-update-entity
Browse files Browse the repository at this point in the history
  • Loading branch information
ogajduse authored Nov 21, 2023
2 parents f01647e + 6ce3274 commit e617dbe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion custom_components/feedparser/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit e617dbe

Please sign in to comment.