Skip to content

Commit e617dbe

Browse files
authored
Merge pull request #110 from ogajduse/fix/force-update-entity
2 parents f01647e + 6ce3274 commit e617dbe

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

custom_components/feedparser/sensor.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ async def async_setup_platform(
8282
class FeedParserSensor(SensorEntity):
8383
"""Representation of a Feedparser sensor."""
8484

85+
# force update the entity since the number of feed entries does not necessarily
86+
# change, but we still want to update the extra_state_attributes
87+
_attr_force_update = True
88+
8589
def __init__(
8690
self: FeedParserSensor,
8791
feed: str,
@@ -105,7 +109,7 @@ def __init__(
105109
self._local_time = local_time
106110
self._entries: list[dict[str, str]] = []
107111
self._attr_extra_state_attributes = {"entries": self._entries}
108-
_attr_attribution = "Data retrieved using RSS feedparser"
112+
self._attr_attribution = "Data retrieved using RSS feedparser"
109113
_LOGGER.debug("Feed %s: FeedParserSensor initialized - %s", self.name, self)
110114

111115
def __repr__(self: FeedParserSensor) -> str:

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ dependencies = ["python-dateutil", "feedparser==6.0.10", "homeassistant"]
2929
dev = [
3030
"black",
3131
"homeassistant-stubs",
32-
"pytest==7.4.0",
32+
"pytest==7.4.3",
3333
"mypy",
3434
"ruff",
3535
"types-python-dateutil",

0 commit comments

Comments
 (0)