Skip to content

Fix feed entry updates, options reload, and config flow UX - #163

Open
Chreece wants to merge 1 commit into
custom-components:modernizationfrom
Chreece:fix/feed-entry-updates-options-ux
Open

Fix feed entry updates, options reload, and config flow UX#163
Chreece wants to merge 1 commit into
custom-components:modernizationfrom
Chreece:fix/feed-entry-updates-options-ux

Conversation

@Chreece

@Chreece Chreece commented Sep 8, 2026

Copy link
Copy Markdown

Summary

This fixes two issues in the 1.0.0 config-entry implementation and improves the Feedparser setup/options forms:

  • publish a fresh entries list on each successful poll so Home Assistant can detect real attribute changes;
  • use OptionsFlowWithReload so saved options actually reload the config entry;
  • replace separate scan-interval hour/minute fields with Home Assistant's duration selector;
  • add clearer labels, field descriptions, and explicit minimum refresh-interval validation;
  • add German and Greek translations for the config and options flows.

Why the entries change is needed

FeedParserSensor.update() currently clears and extends the existing _entries list in place. Home Assistant state attributes are read-only only at the outer mapping level; nested values such as lists are not deep-copied. The previous HA State therefore retains a reference to the same list.

When the next feed poll mutates that list, the entries value visible through the previous state is mutated as well. Home Assistant then compares the old and new attributes as equal. In particular, state triggers watching attribute: entries skip the update because the old and new attribute values compare equal.

The fix assigns a new list for every successful parse instead of mutating the existing list. The redundant _attr_extra_state_attributes assignment is also removed because extra_state_attributes is already implemented as a property returning the current entries.

Why the options-flow change is needed

The current flow subclasses OptionsFlow and sets automatic_reload = True. Current Home Assistant only honors automatic reload for OptionsFlowWithReload. As a result, updated options are stored but settings that are consumed during entity-platform setup, such as scan_interval, may not take effect until the config entry is reloaded or Home Assistant restarts.

Using OptionsFlowWithReload applies saved options through the supported Home Assistant mechanism.

Config-flow UX

The setup/options UI is also adjusted to use current Home Assistant selectors and clearer wording:

  • one Refresh interval duration control instead of separate hour/minute inputs;
  • Maximum entries uses a numeric box control;
  • a refresh interval below one minute is rejected instead of silently being coerced to one minute;
  • field descriptions explain date formatting, local-time conversion, entry limits, image stripping, and include/exclude behavior;
  • options text makes it clear that saving reloads that feed entry;
  • the updated setup/options UI is translated into German and Greek in addition to English.

Persisted scan_interval data remains in the existing duration-dict shape, so no config-entry migration is required for this UI change.

Regression coverage

Added tests cover:

  • a second poll does not mutate the entries snapshot returned by the first poll;
  • the options flow inherits from OptionsFlowWithReload;
  • refresh interval normalization;
  • rejecting a zero refresh interval.

Validation / reproduction evidence

The failure was reproduced on Home Assistant 2026.9.1 with a polling feed:

  • the source Feedparser sensor was confirmed to poll successfully at roughly 60-second intervals;
  • direct state-semantics testing confirmed that the old state's nested entries list was the exact same list object and changed when _entries.clear() / _entries.extend() ran;
  • an attribute: entries consumer remained stale during normal polls but refreshed when the Feedparser config entry was reloaded, which creates a new entity/list object.

Local static checks completed for this patch:

  • Python compilation succeeds;
  • English, German, and Greek translation JSON parses successfully and has matching translation keys;
  • git diff --check succeeds.

The full pytest suite was not run in the patch-preparation container because the homeassistant package is not installed there. CI should run the repository's normal test/lint gates.

@Chreece
Chreece force-pushed the fix/feed-entry-updates-options-ux branch from 504517e to adc0ea4 Compare September 9, 2026 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant