Skip to content

Commit ecca50a

Browse files
mik-lajclaude
andcommitted
Use is None guards for uptime and fxcount; fix outdated comment
Treat fxcount=0 as a valid value rather than "missing": change `not fxcount` to `fxcount is None` in _check_effects_changed, consistent with the earlier uptime fix. A device reporting zero effects would otherwise be forced into a safe-refetch loop on every poll. Update the inline comment in test_update_skips_presets_when_unchanged to reflect that the first update now fetches three endpoints (/json, /json/effects, /presets.json) after mock_json_and_presets was extended to also stub /json/effects. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 3498651 commit ecca50a

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/wled/wled.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -873,9 +873,9 @@ def _check_effects_changed(
873873
return (False, self._effects_version)
874874

875875
info = data["info"]
876-
if (uptime := info.get("uptime")) is None or not (
876+
if (uptime := info.get("uptime")) is None or (
877877
fxcount := info.get("fxcount")
878-
):
878+
) is None:
879879
return (True, None)
880880

881881
try:

tests/test_wled.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ async def test_update_skips_presets_when_unchanged(
279279
"""Test update() skips fetching presets.json when presets haven't changed."""
280280
wled_data = load_fixture_json("wled")
281281

282-
# First update: fetches both /json and /presets.json
282+
# First update: fetches /json, /json/effects, /presets.json
283283
responses.get(
284284
"http://example.com/json",
285285
status=200,

0 commit comments

Comments
 (0)