Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
d879827
Create stale.yml
KJonline Nov 9, 2025
233fe3e
Merge pull request #184 from Pyhass/Add-stale-issue-action
KJonline Nov 9, 2025
73bb288
feat: ignore brands validation in HACS hassfest workflow
KJonline Nov 9, 2025
e9ab17b
Update stale.yml
KJonline Nov 10, 2025
dd04218
chore: bump pyhive-integration dependency to 1.0.7
KJonline Nov 10, 2025
699ad4e
chore: bump version to 2025.11.2
KJonline Nov 10, 2025
d87d876
Merge pull request #186 from Pyhass/Fix-authentication-Issue
KJonline Nov 10, 2025
6c2d99d
feat: improve stale issue/PR workflow with configurable timeouts
KJonline Nov 10, 2025
cfe38d8
Fix Hive reauth loop by persisting device metadata; add debug 2FA toggle
tamunro93 Feb 23, 2026
4c8bf45
Merge pull request #193 from tamunro93/codex/hive-auth-device-metadat…
KJonline Feb 27, 2026
8c8ffe4
chore: update pyhive-integration dependency to stable 1.0.8 release
KJonline Feb 27, 2026
90a7904
Merge pull request #194 from Pyhass/1.0.8
KJonline Feb 27, 2026
27991d6
chore: update pyhive-integration dependency to 1.0.9.dev1
KJonline Mar 7, 2026
6764a1f
Update version in manifest.json to 2026.3.1b2
KJonline Mar 11, 2026
81fbe68
chore: bump version to 2026.3.1b3 and update pyhive-integration to 1.…
KJonline Mar 15, 2026
5f03c35
chore: bump version to 2026.3.1b4 and update pyhive-integration to 1.…
KJonline Mar 22, 2026
6463566
chore: add device registration check during 2FA reauth flow
KJonline Mar 22, 2026
b9655aa
chore: bump version to 2026.4.1 and update pyhive-integration to stab…
KJonline Apr 12, 2026
70a7d81
Merge branch 'master' into 1.0.9-dev-build
KJonline Apr 12, 2026
ac43070
Merge pull request #200 from Pyhass/1.0.9-dev-build
KJonline Apr 12, 2026
99e34fd
chore: bump version to 2026.8.0 and refactor sensor entity with impro…
KJonline Aug 8, 2026
5cda138
Merge pull request #206 from Pyhass/Fix-sensor-changes
KJonline Aug 8, 2026
c407de5
chore: update GitHub workflows, documentation, and code formatting
KJonline Sep 28, 2026
9cbde95
chore: pin astral-sh/setup-uv to v10.2.0 and update documentation URL…
KJonline Sep 28, 2026
40e5487
chore: add CODEOWNERS file with automatic review assignment for @KJon…
KJonline Sep 28, 2026
1a55d87
Merge pull request #211 from Pyhass/ci/maintenance-workflows
KJonline Sep 28, 2026
77857a6
chore: add test infrastructure with fixtures, config flow tests, and …
KJonline Sep 29, 2026
293ac28
Merge branch 'master' of https://github.com/Pyhass/Hive-Custom-Component
KJonline Sep 29, 2026
7f4af8d
chore: add Claude Code skills, maintenance documentation, and develop…
KJonline Sep 29, 2026
c099716
chore: resolve merge conflicts in test files, PR template, and gitignore
KJonline Sep 29, 2026
3d7a5f8
Bump pytest-homeassistant-custom-component from 0.13.367 to 0.13.370
dependabot[bot] Oct 11, 2026
3f3e358
Bump ruff from 0.16.9 to 0.16.10
dependabot[bot] Oct 11, 2026
95279ba
deps: bump pyhive-integration to 2.0.0b4
KJonline Oct 15, 2026
d7c8280
Merge pull request #212 from Pyhass/dependabot/pip/pytest-homeassista…
KJonline Oct 15, 2026
5407645
Merge branch 'master' into dependabot/pip/ruff-0.16.10
KJonline Oct 15, 2026
46f2eb8
Merge pull request #213 from Pyhass/dependabot/pip/ruff-0.16.10
KJonline Oct 15, 2026
bfc9f84
chore: adopt override principles in CI, skills and docs
KJonline Oct 16, 2026
a6cb490
Merge pull request #215 from Pyhass/chore/override-principles
KJonline Oct 16, 2026
ff3432c
Merge branch 'master' into deps/pyhive-integration-2.0.0b4
KJonline Oct 16, 2026
969d4c7
release: 2026.10.1b2
KJonline Oct 16, 2026
fe3b2b0
Merge pull request #214 from Pyhass/deps/pyhive-integration-2.0.0b4
KJonline Oct 16, 2026
823dea1
deps: downgrade pyhive-integration to 1.0.10
KJonline Oct 20, 2026
5e63418
refactor: revert to core hive integration structure and downgrade to …
KJonline Oct 20, 2026
a321be0
Merge pull request #221 from Pyhass/2026.10.1-release
KJonline Oct 20, 2026
844142a
Add HACS badge to README
KJonline Oct 20, 2026
410c085
chore(deps): bump pytest-homeassistant-custom-component
dependabot[bot] Nov 1, 2026
6dca35c
chore(deps): bump ruff from 0.16.10 to 0.17.3
dependabot[bot] Nov 1, 2026
fb54c16
Merge pull request #229 from Pyhass/dependabot/pip/ruff-0.17.3
KJonline Nov 1, 2026
ed9fc80
Merge branch 'master' into dependabot/pip/pytest-homeassistant-custom…
KJonline Nov 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .claude/skills/bump-pyhive/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
name: bump-pyhive
description: Update the pyhive-integration (apyhiveapi) requirement in the Hive custom component's manifest.json, review what changed in the library, and verify the component against it. Use when a pyhive bump PR is open, a new pyhive release or beta is out, before cutting a component beta, or the user wants to test a pyhive beta/dev build.
---

# Bump pyhive-integration

`pyhive-integration` (imported as `apyhiveapi`) is pinned in `custom_components/hive/manifest.json` `requirements`. Dependabot can't bump it, so `.github/workflows/pyhive_bump.yml` opens `deps/pyhive-integration-<ver>` PRs instead.

Read the principles in `CLAUDE.md` first. In short:
- This repo may pin a **newer** `pyhive-integration` than core hive does, including pre-releases. That's intended.
- Keep the pin exact (`==`). Don't switch to `>=` to quiet hassfest; `.github/scripts/hassfest.py` already treats that difference as a warning.
- A pre-release pin can only ship in a component **beta**. A stable component release needs a stable pin.

## 1. Pick the target
```bash
jq -r '.requirements[]' custom_components/hive/manifest.json # current pin
curl -fsS https://pypi.org/pypi/pyhive-integration/json | jq -r '.info.version' # latest stable
# newest version overall, pre-releases included (sorted as versions, not by upload date)
curl -fsS https://pypi.org/pypi/pyhive-integration/json | jq -r '.releases | keys[]' \
| .venv/bin/python -c 'import sys; from packaging.version import Version; print(max(sys.stdin.read().split(), key=Version))'
gh pr list --search "pyhive-integration in:title" --state open # existing PR?
```
- For a beta (or when the user asks for "latest"), the target is the newest version overall.
- For a stable release, the target is the latest stable.
- Also note core's pin, from `.venv/lib/python*/site-packages/homeassistant/components/hive/manifest.json`. Core's re-exported platforms are written against it, so a big gap needs a closer look.

If there's already an open PR for the target, work on that branch (`gh pr checkout <n>`) instead of making a new change.

## 2. Review what changed
`uv pip download` doesn't exist, so fetch the wheels from PyPI's JSON API into the scratchpad and unpack them there:
```bash
S=<scratchpad>/pyhive
for v in <current> <target>; do
url=$(curl -fsS "https://pypi.org/pypi/pyhive-integration/$v/json" | jq -r '[.urls[]|select(.packagetype=="bdist_wheel")][0].url')
mkdir -p "$S/dl-$v" "$S/src-$v" && curl -fsSL -o "$S/dl-$v/pkg.whl" "$url" && unzip -qo "$S/dl-$v/pkg.whl" -d "$S/src-$v"
done
diff -rq "$S/src-<current>/apyhiveapi" "$S/src-<target>/apyhiveapi"
```
Check anything this component, or core's re-exported platforms, calls:
- `Auth` methods used in `config_flow.py` and `__init__.py`: `login`, `sms_2fa`, `device_registration`, `get_device_data`, `is_device_registered`, `forget_device`. Also the attributes the flow sets: `access_token`, `device_group_key`, `device_key`.
- `Hive`, `session.startSession`, `session.deviceList`, `session.updateData`, `updateInterval`.
- Every `hive.<platform>.<method>(` call in the component and in core's hive platforms (`grep -hoE "hive\.[a-z_]+\.[A-Za-z_]+\(" ...`). Confirm each exists on the target with a compatible signature, at runtime rather than by reading code.
- How devices are accessed (`device["hiveType"]`, `.get("deviceData")`). 2.x devices are dataclasses with a legacy-key mapping.
- `PRODUCTS`, `DEVICES` and the sensor dispatch. A new or renamed `hiveType` needs a matching `SENSOR_TYPES` entry in `sensor.py`, or core's platform descriptions, before it shows up in HA.
- Exceptions in `helper/hive_exceptions.py`, especially anything `startSession` can now raise. `async_setup_entry` must map it: connection problems to `ConfigEntryNotReady`, credential or config problems to `ConfigEntryAuthFailed`.

Also check that `pyhive-integration` isn't in HA's `homeassistant/package_constraints.txt`. If it ever is, HA won't install a different version, and principle 2 needs rethinking.

## 3. Apply and verify
- Change only the `pyhive-integration==` pin in `manifest.json`. Don't change the component `version`; that happens at release.
- Install and test:
```bash
VIRTUAL_ENV=.venv uv pip install --refresh-package pyhive-integration "pyhive-integration==<target>"
script/test
script/lint --check
python3 .github/scripts/hassfest.py # needs Docker; the pyhive line should be a warning
```
(`--refresh-package` matters for a release published in the last few hours.)
- The tests mock the library. On 2.x, also run an offline session from the bundled `data/data.json` (username `use@file.com`) and call the real getters for every platform.
- Where the diff showed behaviour changes, add tests for them.
- For a pre-release target, the next step is a component beta (`/release`). For a stable target, it can go in the next stable release.

## 4. Report
Report:
- the version change, and how it compares with core's pin
- a short summary of the library changes that matter to this component, with any risks
- the test, lint and hassfest results
- whether it's ready to merge, and whether it can ship stable or only as a beta

If a bot PR has no CI runs, remind the user to close and reopen it, or to set up the `BOT_TOKEN` secret. Don't commit, push, or merge unless asked.
62 changes: 62 additions & 0 deletions .claude/skills/release/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
name: release
description: Cut a beta or stable release of the Hive custom component - check for the newest pyhive-integration (betas included) when releasing a beta, bump manifest.json, publish the GitHub release with a matching tag, and verify the Release workflow. Use when the user asks to release, ship, tag, or publish a version or beta.
---

# Release

Follow MAINTAINING.md → "Releasing", and the principles in `CLAUDE.md`. The rules that matter:
- **Betas are the fast, opt-in channel.** They're how new `pyhive-integration` builds and fixes reach users before core HA ships them. Stable releases go to every HACS user.
- The tag must equal `version` in `custom_components/hive/manifest.json`, for example `2026.10.0` or `2026.10.0b1`. Use a lowercase `b`, with no dot before it.
- Beta tags (`bN`) are always published as pre-releases. Stable tags never are.
- A stable release must pin a stable `pyhive-integration`. A pre-release pin only ships in a beta. `check_release.py` fails the Release run otherwise, but by then the release is already public, so check before publishing.
- Publishing a release is visible to every HACS user, and so is deleting one. **Confirm the exact tag and whether it is a pre-release with the user before running `gh release create`.** Never commit, push, or open PRs unless the user asks.

## Steps

1. **Pick the version.**
- Read the current `version` from the manifest and list recent tags: `gh release list -L 10`.
- Propose the next version and let the user confirm or change it:
- New month: `YEAR.MONTH.0`.
- Same month: bump the patch number.
- Beta: add `b1`, or the next free `bN`.

2. **Check pyhive-integration.**
- **Beta:** always look up the newest version on PyPI, pre-releases included:
```bash
curl -fsS https://pypi.org/pypi/pyhive-integration/json | jq -r '.releases | keys[]' \
| .venv/bin/python -c 'import sys; from packaging.version import Version; print(max(sys.stdin.read().split(), key=Version))'
jq -r '.requirements[]' custom_components/hive/manifest.json
```
If it's newer than the pin, run `/bump-pyhive` for it first, and get that merged to `master`, unless the user decides to skip it. Check for an open `deps/pyhive-integration-*` PR before starting a new one.
- **Stable:** the pin must not be a pre-release. If `master` pins a pyhive beta, stop: either wait for a stable pyhive, or move the pin to the latest stable with `/bump-pyhive` first.

3. **Check it's safe to ship.**
- `gh run list -w ci.yml -b master -L 1` and `gh run list -w compat.yml -L 1` must both be green. If either is red, stop and report. For a red Compatibility run, suggest `/triage-compat`.
- A hassfest **warning** about `pyhive-integration` differing from core hive is expected (see `CLAUDE.md`). Only errors count.
- `script/test` and `script/lint --check` must pass locally.
- Check `git log <last-tag>..origin/master --oneline`. If there's nothing to release, say so.

4. **Bump the manifest.** Change only the `version` value in `manifest.json`. Don't touch `requirements`; that's `/bump-pyhive`. The change must reach `master` before tagging:
- If the user asks, make a branch `release/<version>`, commit it, and open a PR.
- Otherwise hand the change over for them to commit.
- Wait until it's merged, then check with `git fetch && git show origin/master:custom_components/hive/manifest.json | jq -r '.version, .requirements[]'`.

5. **Publish** (only after the user confirms the tag):
```bash
gh release create <version> --target master --generate-notes --prerelease # beta
gh release create <version> --target master --generate-notes --latest # stable
```
For a beta, add the `pyhive-integration` version to the notes, and say whether it's ahead of core's.

6. **Verify.**
- Watch the Release workflow:
```bash
gh run watch $(gh run list -w release.yml -L1 --json databaseId -q '.[0].databaseId') --exit-status
```
- Then confirm `hive.zip` is attached: `gh release view <version> --json assets -q '.assets[].name'`.
- If the check job fails, the release is already visible to HACS users. Tell the user, and offer `gh release delete <version> --cleanup-tag` (it needs their OK), then a corrected release.

7. **Clean up** after a stable release that replaces betas. Offer `gh workflow run delete_beta.yml`. It keeps the newest pre-release and never touches stable releases.

Report the release URL, the `pyhive-integration` version it ships, the Release run result and anything left for the user to do.
37 changes: 37 additions & 0 deletions .claude/skills/repo-health/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
name: repo-health
description: One-shot health report for the Hive custom component repo - workflow states and latest results, open bot/dependency PRs, stale-labelled items, pending release, branch protection and required secrets. Use when the user asks for status, "is everything OK", a maintenance check, or what needs attention.
---

# Repo health

This is read-only. Gather everything first, then report. Don't change settings, rerun workflows, or merge anything unless the user asks.

```bash
R=Pyhass/Hive-Custom-Component
gh workflow list --all -R $R # any "disabled_inactivity"?
for w in ci.yml compat.yml pyhive_bump.yml stale.yml release.yml; do
echo "== $w"; gh run list -R $R -w $w -L 3 --json conclusion,createdAt,headBranch,event -q '.[] | "\(.createdAt) \(.event) \(.headBranch) \(.conclusion)"'
done
gh pr list -R $R --state open --json number,title,author,labels,statusCheckRollup,createdAt
gh issue list -R $R --label no-issue-activity
gh pr list -R $R --label no-pr-activity
gh release list -R $R -L 5
git fetch -q origin && git log $(gh release list -R $R -L1 --exclude-pre-releases --json tagName -q '.[0].tagName')..origin/master --oneline
gh api repos/$R/branches/master/protection 2>&1 | jq '{checks: .required_status_checks.contexts, code_owners: .required_pull_request_reviews.require_code_owner_reviews}'
gh secret list -R $R # expect BOT_TOKEN
```
(The protection and secrets calls need admin access. If they fail, say so rather than guessing.)

Compare what you find with MAINTAINING.md:
- **Workflows:** all active, with no `disabled_inactivity`. The latest CI run on master and the latest Compatibility run should both be green. The last Compatibility run should be under ~26 hours old.
- **Bot PRs:** Dependabot and pyhive bump PRs with no checks at all mean `BOT_TOKEN` is missing (for pyhive ones). PRs failing checks need attention. Anything older than about 2 weeks is going stale.
- **Unreleased commits on master:** suggest a release if there are user-facing changes.
- **Branch protection:** the required checks should be `HACS validation`, `Hassfest`, `Lint` and `Tests`, with code owner review on.
- **Secrets:** `BOT_TOKEN` should be present.
- **Hassfest:** a warning that `pyhive-integration` differs from core hive is expected (see `CLAUDE.md`), so don't report it as a problem.
- **pyhive-integration:** compare the manifest pin with core hive's pin and with the newest version on PyPI, pre-releases included. A newer pyhive beta than the pin is a candidate for the next component beta (`/bump-pyhive`, then `/release`). A pre-release pin on `master` blocks stable releases until it's moved to a stable version.
- **Latest beta release:** the tag should match the `version` in its manifest (`git show <tag>:custom_components/hive/manifest.json | jq -r .version`).
- **Pinned HA:** compare the HA version in the `requirements_test.txt` comment with the latest stable on PyPI (`curl -fsS https://pypi.org/pypi/homeassistant/json | jq -r .info.version`). A gap of more than one minor release means the Dependabot PR is stuck.

Report as a short table with ✅ / ⚠️ / ❌ and one line each. Then list the actions in priority order, each with the skill to use (`/triage-compat`, `/bump-pyhive`, `/release`) or the settings page to change.
59 changes: 59 additions & 0 deletions .claude/skills/triage-compat/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
name: triage-compat
description: Diagnose and fix a failing nightly Compatibility workflow (compat.yml) for the Hive custom component - identifies which Home Assistant channel broke, reproduces it locally against that HA version, and fixes it. Use when Compatibility is red, a new HA release/beta broke the component, or the user asks whether the component works with a given HA version.
---

# Triage Compatibility

Principle 1 in `CLAUDE.md` applies: this component extends core's hive integration and reuses it wherever possible, so fixes adapt to core rather than fork it.

Background: most platform files (`binary_sensor.py`, `climate.py`, `light.py`, `switch.py`, `water_heater.py`, `entity.py`) re-export `homeassistant.components.hive.*`. `__init__.py`, `sensor.py` and `config_flow.py` are this repo's own code, but they rely on HA helpers and on core's `HiveEntity`. HA changes break things here without any commit in this repo.

## 1. Find what failed
```bash
gh run list -w compat.yml -L 5
gh run view <run-id> # which jobs failed
gh run view <run-id> --log-failed | tail -200
```
From the log, note the job and the HA version. The "Find Home Assistant … release" step prints `homeassistant=` and `test_plugin=`.

Map it using the table in MAINTAINING.md → "Compatibility is red":
- **stable** fails: users are broken now, so treat it as urgent.
- **beta** fails: must be fixed before the next monthly HA release.
- **dev** smoke import fails: an import was renamed or removed upstream.
- The resolver step fails with "No pytest-homeassistant-custom-component release pins…": the plugin isn't published yet. Rerun later with `gh run rerun <id> --failed`. There's nothing to fix.
- **HACS/hassfest** fails: follow the validator's message. A `[REQUIREMENTS]` message about `pyhive-integration` differing from core hive is expected, and `.github/scripts/hassfest.py` reports it as a warning (see `CLAUDE.md`). If it's failing on that, hassfest has reworded the message, so update the `ALLOWED` pattern in that script. Don't loosen the pin.

## 2. Reproduce locally
Use a separate venv so `.venv` (which matches CI's pinned HA) stays untouched:
```bash
VENV=.venv-ha-beta script/setup
VIRTUAL_ENV=.venv-ha-beta uv pip install "pytest-homeassistant-custom-component==<test_plugin>"
VENV=.venv-ha-beta script/test -x
```
For a dev failure, run the smoke test instead:
```bash
VIRTUAL_ENV=.venv-ha-dev uv pip install "homeassistant @ git+https://github.com/home-assistant/core@dev"
.venv-ha-dev/bin/python .github/scripts/smoke_import.py
```
(Create `.venv-ha-dev` with `VENV=.venv-ha-dev script/setup` first.)

## 3. Find the upstream change
- Compare core's hive integration between the two HA versions:
`https://github.com/home-assistant/core/commits/dev/homeassistant/components/hive`.
- Search https://developers.home-assistant.io/blog for deprecations of the symbol that failed.
- Check the installed source: `.venv-ha-beta/lib/python3.*/site-packages/homeassistant/components/hive/`.

## 4. Fix
- Keep the fix working on **both** the pinned HA (`.venv`) and the failing version. Run `script/test` in both venvs.
- If core changed a re-exported platform in a way that conflicts with this component (for example it now expects something `__init__.py` doesn't provide), adapt `__init__.py`. Only replace the re-export with a local module as a last resort, and tell the user.
- Add or adjust a test that would have caught it.
- Run `script/lint`.

## 5. Report
Tell the user:
- which HA version and channel broke, and the root cause (with the upstream link)
- the fix, and the test results in both venvs
- whether a release is needed: stable breakage needs a patch release now (suggest `/release`); beta breakage needs one before HA's release date

Don't commit, push, or open PRs unless asked.
5 changes: 5 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Code owners are requested for review automatically on every PR.
# With "Require review from Code Owners" on master, their approval is needed to merge.
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners

* @KJonline
34 changes: 0 additions & 34 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

Loading
Loading