Skip to content

Releases: raphael1688dev/lifesmart_local_APP

20261009r0

Choose a tag to compare

@raphael1688 raphael1688 released this 09 Oct 01:18

Review against Home Assistant Core 2026.10.0 (dev blog 2026-08-31 → 09-30, release notes, and every report_usage in the helpers this integration touches). Nothing in 2026.10 breaks the integration; this release ships the follow-ups found during the review.

Fixes

  • Config flow no longer crashes on a malformed token or host. validate_host / validate_token raise vol.Invalid, which is not a ValueError, so the error escaped the flow and the UI showed "Unknown error occurred". Field-level invalid_host / invalid_token messages (already translated in en / zh-Hant / zh-Hans) are now shown instead. An empty host is also rejected.
  • Hub sw_version is coerced to str. The LifeSmart spec gives no type for cfg:getver's ver; HA's device registry warns on non-string values today and rejects them from 2026.12.0.
  • async_migrate_entry raises ConfigEntryNotReady when the hub is unreachable, so HA retries the migration (SETUP_RETRY) instead of marking the entry migrated and relying on the idempotent re-run.

Naming (HA 2026.5 convention)

  • has_entity_name = True on every device-attached entity. Cover and remote are their device's main entity and now carry no name of their own. Displayed names and entity_ids do not change for existing installs; user-set names are kept.

CI

  • Tests now run on Python 3.14 — the only interpreter HA 2026.5+ supports. The previous 3.12 / 3.13 matrix never exercised the real runtime.
  • 64 tests (28 new for the config-flow validators).

Requires HA 2026.5.0+ (unchanged).

20260913r1

Choose a tag to compare

@raphael1688 raphael1688 released this 13 Sep 11:44

修正(全面自我審查後)

  • _migrate_entity_ids 大寫處理錯誤:原本消毒前沒先轉小寫,大寫字母被當非法字元換成 _。混合大小寫的舊 entity_id(例 remote.tv_AzQAAPWwAAEAAA8-Gqz_7D01)會被打爛成 remote.tv_z_w_8_qz_7_01,HA 的 rename hook 會連自動化引用一起改掉。發生機率低(本整合從未寫入大寫 entity_id,只有 R10-b 之前的舊安裝直接跳到 20260803r0+ 才會碰到),但後果嚴重。現在先 .lower() 再消毒,與 generate_entity_id 同序。
  • hub 裝置的 sw_version 不再被清空:先前 cfg:getver 失敗的那次開機會把 None 寫進 hub 裝置,清掉上次存的韌體版本。現在版本未知時就不傳這個欄位。三處一併修(__init__.py、hub 版本 sensor、hub reboot button)。
  • switch.py 的 hub_device_id 參數補型別標註。

測試

36 tests passed(原 34 + 新 2 regression)。CI 6 jobs 全綠。

20260913r0

Choose a tag to compare

@raphael1688 raphael1688 released this 13 Sep 11:32

修正

  • remote.py entity_id 消毒:_slugify 原本只套在裝置名稱上,agt(hub ID)原樣塞入 entity_id。部分 hub 的 agt 含 -(base64-ish token),會產生 HA 2026.8 warn / 2027.2 reject 的 entity_id — 與 20260803r0 修的是同一類問題,該版漏掉了這個檔。現在整個 <name>_<agt>_<me> 都經過 _slugify。
  • 對 agt 本來就乾淨的使用者,輸出逐字元相同,entity_id 不會搬動。只有帶 - 的會變 _,registry 端由既有的 _migrate_entity_ids 處理。
  • 順帶消除 remote setup 的 in-place rename 與 _migrate_entity_ids 每次開機互相改回去的問題。

HA 2026.9 / 2026.9.1 相容性

本版起因於對 HA 2026.9.1 的影響檢查 — 結論:無需為 2026.9 做任何變更。逐項對照 2026.9 backward-incompatible 清單、2026.9.1 patch、以及 8/24 device registry follow-up deprecations,並對 2026.9.1 tag 原始碼驗證 via_device_id / EntityRegistry.entities / PERCENTAGE 均未受影響。

測試

34 tests passed(原 29 + 新 5)。CI 6 jobs 全綠。

20260803r1

Choose a tag to compare

@raphael1688 raphael1688 released this 03 Aug 14:07

新增

  • Hub → 子裝置階層(D22):HA UI 的裝置頁現在會把子裝置掛在 hub 底下,不再是一堆平鋪的無主裝置。

實作細節

  • __init__.py 在 forward platforms 之前向 device registry 註冊 hub device,並把 registry ID 存進 entry_data — 同時消除了「platforms 並行 setup 時子裝置可能搶先註冊」的順序競態。
  • 5 個平台(sensor / switch / cover / binary_sensor / remote)在 DeviceInfo 設 via_device_id。
  • 刻意不用 via_device=(DOMAIN, identifier):HA 2026.8 起 identifiers 只在單一 config entry 內唯一,identifier tuple 不再能無歧義指向單一裝置,該參數已 deprecated(同時傳兩者會 raise,2027.8 移除)。

測試

29 tests passed。CI 6 jobs 全綠。

20260803r0

Choose a tag to compare

@raphael1688 raphael1688 released this 03 Aug 13:32

修正

  • entity_id 合規化:HA entity_id object 部分只允許 [a-z0-9_],部分 hub 的 agt 包含 -(base64-ish token),會產生 HA 2026 warn / 2027.2 reject 的 entity_id。generate_entity_id 現在會把非法字元換 _ 再 collapse。
  • 自動遷移舊 entity_id:_migrate_entity_ids 在 setup 時掃 entity registry,把已註冊的 foo-bar 型別 in-place 改成 foo_bar。HA 會自動更新自動化 / 腳本的引用;Lovelace card 為使用者手寫 YAML,需自行更新。
  • Idempotent — 每次 setup 都跑一次,已合規的 id 直接跳過。

測試

29 tests passed(原 21 + 新 8)。

20260601r1

Choose a tag to compare

@raphael1688 raphael1688 released this 01 Jun 00:41

Install via HACS

  1. HACS → Integrations → ⋮ → Custom repositories → add https://github.com/raphael1688dev/lifesmart_local_APP (category: Integration)
  2. Install Local LifeSmart, restart Home Assistant
  3. Settings → Devices & Services → Add Integration → Local LifeSmart

What's included

Sub-device platforms

  • switch — Stellar/Starry/Polar Switch (SL_SW_ND*), Moonstone Switch (SL_SW_NS*), Traditional Switch (SL_SW_IF* / SL_SW_RC), Nature Mini (SL_NATURE as switch)
  • sensor — temperature (SL_NATURE), battery (SL_P curtain P8; SL_SW_ND* / SL_MC_ND* V per spec §6.3.2 / §6.3.5), per-device signal strength (lDbm common attribute, §6.1)
  • binary_sensor — per-device connectivity (stat common attribute) with push (NOTIFY) + 15 min fallback poll
  • cover — SL_P MINS Curtain Motor Controller
  • remote — IR remote (SPOT)

Hub-level platforms

  • sensor — 3 hub-info diagnostic sensors (firmware version, OS version, model — via cfg:getver)
  • button — hub reboot (cfg:reboot, ButtonDeviceClass.RESTART)
  • scene — auto-discovered hub scenes (cls in ('scene', 'groupirc'))

Architecture

  • DataUpdateCoordinator — single eps per cycle for sensor polling (replaces per-entity timer)
  • Push state listener for instant updates from NOTIFY, orthogonal to coordinator
  • Cross-hub safe unique_id (<feature>_<agt>_<me>) with in-place migration via async_migrate_entry
  • Auto event-service re-subscription every 90 s (spec requires within 300 s)

Quality of life

  • Diagnostics platform — download full entry/device payload from HA UI (token redacted)
  • Repair Issues — actionable failures surface in HA Repairs panel
  • pytest suite (21 tests, no HA install required — CI runs on Python 3.12 + 3.13)
  • HA 2026.5 compliant entity naming (DeviceInfo.name + function-only _attr_name)
  • Translations: English, 繁體中文, 简体中文
  • CI: pytest matrix + py_compile + JSON validation + HACS + hassfest, all green

⚠ Known limitations

  • cover P1 status channel is not implementation-verified (spec §6.9.1 ambiguous)
  • Scene trigger args.args.type=128 copied from spec example, not tested across cls
  • Hub-level rssi (no me) not yet implemented — spec wording ambiguous
  • binary_sensor and cover still use per-entity polling; coordinator is wired but not yet consumed by them

Generated with Claude Code

20260523r5

Choose a tag to compare

@raphael1688 raphael1688 released this 24 May 10:14
c093c4e
Add files via upload

20260523r3

Choose a tag to compare

@raphael1688 raphael1688 released this 23 May 03:01
4a272e8
Add files via upload

20260523r2

Choose a tag to compare

@raphael1688 raphael1688 released this 23 May 02:37
5b11f75
Add files via upload

20260523r0

Choose a tag to compare

@raphael1688 raphael1688 released this 23 May 02:08
a666b17
Add files via upload