Conversation
CoverEntity annotates _attr_is_closed with no default (unlike _attr_is_closing / _attr_is_opening), so the base is_closed cached_property reads a missing attribute and raises AttributeError. is_closed is reached from both state() and state_attributes(), and a raised exception is never cached, so it fires on every poll. These rails have no position feedback, so None (unknown) is the only honest value: HotataAirerCover and _HotataCurtainBase are unaffected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
HotataRailCovernever defines_attr_is_closed, but HA'sCoverEntitydeclares it with a type annotation and no default — unlike its neighbours in the same block (components/cover/__init__.py, HA 2026.9.2):and
is_closedis acached_propertythat reads it directly:So on a P5 airer every state write failed:
Two details make it noisy rather than intermittent:
is_closedis reached twice per write —state()(if (closed := self.is_closed) is None:) andstate_attributes()(data[IS_CLOSED] = self.is_closed)cached_propertydoes not cache a raised exception, so it re-raises every time → one error per poll (measured: every 30 s, 54 lines in two minutes)Only
HotataRailCoveris affected;HotataAirerCoverand_HotataCurtainBaseboth implementis_closed.改了啥
Noneis the correct value here, not a convenient fallback. The A/B poles only reportAPoleMotorControlMode/BPoleMotorControlMode(open / stop / close) and have no position feedback, so "closed" is genuinely unknown — the same reasonHotataAirerCover.assumed_statereportsTruewhenPositionis not a real enum.CoverEntity.is_closedis typedbool | Noneandstate()has an explicitNonebranch, so HA renders the entity asunknown, which is what it renders today. GuessingTrue/Falsewould feed HomeKit and automations a wrong state.怎么测
py_compilepasses for every module undercustom_components/hotata/Unexpected error updating listenerlines (previously ~1 per 30 s)api.link.aliyun.com … Network unreachableduring a WAN outage, which recovered on its ownunknown(no position feedback — expected); open / close / stop are unaffected_attr_*without defaults across 12 entity types) — this was the only missing one关联 Issue
N/A — found on my own instance; searching
is_closedin this repo returns 0 results, so I don't think it has been reported.Checklist
py_compile全部通过[Unreleased]section) if you'd rather have it inside the PR