[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7AB1Y89CPMGPPE356W66EMC":3,"skill-same:01M7AB1Y89CPMGPPE356W66EMC":49},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":25,"forksCount":13,"repositoryHtmlUrl":26,"repositoryHomepageUrl":6,"ownerHtmlUrl":27,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":28,"install":29,"resources":42},"01M7AB1Y89CPMGPPE356W66EMC","ha-coordinator-debug",null,"Diagnose and fix runtime problems in this Home Assistant custom integration — entities showing \"unavailable\" or \"unknown\", stale data, the integration failing to set up, \"Config entry not ready\", repeated reauth prompts, coordinator update failures, timeouts, or blocking-call warnings. Use when asked to \"debug\", \"why is my sensor unavailable\", \"the integration won't load\", \"data isn't updating\", \"check the logs\", \"restart Home Assistant\", or when investigating anything in coordinator\u002F, api\u002F, or the setup path. Covers the run loop, `script\u002Fha`, when to read `config\u002F.storage\u002F` instead, and the coordinator failure contract. SYMPTOMS — load this if you are about to: invent your own `hass`\u002F`pytest` command instead of the project scripts; read or write `config\u002F.storage\u002F` while Home Assistant is running; ask the developer to read a state or download diagnostics from the UI for you; return None from `_async_update_data` to signal failure; or catch Exception broadly in the coordinator.","amg0\u002Fha_ksenia","amg0","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F16444411?v=4","01M7AAZDRNF8BXHM6GAN9QWJ41","01M7AAZDSEHKPEWK6PKK22S2NN",0,"MIT","https:\u002F\u002Fgithub.com\u002Famg0\u002Fha_ksenia\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fha-coordinator-debug\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: ha-coordinator-debug\ndescription: >-\n  Diagnose and fix runtime problems in this Home Assistant custom integration — entities showing \"unavailable\" or\n  \"unknown\", stale data, the integration failing to set up, \"Config entry not ready\", repeated reauth prompts,\n  coordinator update failures, timeouts, or blocking-call warnings. Use when asked to \"debug\", \"why is my sensor\n  unavailable\", \"the integration won't load\", \"data isn't updating\", \"check the logs\", \"restart Home Assistant\",\n  or when investigating anything in coordinator\u002F, api\u002F, or the setup path. Covers the run loop, `script\u002Fha`, when\n  to read `config\u002F.storage\u002F` instead, and the coordinator failure contract. SYMPTOMS — load this if you are about to: invent your own\n  `hass`\u002F`pytest` command instead of the project scripts; read or write `config\u002F.storage\u002F` while Home Assistant is\n  running; ask the developer to read a state or download diagnostics from the UI for you; return None from\n  `_async_update_data` to signal failure; or catch Exception broadly in the coordinator.\n---\n\n# Debug the running integration\n\nWork from evidence, not from guesses. The order below is deliberate: reproduce, read the log, localise to a layer, then\nfix.\n\n| File                                                     | When to read                                                                          |\n| -------------------------------------------------------- | ------------------------------------------------------------------------------------- |\n| [`references\u002Fasync-rules.md`](references\u002Fasync-rules.md) | A blocking-call warning, a thread-safety error, or a hang with no traceback behind it |\n\n## 1. Reproduce with a clean instance\n\nAlways use the project scripts — hand-rolled `hass` or `pip` invocations miss the venv, `PYTHONPATH`, port cleanup, and\ndebugpy setup, and are the single most common cause of agents getting stuck.\n\n```bash\n.\u002Fscript\u002Fdevelop\n```\n\nIf Home Assistant is unresponsive or the port is held:\n\n```bash\npkill -f \"hass --config\" || true && pkill -f \"debugpy.*5678\" || true && .\u002Fscript\u002Fdevelop\n```\n\nRestart after **any** change to Python files, `manifest.json`, `services.yaml`, translations, or the config flow.\n\nOnce it is up, [`script\u002Fha`](..\u002Fblueprint-tooling\u002Freferences\u002Fha-cli.md) reads the instance directly — entity states,\nconfig entry status, diagnostics, the error log — so nothing below depends on asking the developer to look something\nup in the UI. It authenticates itself; there is no token to set up.\n\n```bash\nscript\u002Fha status     # reachable, and which version\nscript\u002Fha entries    # did the config entry actually load\n```\n\n### The instance is shared\n\nThe developer restarts Home Assistant, clicks through the UI, and tries things out while you work — often precisely\nbecause you are busy. **Never carry the instance's run state from one step to the next. Observe it.**\n\n```bash\nscript\u002Fha status    # exit 0 up, exit 2 down; `started` and `uptime` reveal a restart you did not do\n```\n\n- **A changed run state is the expected case, not a fault.** Running when you left it stopped means the developer\n  started it. Do not go through `ps`, the process tree, or the log looking for an explanation — start it, or re-run\n  your command, and carry on.\n- **Spend at most one re-check on it.** If it still does not add up, say what you observed and continue with the task.\n  Reconciling who started what is never the task.\n- **`.\u002Fscript\u002Fdevelop` takes the instance over — it is not \"start it if it is not running\".** It kills whatever is\n  already bound to `config\u002F` and starts its own, by design, because the log has to stream into the terminal that\n  launched it. So the developer's terminal falls silent, and the live log they were watching is gone. Check\n  `script\u002Fha status` first and simply use the instance that is already there. Run `script\u002Fdevelop` only when it is\n  genuinely down, or when a change to Python, `manifest.json`, `services.yaml`, translations or the config flow\n  forces a restart — and say that you are doing it. Never restart to tidy up.\n- **The same happens in reverse**, and is equally fine: when the developer runs `.\u002Fscript\u002Fdevelop`, the instance you\n  started dies and whatever file you were writing its log to stops growing. Treat that as normal and re-orient.\n- **Announce it before you take exclusive control**, so the developer knows to keep their hands off meanwhile. That\n  covers `script\u002Fsetup\u002Freset`, `script\u002Fha token --rotate` and `--revoke`, and any loop that restarts repeatedly — all\n  of them need Home Assistant stopped or undisturbed.\n- **`ha call`, `ha flow`, `ha reload` and `ha loglevel` change what the developer sees.** Cheap and reversible, but a\n  config entry created by a flow stays until someone removes it.\n- **State the run state when you finish — after checking it**, never from memory.\n\n### Ask the instance, or read the files?\n\nThere are two sources of truth for runtime state, and which one is correct depends only on whether Home Assistant is\nrunning. Getting this backwards is the most common way to debug a ghost.\n\n**While Home Assistant runs, the API is authoritative and the files under `config\u002F.storage\u002F` are stale by design** —\nthey are `Store.async_delay_save` files, written some time after the change they describe:\n\n| What                              | Written                                            |\n| --------------------------------- | -------------------------------------------------- |\n| entity \u002F device \u002F area registry   | 10 s after a change — but **180 s during startup** |\n| config entries                    | 1 s after a change                                 |\n| `core.restore_state`              | every 15 minutes, and on shutdown                  |\n| `home-assistant_v2.db` (recorder) | every `commit_interval` seconds — 30 s here        |\n\nSo a registry entry you just created can be missing from `core.entity_registry` for three minutes, and **live state is\nin none of these files at all** — `core.restore_state` is a periodic snapshot, and the recorder holds history, not the\npresent.\n\n| Question                                           | Use                                         |\n| -------------------------------------------------- | ------------------------------------------- |\n| What is this entity's state right now              | `script\u002Fha states` \u002F `entity`               |\n| Did the entry load, and why not                    | `script\u002Fha entries`                         |\n| What unique IDs \u002F registry flags does it have      | `script\u002Fha entities`                        |\n| What does the coordinator actually hand out        | `script\u002Fha diagnostics`                     |\n| Did an error happen                                | `script\u002Fha logs`, then the log file         |\n| Startup order, full traceback, surrounding context | `config\u002Fhome-assistant.log`                 |\n| The previous run                                   | `config\u002Fhome-assistant.log.1`               |\n| What a migration persisted                         | `config\u002F.storage\u002F*` — **with HA stopped**   |\n| Whether a value changed over the last hours        | `script\u002Fha watch`, or the recorder database |\n\nReading the raw files is right when Home Assistant is **stopped**: post-mortem analysis, checking what a config entry\nmigration actually wrote, or diffing `.storage` before and after a change. Then they are the only source, and they are\naccurate.\n\n**Never write into `config\u002F.storage\u002F` while Home Assistant is running.** It holds every store in memory and rewrites\nthe whole file on its next save, so your edit is discarded — silently, minutes later. `script\u002Fsetup\u002Fseed-auth` takes\nHome Assistant's own `.ha_run.lock` for exactly this reason. `config\u002F.storage\u002Fauth` and `dev_access_token` are\nadditionally read-denied: they are credentials, not debugging material.\n\n## 2. Read the log\n\nStart with the structured log — it is deduplicated, counts repeats, and keeps each traceback attached to its record:\n\n```bash\nscript\u002Fha logs --level error        # then widen to --level warning\nscript\u002Fha logs --grep coordinator\n```\n\nThe raw stream is still there when you need surrounding context: live in the terminal running `.\u002Fscript\u002Fdevelop`, and\nin `config\u002Fhome-assistant.log` (previous run in `config\u002Fhome-assistant.log.1`).\n\n```bash\nrg -n \"\u003Cdomain>|Traceback|ERROR|WARNING\" config\u002Fhome-assistant.log | tail -50\n```\n\nRaise verbosity without restarting — this takes effect immediately:\n\n```bash\nscript\u002Fha loglevel custom_components.\u003Cdomain>=debug homeassistant.helpers.update_coordinator=debug\n```\n\nIt does not survive a restart. For a level that should, put it in `config\u002Fconfiguration.yaml` and restart:\n\n```yaml\nlogger:\n  default: warning\n  logs:\n    custom_components.\u003Cdomain>: debug\n```\n\nRead the **first** error in a cascade, not the last. A wall of \"Error doing job\" usually has one root cause above it.\n\nTwo debug modes catch what no log level shows: Home Assistant's own, and asyncio's. With both on, calling an `async_*`\nAPI from the wrong thread and blocking the event loop are reported the moment they happen, instead of surfacing later\nas an unexplained hang or a state that quietly went wrong.\n\nA `debug_console:` line in `config\u002Fconfiguration.yaml` (HA 2026.11+) adds a Python console under **Settings** >\n**Tools**, with `hass` in scope — quicker than a log line and a restart for inspecting live objects. It runs in the event\nloop, so never call anything blocking there.\n\n**A config flow missing after a restart is usually the frontend cache, not the code.** Hard-refresh the browser before\ndebugging the flow.\n\n## 3. Localise the failure\n\nEach symptom has one command that produces the evidence, so you are reading state rather than guessing at it.\n\n| Symptom                                           | Command                          | Layer to inspect                                                                   |\n| ------------------------------------------------- | -------------------------------- | ---------------------------------------------------------------------------------- |\n| Integration missing from the add-integration list | `script\u002Fha setup-info`           | `manifest.json`, import error at module load — check the log at startup            |\n| \"Config entry not ready, retrying\"                | `script\u002Fha entries`              | `_async_update_data` \u002F `_async_setup` raising `ConfigEntryNotReady`                |\n| Entry loads, all entities `unavailable`           | `script\u002Fha states`               | coordinator's first refresh failed, or `last_update_success` false                 |\n| Entities available but values `unknown`\u002F`None`    | `script\u002Fha entity sensor.\u003Cid>`   | key mismatch between `coordinator.data` and the entity's read path                 |\n| Values never change                               | `script\u002Fha watch --seconds 120`  | `update_interval`, caching in the API client, or a swallowed error                 |\n| Endless reauth prompts                            | `script\u002Fha entries`              | `ConfigEntryAuthFailed` raised for a non-auth failure                              |\n| Config flow rejects valid input                   | `script\u002Fha flow start`           | see [`ha-config-flow`](..\u002Fha-config-flow\u002FSKILL.md)                                 |\n| \"Detected blocking call inside the event loop\"    | `script\u002Fha logs --level warning` | sync I\u002FO in async code — see [`ha-modern-apis`](..\u002Fha-modern-apis\u002FSKILL.md)        |\n| Entity duplicated after an update                 | `script\u002Fha entities`             | `unique_id` changed — see [`ha-breaking-changes`](..\u002Fha-breaking-changes\u002FSKILL.md) |\n\n`script\u002Fha entries` prints the entry `state` and its `reason` — the same text the UI shows, which is usually the whole\ndiagnosis for a setup failure.\n\n`script\u002Fha watch` deserves care: Home Assistant fires `state_changed` only when the state or an attribute genuinely\nchanges, so an empty watch is a finding, not a failed measurement. It means the coordinator is handing back identical\ndata, not that notification is broken.\n\nCross-check the actual payload rather than assuming its shape:\n\n```python\nLOGGER.debug(\"Coordinator data: %s\", self.data)\n```\n\n`script\u002Fha diagnostics | jq .data` shows the same payload without an edit and a restart, whenever the integration\nimplements diagnostics.\n\n## 4. Check the failure contract\n\n`_async_update_data` communicates through exception type, and getting it wrong is the root of most availability bugs.\nThe exception mapping table is in\n[`blueprint.coordinator.instructions.md`](..\u002F..\u002Finstructions\u002Fblueprint.coordinator.instructions.md). Read the\ncoordinator against it and check for the four failures that table cannot express:\n\n- **Signalling failure by returning** `None` or an empty dict instead of raising. Entities then show `unknown` forever\n  instead of going unavailable, and nothing retries.\n- **A broad `except Exception`** that swallows the auth error, so reauth never triggers and the entry just looks broken.\n  The OAuth2 helper's token errors are the same trap — see the instructions file's Authentication rules.\n- **Logging on every failed poll.** The coordinator logs the first failure and then stays quiet by design\n  (`log-when-unavailable`, Silver). Manual logging buries the real error in repetition.\n- **`ConfigEntryNotReady` raised outside setup**, or `async_config_entry_first_refresh()` called outside setup.\n\n## 5. Common fixes\n\n**Update interval too aggressive** — the Bronze `appropriate-polling` rule. Local devices ~30 s, cloud services\n~5–15 min, fixed in code — never a user option\n([`blueprint.config_flow`](..\u002F..\u002Finstructions\u002Fblueprint.config_flow.instructions.md#data-vs-options)).\n\n**Timeouts** — every request needs one, with `asyncio.timeout`, never a bare `await`:\n\n```python\nasync with asyncio.timeout(10):\n    response = await self._session.get(url)\n```\n\n**Partial data** — when only part of the payload is missing, keep the previous value instead of dropping the whole\nupdate; only raise when the update is genuinely useless.\n\n**Entity reads the wrong key** — compare the `EntityDescription.key` \u002F `value_fn` against the logged payload.\n\n**Setup ordering** — expensive one-off work (fetching device metadata, capabilities) belongs in `_async_setup()`, which\nruns once before the first refresh, not in `_async_update_data`.\n\n**A listener or reconnect loop that outlives an unload** — start it with\n`entry.async_create_background_task(hass, coro, name)`, which is cancelled when the entry unloads and does not hold up\nstartup. `hass.async_create_task` survives the unload and keeps running against a dead entry.\n\n## 6. Confirm the fix\n\n```bash\nscript\u002Flint && script\u002Ftype-check\nscript\u002Ftest\n```\n\nRestart, reproduce the original scenario, and confirm the log is clean:\n\n```bash\npkill -f \"hass --config\" && .\u002Fscript\u002Fdevelop     # any change to a .py file needs this\nscript\u002Fha entries                                 # state: loaded, reason: -\nscript\u002Fha states                                  # the values you expected\nscript\u002Fha logs --level warning                    # nothing new\n```\n\nIf the failure was data-shaped, check the payload directly — `script\u002Fha diagnostics | jq .data` should now show the\ncorrected structure. Diagnostics must run everything through `async_redact_data()`; if you added a field, make sure it\nis redacted when sensitive.\n\n`script\u002Fha reload` is the shortcut when the change is confined to entry data or options — it reloads the config entry\nwithout restarting the instance. It does **not** re-import Python, so it is never a substitute for a restart after a\ncode edit.\n\n## 7. Add a regression test\n\nA runtime bug that reached a user is exactly the case where a test pays for itself. Add one that reproduces the\noriginal failure before the fix. See [`ha-testing`](..\u002Fha-testing\u002FSKILL.md).\n\n## Stop conditions\n\nAfter three failed attempts at the same error, stop and report what you tried and what you observed. Do not keep\nlooping — a wrong mental model does not improve with repetition.\n","# Debug the running integration\n\nWork from evidence, not from guesses. The order below is deliberate: reproduce, read the log, localise to a layer, then\nfix.\n\n| File                                                     | When to read                                                                          |\n| -------------------------------------------------------- | ------------------------------------------------------------------------------------- |\n| [`references\u002Fasync-rules.md`](references\u002Fasync-rules.md) | A blocking-call warning, a thread-safety error, or a hang with no traceback behind it |\n\n## 1. Reproduce with a clean instance\n\nAlways use the project scripts — hand-rolled `hass` or `pip` invocations miss the venv, `PYTHONPATH`, port cleanup, and\ndebugpy setup, and are the single most common cause of agents getting stuck.\n\n```bash\n.\u002Fscript\u002Fdevelop\n```\n\nIf Home Assistant is unresponsive or the port is held:\n\n```bash\npkill -f \"hass --config\" || true && pkill -f \"debugpy.*5678\" || true && .\u002Fscript\u002Fdevelop\n```\n\nRestart after **any** change to Python files, `manifest.json`, `services.yaml`, translations, or the config flow.\n\nOnce it is up, [`script\u002Fha`](..\u002Fblueprint-tooling\u002Freferences\u002Fha-cli.md) reads the instance directly — entity states,\nconfig entry status, diagnostics, the error log — so nothing below depends on asking the developer to look something\nup in the UI. It authenticates itself; there is no token to set up.\n\n```bash\nscript\u002Fha status     # reachable, and which version\nscript\u002Fha entries    # did the config entry actually load\n```\n\n### The instance is shared\n\nThe developer restarts Home Assistant, clicks through the UI, and tries things out while you work — often precisely\nbecause you are busy. **Never carry the instance's run state from one step to the next. Observe it.**\n\n```bash\nscript\u002Fha status    # exit 0 up, exit 2 down; `started` and `uptime` reveal a restart you did not do\n```\n\n- **A changed run state is the expected case, not a fault.** Running when you left it stopped means the developer\n  started it. Do not go through `ps`, the process tree, or the log looking for an explanation — start it, or re-run\n  your command, and carry on.\n- **Spend at most one re-check on it.** If it still does not add up, say what you observed and continue with the task.\n  Reconciling who started what is never the task.\n- **`.\u002Fscript\u002Fdevelop` takes the instance over — it is not \"start it if it is not running\".** It kills whatever is\n  already bound to `config\u002F` and starts its own, by design, because the log has to stream into the terminal that\n  launched it. So the developer's terminal falls silent, and the live log they were watching is gone. Check\n  `script\u002Fha status` first and simply use the instance that is already there. Run `script\u002Fdevelop` only when it is\n  genuinely down, or when a change to Python, `manifest.json`, `services.yaml`, translations or the config flow\n  forces a restart — and say that you are doing it. Never restart to tidy up.\n- **The same happens in reverse**, and is equally fine: when the developer runs `.\u002Fscript\u002Fdevelop`, the instance you\n  started dies and whatever file you were writing its log to stops growing. Treat that as normal and re-orient.\n- **Announce it before you take exclusive control**, so the developer knows to keep their hands off meanwhile. That\n  covers `script\u002Fsetup\u002Freset`, `script\u002Fha token --rotate` and `--revoke`, and any loop that restarts repeatedly — all\n  of them need Home Assistant stopped or undisturbed.\n- **`ha call`, `ha flow`, `ha reload` and `ha loglevel` change what the developer sees.** Cheap and reversible, but a\n  config entry created by a flow stays until someone removes it.\n- **State the run state when you finish — after checking it**, never from memory.\n\n### Ask the instance, or read the files?\n\nThere are two sources of truth for runtime state, and which one is correct depends only on whether Home Assistant is\nrunning. Getting this backwards is the most common way to debug a ghost.\n\n**While Home Assistant runs, the API is authoritative and the files under `config\u002F.storage\u002F` are stale by design** —\nthey are `Store.async_delay_save` files, written some time after the change they describe:\n\n| What                              | Written                                            |\n| --------------------------------- | -------------------------------------------------- |\n| entity \u002F device \u002F area registry   | 10 s after a change — but **180 s during startup** |\n| config entries                    | 1 s after a change                                 |\n| `core.restore_state`              | every 15 minutes, and on shutdown                  |\n| `home-assistant_v2.db` (recorder) | every `commit_interval` seconds — 30 s here        |\n\nSo a registry entry you just created can be missing from `core.entity_registry` for three minutes, and **live state is\nin none of these files at all** — `core.restore_state` is a periodic snapshot, and the recorder holds history, not the\npresent.\n\n| Question                                           | Use                                         |\n| -------------------------------------------------- | ------------------------------------------- |\n| What is this entity's state right now              | `script\u002Fha states` \u002F `entity`               |\n| Did the entry load, and why not                    | `script\u002Fha entries`                         |\n| What unique IDs \u002F registry flags does it have      | `script\u002Fha entities`                        |\n| What does the coordinator actually hand out        | `script\u002Fha diagnostics`                     |\n| Did an error happen                                | `script\u002Fha logs`, then the log file         |\n| Startup order, full traceback, surrounding context | `config\u002Fhome-assistant.log`                 |\n| The previous run                                   | `config\u002Fhome-assistant.log.1`               |\n| What a migration persisted                         | `config\u002F.storage\u002F*` — **with HA stopped**   |\n| Whether a value changed over the last hours        | `script\u002Fha watch`, or the recorder database |\n\nReading the raw files is right when Home Assistant is **stopped**: post-mortem analysis, checking what a config entry\nmigration actually wrote, or diffing `.storage` before and after a change. Then they are the only source, and they are\naccurate.\n\n**Never write into `config\u002F.storage\u002F` while Home Assistant is running.** It holds every store in memory and rewrites\nthe whole file on its next save, so your edit is discarded — silently, minutes later. `script\u002Fsetup\u002Fseed-auth` takes\nHome Assistant's own `.ha_run.lock` for exactly this reason. `config\u002F.storage\u002Fauth` and `dev_access_token` are\nadditionally read-denied: they are credentials, not debugging material.\n\n## 2. Read the log\n\nStart with the structured log — it is deduplicated, counts repeats, and keeps each traceback attached to its record:\n\n```bash\nscript\u002Fha logs --level error        # then widen to --level warning\nscript\u002Fha logs --grep coordinator\n```\n\nThe raw stream is still there when you need surrounding context: live in the terminal running `.\u002Fscript\u002Fdevelop`, and\nin `config\u002Fhome-assistant.log` (previous run in `config\u002Fhome-assistant.log.1`).\n\n```bash\nrg -n \"\u003Cdomain>|Traceback|ERROR|WARNING\" config\u002Fhome-assistant.log | tail -50\n```\n\nRaise verbosity without restarting — this takes effect immediately:\n\n```bash\nscript\u002Fha loglevel custom_components.\u003Cdomain>=debug homeassistant.helpers.update_coordinator=debug\n```\n\nIt does not survive a restart. For a level that should, put it in `config\u002Fconfiguration.yaml` and restart:\n\n```yaml\nlogger:\n  default: warning\n  logs:\n    custom_components.\u003Cdomain>: debug\n```\n\nRead the **first** error in a cascade, not the last. A wall of \"Error doing job\" usually has one root cause above it.\n\nTwo debug modes catch what no log level shows: Home Assistant's own, and asyncio's. With both on, calling an `async_*`\nAPI from the wrong thread and blocking the event loop are reported the moment they happen, instead of surfacing later\nas an unexplained hang or a state that quietly went wrong.\n\nA `debug_console:` line in `config\u002Fconfiguration.yaml` (HA 2026.11+) adds a Python console under **Settings** >\n**Tools**, with `hass` in scope — quicker than a log line and a restart for inspecting live objects. It runs in the event\nloop, so never call anything blocking there.\n\n**A config flow missing after a restart is usually the frontend cache, not the code.** Hard-refresh the browser before\ndebugging the flow.\n\n## 3. Localise the failure\n\nEach symptom has one command that produces the evidence, so you are reading state rather than guessing at it.\n\n| Symptom                                           | Command                          | Layer to inspect                                                                   |\n| ------------------------------------------------- | -------------------------------- | ---------------------------------------------------------------------------------- |\n| Integration missing from the add-integration list | `script\u002Fha setup-info`           | `manifest.json`, import error at module load — check the log at startup            |\n| \"Config entry not ready, retrying\"                | `script\u002Fha entries`              | `_async_update_data` \u002F `_async_setup` raising `ConfigEntryNotReady`                |\n| Entry loads, all entities `unavailable`           | `script\u002Fha states`               | coordinator's first refresh failed, or `last_update_success` false                 |\n| Entities available but values `unknown`\u002F`None`    | `script\u002Fha entity sensor.\u003Cid>`   | key mismatch between `coordinator.data` and the entity's read path                 |\n| Values never change                               | `script\u002Fha watch --seconds 120`  | `update_interval`, caching in the API client, or a swallowed error                 |\n| Endless reauth prompts                            | `script\u002Fha entries`              | `ConfigEntryAuthFailed` raised for a non-auth failure                              |\n| Config flow rejects valid input                   | `script\u002Fha flow start`           | see [`ha-config-flow`](..\u002Fha-config-flow\u002FSKILL.md)                                 |\n| \"Detected blocking call inside the event loop\"    | `script\u002Fha logs --level warning` | sync I\u002FO in async code — see [`ha-modern-apis`](..\u002Fha-modern-apis\u002FSKILL.md)        |\n| Entity duplicated after an update                 | `script\u002Fha entities`             | `unique_id` changed — see [`ha-breaking-changes`](..\u002Fha-breaking-changes\u002FSKILL.md) |\n\n`script\u002Fha entries` prints the entry `state` and its `reason` — the same text the UI shows, which is usually the whole\ndiagnosis for a setup failure.\n\n`script\u002Fha watch` deserves care: Home Assistant fires `state_changed` only when the state or an attribute genuinely\nchanges, so an empty watch is a finding, not a failed measurement. It means the coordinator is handing back identical\ndata, not that notification is broken.\n\nCross-check the actual payload rather than assuming its shape:\n\n```python\nLOGGER.debug(\"Coordinator data: %s\", self.data)\n```\n\n`script\u002Fha diagnostics | jq .data` shows the same payload without an edit and a restart, whenever the integration\nimplements diagnostics.\n\n## 4. Check the failure contract\n\n`_async_update_data` communicates through exception type, and getting it wrong is the root of most availability bugs.\nThe exception mapping table is in\n[`blueprint.coordinator.instructions.md`](..\u002F..\u002Finstructions\u002Fblueprint.coordinator.instructions.md). Read the\ncoordinator against it and check for the four failures that table cannot express:\n\n- **Signalling failure by returning** `None` or an empty dict instead of raising. Entities then show `unknown` forever\n  instead of going unavailable, and nothing retries.\n- **A broad `except Exception`** that swallows the auth error, so reauth never triggers and the entry just looks broken.\n  The OAuth2 helper's token errors are the same trap — see the instructions file's Authentication rules.\n- **Logging on every failed poll.** The coordinator logs the first failure and then stays quiet by design\n  (`log-when-unavailable`, Silver). Manual logging buries the real error in repetition.\n- **`ConfigEntryNotReady` raised outside setup**, or `async_config_entry_first_refresh()` called outside setup.\n\n## 5. Common fixes\n\n**Update interval too aggressive** — the Bronze `appropriate-polling` rule. Local devices ~30 s, cloud services\n~5–15 min, fixed in code — never a user option\n([`blueprint.config_flow`](..\u002F..\u002Finstructions\u002Fblueprint.config_flow.instructions.md#data-vs-options)).\n\n**Timeouts** — every request needs one, with `asyncio.timeout`, never a bare `await`:\n\n```python\nasync with asyncio.timeout(10):\n    response = await self._session.get(url)\n```\n\n**Partial data** — when only part of the payload is missing, keep the previous value instead of dropping the whole\nupdate; only raise when the update is genuinely useless.\n\n**Entity reads the wrong key** — compare the `EntityDescription.key` \u002F `value_fn` against the logged payload.\n\n**Setup ordering** — expensive one-off work (fetching device metadata, capabilities) belongs in `_async_setup()`, which\nruns once before the first refresh, not in `_async_update_data`.\n\n**A listener or reconnect loop that outlives an unload** — start it with\n`entry.async_create_background_task(hass, coro, name)`, which is cancelled when the entry unloads and does not hold up\nstartup. `hass.async_create_task` survives the unload and keeps running against a dead entry.\n\n## 6. Confirm the fix\n\n```bash\nscript\u002Flint && script\u002Ftype-check\nscript\u002Ftest\n```\n\nRestart, reproduce the original scenario, and confirm the log is clean:\n\n```bash\npkill -f \"hass --config\" && .\u002Fscript\u002Fdevelop     # any change to a .py file needs this\nscript\u002Fha entries                                 # state: loaded, reason: -\nscript\u002Fha states                                  # the values you expected\nscript\u002Fha logs --level warning                    # nothing new\n```\n\nIf the failure was data-shaped, check the payload directly — `script\u002Fha diagnostics | jq .data` should now show the\ncorrected structure. Diagnostics must run everything through `async_redact_data()`; if you added a field, make sure it\nis redacted when sensitive.\n\n`script\u002Fha reload` is the shortcut when the change is confined to entry data or options — it reloads the config entry\nwithout restarting the instance. It does **not** re-import Python, so it is never a substitute for a restart after a\ncode edit.\n\n## 7. Add a regression test\n\nA runtime bug that reached a user is exactly the case where a test pays for itself. Add one that reproduces the\noriginal failure before the fix. See [`ha-testing`](..\u002Fha-testing\u002FSKILL.md).\n\n## Stop conditions\n\nAfter three failed attempts at the same error, stop and report what you tried and what you observed. Do not keep\nlooping — a wrong mental model does not improve with repetition.\n",{"name":5,"description":7},"main","3a408474735fec0ac5d62b86fc842420a899e090",".agents\u002Fskills\u002Fha-coordinator-debug","https:\u002F\u002Fgithub.com\u002Famg0\u002Fha_ksenia","https:\u002F\u002Fgithub.com\u002Famg0","2026-11-15 01:01:02",{"source":8,"skillName":5,"commands":30,"prompt":40,"zipAvailable":41},[31,34,37],{"tool":32,"command":33},"npx","npx skills add amg0\u002Fha_ksenia --skill ha-coordinator-debug",{"tool":35,"command":36},"bunx","bunx skills add amg0\u002Fha_ksenia --skill ha-coordinator-debug",{"tool":38,"command":39},"pnpm","pnpm dlx skills add amg0\u002Fha_ksenia --skill ha-coordinator-debug","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Famg0\u002Fha_ksenia\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fha-coordinator-debug\u002FSKILL.md",true,[43],{"path":44,"resourceType":45,"resourceTypeDesc":46,"sizeBytes":47,"sourceHtmlUrl":48},"references\u002Fasync-rules.md","REFERENCE","参考文档",6757,"https:\u002F\u002Fgithub.com\u002Famg0\u002Fha_ksenia\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fha-coordinator-debug\u002Freferences\u002Fasync-rules.md",[50,57,64,71,78,85],{"skillNo":51,"name":52,"nameZh":6,"description":53,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":54,"categories":55,"keywords":56,"publishedAt":18},"01M7AB5RYA92GRR64CP6VMWV6Z","issues","Triage\u002Ffix the GitHub issue backlog via branch + PR, with auto-merge on green CI for this session.","https:\u002F\u002Fgithub.com\u002Famg0\u002Fha_ksenia\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fissues\u002FSKILL.md",[],[],{"skillNo":58,"name":59,"nameZh":6,"description":60,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":18},"01M7AB5G6DR1KGAPRT7JHDCD2Y","ha-translations","Add or fix user-facing strings for this Home Assistant custom integration — translations\u002Fen.json and other languages, icons.json, entity names and states, config flow labels and errors, service action descriptions, exception messages, and repair issue text. Use when asked to \"update translations\", \"add a translation key\", \"translate\", \"fix the entity name\", \"add strings for the new sensor\u002Faction\u002Foption\", \"add icons\", or when hassfest reports a missing or unused translation key. Covers the key structure, which keys each feature needs, placeholders, the icons.json contract, and the project's strict rule about only touching en.json. SYMPTOMS — load this if you are about to: write user-facing English into Python; edit a language file other than `en.json`; add an entity without its `entity.\u003Cplatform>.\u003Ckey>.name` key; skip `data_description` on a config flow field; or set `icon=` instead of using `icons.json`.","https:\u002F\u002Fgithub.com\u002Famg0\u002Fha_ksenia\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fha-translations\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":18},"01M7AB56JBRMF19W4N2NG9Y5GW","ha-testing","Write, fix, or extend automated tests for this Home Assistant custom integration using pytest and pytest-homeassistant-custom-component. Use when asked to \"add tests\", \"write a test\", \"the tests fail\", \"improve coverage\", \"add a regression test\", \"test the config flow\", \"update snapshots\", or when a behavioural change needs verification before it can be called done. Covers the tests\u002F layout, the conftest.py fixtures this project needs, mocking the API client, config flow and entity test patterns, registry assertions, syrupy snapshots, freezing time, and the script\u002Ftest commands. SYMPTOMS — load this if you are about to: instantiate an entity class directly instead of asserting on `hass.states`; write a test without `enable_custom_integrations`; use `time.sleep` instead of `async_fire_time_changed`; silence a DeprecationWarning to make the suite pass; or commit a snapshot you have not read.","https:\u002F\u002Fgithub.com\u002Famg0\u002Fha_ksenia\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fha-testing\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":18},"01M7AB4V9XKDYRDCRHEA68GRZ5","ha-service-action","Add, change, or remove a Home Assistant service action (also called a \"service\" or \"action\") in this custom integration. Use when asked to \"add a service\", \"add an action\", \"expose X as a service call\", \"add a service that returns data\", \"make this callable from an automation\", or when editing services.yaml, the service_actions\u002F package, service schemas, service response data, or the async_setup() registration. Covers the services.yaml contract, probatio schemas, selectors, entity\u002Fdevice targeting, response data, translated error messages, and the Bronze quality-scale rule that actions must be registered in async_setup(). SYMPTOMS — load this if you are about to: register an action in `async_setup_entry()`; add a `services.yaml` field without a selector; add an `entity_id` field where `target:` belongs; raise a plain English `HomeAssistantError`; or swallow an action failure into a log line.","https:\u002F\u002Fgithub.com\u002Famg0\u002Fha_ksenia\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fha-service-action\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":18},"01M7AB4J65REZ9T9VS9MQH73CC","ha-release","Cut a release of this Home Assistant custom integration, or prepare the commits that feed it. Use when asked to \"release\", \"cut a version\", \"bump the version\", \"prepare release notes\", \"what will the next version be\", \"write a commit message\", \"why didn't release-please pick this up\", or when reviewing whether a change is user-facing. Covers the Conventional Commits rules commitlint enforces here, how release-please derives the version and changelog, the pre-1.0 bump rules, script\u002Fversion and script\u002Frelease-notes, skipping a commit from the notes, and the commit rules this project enforces for agents. SYMPTOMS — load this if you are about to: commit without an explicit request; offer to `git push`; label a user-facing fix as `chore` (chore, like every hidden type, never reaches the changelog and never triggers a release); write a commit subject over 100 characters or in sentence case; or edit the version in `manifest.json` by hand.","https:\u002F\u002Fgithub.com\u002Famg0\u002Fha_ksenia\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fha-release\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":18},"01M7AB48WMPGDK2REBC3WS8T32","ha-quality-review","Perform a structured quality review of this Home Assistant custom integration, either as a full audit or scoped to a diff. Use when asked to \"review the integration\", \"audit the code\", \"check quality scale\", \"are we bronze\u002Fsilver\u002Fgold\", \"is this ready to release\", \"review my changes\", \"what's missing before publishing\", or before opening a pull request that touches integration code. Covers running the automated gates first, then auditing architecture, the Integration Quality Scale rules, error handling, security, performance, user experience, and documentation — and reporting findings ranked by severity with concrete fixes. SYMPTOMS — load this if you are about to: report a review that only restates linter output; claim real-device testing that did not happen; give a finding without a file path and a fix; or judge quality without running `script\u002Fhassfest` and the test suite first.","https:\u002F\u002Fgithub.com\u002Famg0\u002Fha_ksenia\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fha-quality-review\u002FSKILL.md",[],[]]