Parcourir la source

Add README and CI workflow; pin test env to HA 2026.6.3; fresh lockfile

- pytest-homeassistant-custom-component==0.13.339 pins homeassistant==2026.6.3,
  the oldest supported line, so tests validate the declared HA floor
- zwave-js-server-python dev pin 0.72.0 -> 0.71.0 to match what HA 2026.6.x's
  zwave_js integration ships at runtime
- requires-python >=3.14.2 (required by HA 2026.6.3); lockfile collapses from
  5 Python-version resolution forks to 1 and records version 0.2.0
- Gitea Actions workflow: ruff (F,E7,E9) + pytest
ZiB il y a 4 mois
Parent
commit
f73e302af1
4 fichiers modifiés avec 198 ajouts et 757 suppressions
  1. 17 0
      .gitea/workflows/test.yml
  2. 77 0
      README.md
  3. 6 3
      pyproject.toml
  4. 98 754
      uv.lock

+ 17 - 0
.gitea/workflows/test.yml

@@ -0,0 +1,17 @@
+name: Tests
+
+on:
+  push:
+    branches: [main]
+  pull_request:
+
+jobs:
+  test:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v4
+      - uses: astral-sh/setup-uv@v5
+      - name: Lint
+        run: uvx ruff check custom_components tests --select F,E7,E9
+      - name: Run tests
+        run: uv run pytest -q

+ 77 - 0
README.md

@@ -0,0 +1,77 @@
+# zLock Slots
+
+Home Assistant custom integration for managing user-code slots on Z-Wave locks,
+with per-lock "last action" / "last user" tracking and a Lovelace card for
+inline slot management.
+
+Requires Home Assistant **2026.6.0 or later** and locks connected through the
+built-in `zwave_js` integration.
+
+## Installation
+
+Install via [HACS](https://hacs.xyz/) as a custom repository
+(`https://git.zi3.xyz/code/zlock_slots`, category *Integration*), or copy
+`custom_components/zlock_slots/` into your HA `config/custom_components/`
+directory. Restart Home Assistant, then add the integration under
+**Settings → Devices & services → Add integration → zLock Slots** and select
+the Z-Wave lock(s) to manage.
+
+The integration's options (⚙ on the integration entry) let you add/remove
+locks later and define **groups** — named sets of locks that publish a shared
+last-action / last-user sensor.
+
+## Entities
+
+For each configured lock (`lock.<name>`):
+
+| Entity | State |
+|---|---|
+| `sensor.<name>_last_action` | `locked` / `unlocked`, or unknown until the first event |
+| `sensor.<name>_last_user` | slot name (or number), `<Manual>` for physical operation, `<Radio>` for HA/Z-Wave commands |
+| `sensor.<name>_slots` | count of occupied code slots; `attributes.slots` lists `{slot_num, status, name}` |
+
+Each group gets its own `last_action` / `last_user` sensor pair, updated by
+events from any lock in the group. Last action/user survive HA restarts.
+
+Slot names are stored by the integration (they are not written to the lock)
+and are preserved when a code is cleared.
+
+## Services
+
+All services take `lock_entity_id` plus:
+
+| Service | Fields | Notes |
+|---|---|---|
+| `zlock_slots.set_code` | `slot` (optional), `code`, `name` (optional) | Omit `slot` to auto-assign the lowest free slot |
+| `zlock_slots.clear_code` | `slot` | Slot name is preserved |
+| `zlock_slots.set_name` | `slot`, `name` | Set an empty name to remove it |
+| `zlock_slots.set_slot_enabled` | `slot`, `enabled` | Enable/disable without changing the PIN |
+
+Slot 0 is reserved by Z-Wave and never shown or written.
+
+## Lovelace card
+
+The card is registered automatically as a dashboard resource
+(`/zlock_slots/zlock-slots-card.js`). If your dashboards are YAML-managed,
+add it manually as a JavaScript module resource.
+
+```yaml
+type: custom:zlock-slots-card
+entity: sensor.front_door_slots    # the *_slots sensor
+lock_entity_id: lock.front_door
+title: Front Door                  # optional
+```
+
+The card lists occupied slots with inline editing: click a name to rename it,
+use the row icons to change a PIN, enable/disable, or clear a slot, and use
+the form at the bottom to add a code (slot number optional — auto-assigns).
+
+## Development
+
+```sh
+uv run pytest
+```
+
+Tests run against the pinned Home Assistant version from
+`pytest-homeassistant-custom-component` (kept in sync with the minimum
+supported HA release declared in `hacs.json`).

+ 6 - 3
pyproject.toml

@@ -1,12 +1,15 @@
 [project]
 name = "zlock-slots"
 version = "0.2.0"
-requires-python = ">=3.12"
+requires-python = ">=3.14.2"
 
 [dependency-groups]
 dev = [
-  "pytest-homeassistant-custom-component",
-  "zwave-js-server-python==0.72.0",
+  # Pins homeassistant==2026.6.3 — the oldest supported HA line (hacs.json
+  # declares 2026.6.0 as the minimum). Bump alongside the HA target.
+  "pytest-homeassistant-custom-component==0.13.339",
+  # Matches the version HA 2026.6.x's zwave_js integration requires at runtime.
+  "zwave-js-server-python==0.71.0",
 ]
 
 [tool.uv]

Fichier diff supprimé car celui-ci est trop grand
+ 98 - 754
uv.lock


Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff