Skip to content

Workflow cleanup#126

Closed
KJonline wants to merge 54 commits into
masterfrom
Workflow-cleanup
Closed

Workflow cleanup#126
KJonline wants to merge 54 commits into
masterfrom
Workflow-cleanup

Conversation

@KJonline

@KJonline KJonline commented May 9, 2026

Copy link
Copy Markdown
Contributor

No description provided.

KJonline and others added 30 commits April 25, 2026 16:01
Provides architecture overview, command reference, and development guidance for AI-assisted code editing. Documents async/sync package generation, device discovery pattern, token refresh strategy, and file-based testing workflow.
- Scan interval fixed at 2 minutes (_SCAN_INTERVAL constant); removed
  updateInterval() method and scan_interval config option from startSession()
- Added forceUpdate() to Hive class for power users needing an immediate
  poll; skips with debug log if another poll is already in flight
- Extracted _pollDevices() as the single internal poll call site; used by
  both updateData() and forceUpdate()
- Removed all Hive camera code (discontinued product): camera.py,
  data/camera.json, getCamera(), getCameraImage/Recording API methods,
  camera URLs, camera param from request(), deviceList["camera"],
  Camera_Temp sensor command, and hivecamera PRODUCTS block
- Added pytest-asyncio tests for forceUpdate() idle and locked scenarios

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ranch protection

- Added dev-release-pr.yml workflow that triggers on dev branch pushes to automatically bump patch version in setup.py and create a release PR to master (skips if PR already exists or commit message contains 'chore: bump version')
- Added guard-master.yml workflow that enforces PRs to master branch must originate from dev branch only
- Both workflows use GitHub CLI (gh) for PR operations and configure github-actions[bot] as commit
…mic-refresh

Refactor: fix scan interval at 2 min, add forceUpdate, remove camera
…mplicit (fall through) returns'

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
…lease pipeline, document branching model

- Removed python-package.yml (duplicated by ci.yml lint-flake8 job)
- Removed release_draft.yml (superseded by automatic release notes in release-on-master.yml)
- Removed dev branch trigger from ci.yml (now runs on PRs and master pushes only)
- Added release-on-master.yml workflow that reads version from setup.py, creates tag vX.Y.Z and GitHub Release with auto-generated notes on master pushes (skips if tag exists)
- Added docs/workflows/README.md documenting the feature
…nges

- Added paths filter to master push trigger (src, tests, requirements, setup files, config files, CI workflow itself)
- Added identical paths filter to pull_request trigger
- Prevents unnecessary CI runs when only docs, README, or other non-code files change
Consolidate GitHub workflows and document release automation
Deletes alarm.py, alarm.json, and removes all alarm-related code from
hive.py, session.py, const.py, hive_async_api.py, and hive_api.py.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Renames all camelCase instance attributes to follow Python snake_case
convention: tokenData→token_data, tokenCreated→token_created,
tokenExpiry→token_expiry, homeID→home_id, lastUpdate→last_update,
scanInterval→scan_interval, userID→user_id, errorList→error_list,
updateLock→update_lock, _refreshLock→_refresh_lock,
_refreshThreshold→_refresh_threshold, _updateTask→_update_task,
_lastPollSlow→_last_poll_slow, _slowPollThreshold→_slow_poll_threshold.

Updated across session.py, hive.py, hive_api.py, hive_async_api.py,
and hive_helper.py.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
entityCache→entity_cache, deviceList→device_list,
_entityCacheKey→_entity_cache_key, getCachedDevice→get_cached_device,
setCachedDevice→set_cached_device, shouldUseCachedData→should_use_cached_data.

Updated across session.py, hive_helper.py, heating.py, hotwater.py,
light.py, plug.py, action.py, and sensor.py.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…aclasses

- hivedataclasses.py: update Device to snake_case fields, add EntityConfig
- const.py: replace string-based PRODUCTS/DEVICES with EntityConfig instances,
  remove ACTIONS constant, update sensor_commands to use attribute access
- session.py: replace eval() in createDevices with EntityConfig iteration,
  update addList to return Device objects with snake_case fields,
  update _entity_cache_key to use attribute access
- All device modules: replace device["hiveID"] dict access with device.hive_id
  attribute access throughout (hive_id, hive_type, ha_type, hive_name, ha_name,
  device_data, parent_device, is_group, device_id, device_name)
- Replace device.setdefault("status", ...) with direct attribute assignment

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Removes the blanket `# pylint: skip-file` from all source files and
replaces it with explicit `# pylint: disable=<codes>` directives that
document exactly which rules are suppressed and why:
- C0103: public API method names use camelCase (HA integration constraint)
- E1101: false positives from the mixin pattern (self.session injected by subclass)
- R0914/R0915: complex methods that would need major refactoring to split

Also fixes all pylint issues that were genuinely easy to resolve: removes
unnecessary else-after-return, converts f-strings in logging calls to lazy
% formatting, fixes inconsistent return statements, uses `in` for tuple
membership tests, and removes an unnecessary pass statement.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The updateLock attribute was renamed to update_lock in the snake_case
refactor. Update the test to match.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Converts remaining camelCase method names to Python snake_case convention:
- action.py: getAction→get_action, getState→get_state, setStatusOn→set_status_on, setStatusOff→set_status_off, actionType→action_type
- hive_api.py: refreshTokens→refresh_tokens, getLoginInfo→get_login_info, getAll→get_all, getDevices→get_devices, getProducts→get_products, getActions→get_actions, motionSensor→motion_sensor, getWeather→get_weather, setState
Adds camelCase wrapper methods that delegate to the new snake_case methods
to maintain compatibility with existing Home Assistant integration code:
- session.py: deviceList property, startSession, updateData
- heating.py: setMode, setTargetTemperature, setBoostOn, setBoostOff, getClimate
- hotwater.py: setMode, setBoostOn, setBoostOff, getWaterHeater
- light.py: turnOn, turnOff, getLight
- plug.py: turnOn, turnOff, getSwitch
- sensor.
…ead of dict construction

Replaces manual dict construction in get_* methods across heating.py, hotwater.py,
light.py, plug.py, and sensor.py with direct Device attribute assignment. Updates
set_cached_device to store and return the Device object itself rather than a
separate dict.

Adds dict-style access methods (__getitem__, __setitem__, __contains__, get) to
Device dataclass with camelCase→snake_case key translation via
Adds special-case handling for action-type entities in addList to construct Device
objects directly from the action data dict instead of calling get_device_data (which
expects product/device structure). Actions now populate minimal fields (hive_id,
hive_name, device_id, device_name, ha_name all set to action name/id, empty
device_data, parent_device set to hub_id).

Updates action.py get_action to assign status and device_data
…leaner state management

- .claude/settings.json, .codex/hooks.json: add PreToolUse hooks to prompt reading GRAPH_REPORT.md before file searches
- AGENTS.md, CLAUDE.md: document graphify usage rules (read GRAPH_REPORT.md first, prefer `graphify query/path/explain` over grep, run `graphify update` after code changes)
- pyproject.toml: add dev dependencies including graphifyy
- action.py: extract _set_action_state helper to deduplicate set
Adds graphify-out/ to exclusion patterns in .github/workflows/ci.yml (via find -not -path) and .pre-commit-config.yaml (via exclude directive) to prevent linting/formatting of generated knowledge graph artifacts. Includes initial graphify output: .graphify_python interpreter marker, GRAPH_REPORT.md with 689 nodes/1578 edges across 44 communities, and JSON cache files for extracted code entities.
…pers

- hivedataclasses.py: add SessionTokens and SessionConfig dataclasses to replace Map-based tokens/config dicts
- session.py: replace self.tokens/self.config Map instances with SessionTokens/SessionConfig dataclasses, update all attribute access to use dataclass fields
- hive_helper.py: move epoch_time from session.py to helper module as standalone function
- session.py: add _retry_with_backoff helper to deduplicate retry logic in
KJonline and others added 24 commits May 2, 2026 12:59
- Replaced black, flake8, and isort hooks with ruff and ruff-format
- Updated pre-commit-config.yaml to use astral-sh/ruff-pre-commit (v0.15.12)
- Applied ruff-format auto-fixes to source files
- Removed redundant linting dependencies (flake8-docstrings, pydocstyle, isort)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… jobs with ruff

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove test* wildcard that matched tests/ directory
- Add htmlcov/, .coverage*, .env to gitignore
- Remove duplicate entries and fix egg-info pattern
- Add [tool.pytest.ini_options] with asyncio_mode=auto and testpaths
- Add [tool.coverage.run] pointing at src/
- Write CONTRIBUTING.md with setup, test, lint, and PR instructions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove Node.js package.json and .secretlintrc.json (secretlint was
never wired into CI so it did nothing). Add Yelp/detect-secrets v1.5.0
as a pre-commit hook with a baseline that acknowledges false positives
(AWS Cognito SRP N_HEX constant, password/device_key param names, test
fixture data in data.json).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove pyupgrade pre-commit hook (functionality now in ruff)
- Rename ruff hook from 'ruff' to 'ruff-check' in pre-commit config
- Enable UP (pyupgrade), B (flake8-bugbear), PL (pylint) rule sets in ruff
- Update .pylintrc to Python 3.10 and comment out overgeneral-exceptions
- Replace Optional[T] with T | None (PEP 604 syntax)
- Replace %-formatting with f-strings
- Replace if/else min/max comparisons with min()/max() builtins
- Replace magic
… find

Replace packages.find with explicit package list to avoid auto-discovery issues. Specify apyhiveapi and its api/helper subpackages directly.
Replace minimal README with detailed documentation covering installation, authentication, device control, offline testing, and architecture. Add PyPI badges, feature list, supported device table, async/sync quickstart examples, and development instructions.
…ols config

Add pyhive_integration and its api/helper subpackages to packages list. Map pyhive_integration to src/ directory in package-dir config.
…it guard

Overwrites data.json with fully anonymised API dump (UUIDs, personal
details, device names, room names, security zones, action names all
genericised). Merges hotwater and sense product types from the previous
fixture to maintain coverage for those code paths. Wraps content in the
required {"original": "Using File", "parsed": {...}} structure.

Adds scripts/check_data_pii.py as a local pre-commit hook scoped to
src/data/*.json. Blocks commits containing real UUIDs, emails, phone
numbers, UK postcodes, or IP addresses, and enforces the original/parsed
wrapper so raw API dumps cannot be accidentally committed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace pyhive_integration with pyhive in packages list and package-dir mapping to use shorter, cleaner package name.
Generate comprehensive AST graph representation covering all Python modules (setup.py, heating.py, light.py, hotwater.py, sensor.py, switch.py, action.py, api/*.py, helper/*.py) and scripts. Includes 13,352 lines mapping classes, methods, functions, rationales, and their relationships for code visualization tooling.
ci: update ruff hook name from 'ruff' to 'ruff-check' in GitHub Actio…
- Normalize whitespace in claude.yml workflow comment
- Update pre-commit hook to use python3 instead of python for PII check script
chore: standardize formatting and Python interpreter in config files
@KJonline KJonline closed this May 9, 2026
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