diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 67eec82a83..6a0dbc51eb 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -2,7 +2,7 @@ name: Validate app on: push: - branches: [SDK3, modernize-2026] + branches: [main, dev, develop-0.4, develop-0.4.1] pull_request: permissions: diff --git a/.homeychangelog.json b/.homeychangelog.json index 0a39479a15..9c2569d345 100644 --- a/.homeychangelog.json +++ b/.homeychangelog.json @@ -33,7 +33,7 @@ "en": "Composer fix" }, "0.1.4": { - "en": "Added support for Smart Plug (needs testing)" + "en": "Added support for Smart Plug." }, "0.1.5": { "en": "Added support for Samotech White Label Brand" @@ -108,7 +108,7 @@ "en": "Troubleshooting Smart Plug with metering" }, "0.1.33": { - "en": "Test Device - Wall Remote 3 Gang" + "en": "Added a pairing profile for the 3-gang wall remote." }, "0.1.34": { "en": "Fix for Christmas Lights firework effect. Fix for Smart Plug. Added some Device ID's." @@ -126,7 +126,7 @@ "en": "Fix for RGB and Tunable White lights." }, "0.1.42": { - "en": "Polished code for release to app store. Already paired lights MUST be removed and paired again to get color/temperature functionality." + "en": "Improved light controls. Already paired lights must be removed and paired again to get colour and colour-temperature functionality." }, "0.1.43": { "en": "Potential fix for Tunable White lights. Added some device id's to already supported devices." @@ -135,7 +135,7 @@ "en": "Potential fix for Tunable White lights." }, "0.1.45": { - "en": "Fix for Tunable White lights deployed to Live version in App Store." + "en": "Fixed Tunable White light controls." }, "0.1.46": { "en": "Added support for LED Mood Light and LED Bar Light by Livarno LUX/Lidl." @@ -189,7 +189,7 @@ "en": "Fix for Wall Remotes." }, "0.2.11": { - "en": "New test version with a number of new deviced added." + "en": "Added support for additional devices." }, "0.2.12": { "en": "Added support for a number of devices." @@ -207,7 +207,7 @@ "en": "Fix." }, "0.2.17": { - "en": "Fixes for a few test devices." + "en": "Fixed handling for several devices." }, "0.2.18": { "en": "Added some extra codes for already supported devices and made a few fixes." @@ -384,9 +384,21 @@ "en": "Fixed device support and improved Zigbee handling" }, "0.3.0": { - "en": "Major modernization release preparing Tuya Zigbee for renewed development, with project cleanup, Homey Compose alignment, validation improvements and maintenance updates." + "en": "Improved app reliability and device compatibility." }, "0.3.1": { - "en": "Large update with support for many additional Tuya Zigbee devices and device IDs, plus fixes and reliability improvements for remotes, sensors, switches, dimmers, sirens, FingerBot, rain/radar devices and Zigbee event handling. TH05Z battery readings now use the cached Zigbee identity to avoid failures when sleepy devices do not respond to Basic reads." + "en": "Added support for additional Tuya Zigbee devices and improved reliability for remotes, sensors, switches, dimmers, sirens, FingerBot and rain/presence sensors. Fixed TH05Z battery readings." + }, + "0.4.0": { + "en": "Added pairing profiles for additional switches, temperature/humidity sensors, rain and water-leak sensors, contact sensors, and motion sensors with illuminance. Improved power-on state settings for supported smart plugs and reduced repetitive thermostat messages. Reduced repetitive startup logging when powered-off Zigbee devices are unreachable. Improved Smart Knob Switch handling for Scene Mode rotation and Zigbee Level Control commands." + }, + "0.3.2": { + "en": "Added support for additional Tuya Zigbee devices and improved reliability for remotes, sensors, switches, dimmers, sirens, FingerBot and rain/presence sensors. Fixed TH05Z battery readings and clarified device compatibility information." + }, + "0.3.3": { + "en": "Fixed 2-gang curtain modules where the second channel stopped responding after the 0.3.x update." + }, + "0.3.4": { + "en": "Fixed Smart Knob Switch actions that stopped responding after the 0.3.x update." } -} +} \ No newline at end of file diff --git a/.homeycompose/app.json b/.homeycompose/app.json index 4b4064db1a..14ec3aea62 100644 --- a/.homeycompose/app.json +++ b/.homeycompose/app.json @@ -1,6 +1,6 @@ { "id": "com.tuya.zigbee", - "version": "0.3.1", + "version": "0.4.0", "compatibility": ">=5.0.0", "platforms": [ "local" @@ -10,7 +10,7 @@ "en": "Tuya Zigbee" }, "description": { - "en": "Control your white label Zigbee devices made by Tuya" + "en": "Make everyday devices part of a smarter home" }, "tags": { "en": [ diff --git a/.homeyignore b/.homeyignore index 803865cb24..78a8fbebcb 100644 --- a/.homeyignore +++ b/.homeyignore @@ -7,6 +7,7 @@ test/ scripts/ # Maintainer and project documentation +docs/ README.md SUPPORTED_DEVICES.md MAINTAINING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e0485474c7..281e445606 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -25,7 +25,8 @@ Please include: Keep pull requests small and focused. -- Base work on the repository's current default branch unless a maintainer asks otherwise. +- Base narrow corrections to the published Test version on `dev`; target new features and device additions at `develop-0.4.1`. Keep `develop-0.4` frozen for 0.4.0 release corrections. +- `main` tracks Homey Live and `dev` tracks Homey Test; prepare changes on dedicated branches and coordinate runtime updates with publication. See [branch policy](docs/BRANCHES.md). - Prefer one device/fix per PR. - Explain why the change is needed and which device identities are affected. - Do not hand-edit root `app.json`; edit Homey Compose sources instead. diff --git a/MAINTAINING.md b/MAINTAINING.md index 08172f1885..65c4d10639 100644 --- a/MAINTAINING.md +++ b/MAINTAINING.md @@ -72,19 +72,43 @@ CI order is: Homey's publish validation checks the generated manifest and publish assets. Static repository tests are intentionally conservative; they do not claim to replace real-device testing. +**0.4 release contract:** Preserve the generated [0.3.1 Test manifest baseline](test/fixtures/0.3.1-manifest-contract.json) using `test/0.4-legacy-manifest-contract.test.js`; record any consciously approved existing-contract change with issue-linked target signatures in `test/fixtures/0.4-approved-manifest-deltas.json`. See [0.4 Test readiness](docs/0.4.0_TEST_READINESS.md). Never rewrite the immutable source baseline to silence a regression. Separately pin and verify the [20 sensitive legacy source Git blobs](test/fixtures/0.3.1-protected-runtime-blobs.json) with `test/0.4-protected-runtime-contract.test.js`; any reviewed, issue-linked exception belongs in `test/fixtures/0.4-approved-runtime-deltas.json`, not in the original snapshot. + +**0.4 hardware gate:** Consult [the release-candidate preflight](docs/0.4.0_RELEASE_PREFLIGHT.md) and [the exact physical acceptance matrix](docs/0.4.0_PHYSICAL_ACCEPTANCE.md) before suggesting a 0.4 Test/Live promotion. It tracks the current 33 individually testable manufacturer/product fingerprints across nineteen NEW 0.4 drivers, original physical evidence, per-gang/sensor tests and the existing plug-regression scope (#1503). CI success alone is not physical acceptance. **Physical checks take place through the published 0.4 Test version, not as an entry requirement before publishing Test.** Before moving from Test to Live, use reported physical evidence and evaluate or defer unverified fingerprints. **Current channels are main = 0.3.3 Live and dev = 0.3.4 Test** (Store checked 2026-10-25). The prior 0.3.2-Live-first prerequisite is satisfied; review current Test feedback and final candidate sign-off before publishing 0.4.0 Test. + ## Releases - Keep `package.json`, `.homeycompose/app.json` and generated `app.json` on the same version. - Add the new version to `.homeychangelog.json`. - Keep Homey release notes short and user-facing. - Keep project/developer detail in GitHub documentation rather than the Homey App Store changelog. +- Keep README.md, README.txt, any translated README and Homey changelog entries channel-neutral: no Test/Live/beta labels, candidate status, branch names, rollout dates, CI results or release plans. Store those in MAINTAINING.md, docs/ and GitHub release issues/PRs. Keep support claims accurate; describe added pairing profiles without claiming hardware validation that has not happened. +- Follow Athom's README.txt guidelines: one or two short plain-text paragraphs, no headings, Markdown, URLs, changelog or contributor list. Use manifest source/support fields for links. +- Describe user-visible changes since the previous Live version in the current changelog entry; a documentation-only re-submission still needs the cumulative functional release summary. +- Exclude docs/ and other maintainer-only files from the shipped app using .homeyignore. +- For a changed submission already published under another version, use a new monotonically higher version and keep package-lock.json (including its root package), package.json and Compose metadata aligned. - Regenerate/validate `app.json` through Homey Compose/CLI; do not hand-edit it. -## Branches - -- `SDK3` is the established production code line at the start of the 2026 maintenance pass. -- `modernize-2026` is the active 2026 modernization branch for repository hygiene, verified correctness fixes and maintainability improvements without architectural rewrites. -- `refactor/type-based-drivers` is an experimental architecture branch. It is intentionally separate and must not be assumed production-ready. +## Branches and release lanes (2026-10-25) + +- `main`: actual Homey **Live 0.3.3**, published source `130854f`. +- `dev`: actual Homey **Test 0.3.4**, published source `21b60ce`. +- `develop-0.4`: frozen **0.4.0 next Test candidate**, not yet published. +- `develop-0.4.1`: all new post-freeze development; it still inherits 0.4.0 + metadata until the first coordinated 0.4.1 version/changelog update. +- `refactor/type-based-drivers`: separate experimental architecture. + +See [current branch policy, Store evidence and cleanup audit](docs/BRANCHES.md). +Prepare narrow fixes against `dev` on a dedicated branch; send new features and +device additions to `develop-0.4.1`. `main` follows actual Live publication. +Do not merge pending 0.4 work into the currently published 0.3.4 Test branch. + +The earlier prerequisite **0.3.2 Live BEFORE 0.4.0 Test** is satisfied: 0.3.2 +became Live and was then superseded by 0.3.3. Review current 0.3.4 Test feedback, +final candidate CI and artwork before the separate 0.4.0 Test decision. Physical +acceptance of new 0.4 profiles takes place in public Test, not before opening it. +The immutable 0.3.1 manifest/runtime fixtures remain unchanged. Older dated +release documents are historical snapshots and defer to docs/BRANCHES.md. ## Modernization rule diff --git a/README.md b/README.md index 406fde4ad9..6538b65b87 100644 --- a/README.md +++ b/README.md @@ -1,80 +1,31 @@ # Tuya Zigbee for Homey -Actively maintained, community-driven support for Tuya-manufactured Zigbee devices connected directly to Homey, without a Tuya gateway. +Connect supported Tuya-manufactured Zigbee devices directly to Homey, without a Tuya gateway. Use sensors, plugs, switches, lights, remotes, curtains and other supported devices in your home automation and Flows. -Tuya hardware is sold under many different brands and model names. For that reason this app identifies compatibility primarily from the device's Zigbee identity and endpoint/cluster structure rather than from the retail name printed on the box. - -## What this app does - -- Pairs supported Tuya Zigbee devices directly with Homey. -- Provides Homey capabilities for sensors, plugs, switches, lights, remotes, curtains, thermostats, sirens and other supported device classes. -- Implements Tuya-specific Zigbee clusters and datapoints where standard Zigbee behaviour is not sufficient. -- Supports a large community-maintained set of Tuya manufacturer/product identities. +Tuya devices are sold under many retail brands. Products that look identical can use different Zigbee identities, so compatibility depends on the device's manufacturer and model identifiers rather than its retail name alone. ## Supported devices -The compatibility list has moved to **[SUPPORTED_DEVICES.md](SUPPORTED_DEVICES.md)** so it remains easy to find without turning the project README into a very large device database. +See [SUPPORTED_DEVICES.md](SUPPORTED_DEVICES.md) for the compatibility list. Follow the pairing instructions for the matching device in Homey. -The driver manifests under `drivers/*/driver.compose.json` are the authoritative source for Homey pairing. The supported-device document is maintained as a human-readable buying and compatibility reference. +## Support and device requests -Because Tuya products are frequently rebranded, two products that look identical can expose different Zigbee identities, while the same Zigbee device can be sold under several brands. +Please report bugs and request additional devices through [GitHub Issues](https://github.com/JohanBendz/com.tuya.zigbee/issues). -## Reporting bugs - -Please use GitHub Issues and include: +For a bug report, include: 1. Homey model and firmware version. 2. Tuya Zigbee app version. -3. Retail brand/model when known. -4. Zigbee `manufacturerName` and `modelId` / `productId`. -5. What you expected to happen. -6. What actually happened. -7. Relevant logs or a Zigbee interview where applicable. - -For unsupported devices, use the dedicated **New Device Request** issue template and include a full Zigbee interview. - -## Development - -The app uses Homey SDK 3, Homey Compose, `homey-zigbeedriver` and `zigbee-clusters`. - -For current Homey development, Node.js 22 is recommended because Homey v12.9.0 and newer run apps on Node.js 22. - -Common commands: +3. Device brand/model and Zigbee `manufacturerName` and `modelId`, where available. +4. Steps to reproduce, expected behaviour and actual behaviour. +5. Relevant diagnostics or a Zigbee interview. -```bash -npm ci -npm test -npm run validate -npm run run -``` - -### Homey Compose - -The source manifest lives in `.homeycompose/` and the driver compose files. - -**Do not edit root `app.json` manually.** Homey Compose generates that file. It remains tracked in this repository as a generated baseline, so unrelated regenerated changes should not be mixed into normal pull requests. - -### Repository structure - -- `.homeycompose/` — app-level Compose metadata, capabilities and Flow cards. -- `drivers/` — Homey drivers and their pairing manifests. -- `lib/` — shared Tuya/Zigbee protocol helpers, custom clusters and datapoint definitions. -- `locales/` — translations. -- `SUPPORTED_DEVICES.md` — human-readable compatibility reference. -- `MAINTAINING.md` — maintainer notes, release workflow and architecture guidance. -- `README.txt` — Homey App Store long-form description. -- `.homeychangelog.json` — Homey release notes keyed by app version. +For an unsupported device, use the New Device Request template and include a full Zigbee interview. The [Homey Developer Tools](https://tools.developer.homey.app/tools/zigbee) can be used to obtain it. ## Contributing -See **[CONTRIBUTING.md](CONTRIBUTING.md)** before opening a pull request. - -Small, focused changes are strongly preferred. Device additions should include the Zigbee identity/interview that justifies the pairing manifest. Changes to shared Tuya datapoint or cluster code should explain which existing device families may be affected. - -## License and credits - -Released under the [MIT License](LICENSE). +Code contributions, device interviews and feedback are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for development instructions and [MAINTAINING.md](MAINTAINING.md) for technical and release guidance. -Thanks to everyone who has contributed code, device interviews, testing and diagnostics over the years. Individual code contributors remain credited in the repository history and release history. +## License -Tuya and the many retail brands represented by supported devices are trademarks of their respective owners. This is a community Homey integration and is not an official Tuya application. +Released under the [MIT License](LICENSE). This is a community integration and is not an official Tuya application. Tuya and the retail brands represented by supported devices are trademarks of their respective owners. diff --git a/README.txt b/README.txt index d165575765..091982d7b0 100644 --- a/README.txt +++ b/README.txt @@ -1,3 +1,3 @@ -Connect supported Tuya-manufactured Zigbee devices directly to Homey, without a Tuya gateway. The app supports a broad community-maintained range of sensors, plugs, switches, lights, remotes, curtains, thermostats, sirens and other Zigbee devices sold under many different retail brands. +Connect your Tuya Zigbee devices directly to Homey, without a Tuya gateway. Bring supported sensors, plugs, switches, lights and other devices together in Flows to automate everyday routines. -Because Tuya hardware is frequently rebranded, compatibility is based on the Zigbee identity exposed by the device rather than the retail name alone. If your device is not yet supported, you can submit its Zigbee interview through the app's GitHub repository. +Tuya devices are sold under many different brands. Compatibility depends on the Zigbee manufacturer and model identifiers reported by each device, so products that look identical may require different support. diff --git a/SUPPORTED_DEVICES.md b/SUPPORTED_DEVICES.md index 4357eef18d..e8db5c371b 100644 --- a/SUPPORTED_DEVICES.md +++ b/SUPPORTED_DEVICES.md @@ -51,6 +51,9 @@ This section is generated from the Homey manifest. It is the easiest place to ch | 5 Gang Wall Switch (`wall_switch_5_gang_tuya`) | `TS0601` | `_TZE200_jwsjbxjs` | | 6 Gang Wall Remote (`wall_remote_6_gang`) | `TS0046` | `_TZ3000_iszegwpd` | | 6 Gang Wall Switch (`wall_switch_6_gang_tuya`) | `TS0601` | `_TZE200_9mahtqtg`
`_TZE200_r731zlxk` | +| Aubess Standard Zigbee Temperature & Humidity (`temphumidsensor_aubess_qoy0ekbd`) | `TS0601` | `_TZE200_qoy0ekbd` | +| BSEED TS0001 Single-Channel Wall Switch (`switch_1_gang_bseed_ts0001`) | `TS0001` | `_TZ3000_blhvsaqf` | +| BSEED TS0726 Four-Channel Wall Switch (`switch_4_gang_bseed_ts0726`) | `TS0726` | `_TZ3002_pzao9ls1` | | Christmas Lights (`christmas_lights`) | `TS0601` | `_TZE200_s8gkrkxk` | | Curtain Module (`curtain_module`) | `TS130F` | `_TZ3000_1dd0d5yi`
`_TZ3000_4uuaja4a`
`_TZ3000_e3vhyirx`
`_TZ3000_eafaa66e`
`_TZ3000_eg7awg6a`
`_TZ3000_fccpjz5z`
`_TZ3000_femsaaua`
`_TZ3000_jwv3cwak`
`_TZ3000_ke7pzj5d`
`_TZ3000_vd43bbfq`
`_TZ3000_zirycpws`
`_TZ3210_dwytrmda`
`_TZ3210_ol1uhvza` | | Curtain Motor (`curtain_motor`) | `TS0601` | `_TZE200_3i3exuay`
`_TZE200_4vobcgd3`
`_TZE200_5zbp6j0u`
`_TZE200_68nvbio9`
`_TZE200_9p5xmj5r`
`_TZE200_axgvo9jh`
`_TZE200_bjzrowv2`
`_TZE200_cf1sl3tj`
`_TZE200_cowvfni3`
`_TZE200_fdtjuw7u`
`_TZE200_gaj531w3`
`_TZE200_hsgrhjpf`
`_TZE200_nkoabg8w`
`_TZE200_nogaemzt`
`_TZE200_nueqqe6k`
`_TZE200_nw1r9hp6`
`_TZE200_pk0sfzvr`
`_TZE200_pw7mji0l`
`_TZE200_r0jdjrvi`
`_TZE200_rddyvrci`
`_TZE200_rmymn92d`
`_TZE200_uj3f4wr5`
`_TZE200_wmcdj3aq`
`_TZE200_xaabybja`
`_TZE200_xuzcvlku`
`_TZE200_yia0p3tr`
`_TZE200_zah67ekd`
`_TZE200_zpzndjez`
`_TZE204_1fuxihti`
`_TZE204_xu4a5rhj` | @@ -65,10 +68,16 @@ This section is generated from the Homey manifest. It is the easiest place to ch | Double Power Point (`double_power_point_2`) | `TS011F` | `_TYZB01_hlla45kx`
`_TZ3000_k6fvknrr` | | Double Power Point - With Metering (`double_power_point`) | `TS011F` | `_TZ3000_dd8wwzcy`
`_TZ3210_7jnk7l3k`
`_TZ3210_pfbzs1an` | | Double Socket Smart Plug (`smartplug_2_socket`) | `TS011F` | `_TZ3000_jak16dll` | +| ELIVCO Standard Door & Window Sensor (`contact_sensor_elivco_x8q36xwf`) | `TS0203` | `_TZ3000_x8q36xwf` | +| eWeLink SNZB-04 Door & Window Sensor (`contact_sensor_ewelink_snzb04`) | `SNZB-04` | `eWeLink` | +| eWeLink Temperature & Humidity Sensor (`temphumidsensor_ewelink`) | `CK-TLSR8656-SS5-01(7014)` | `eWeLink` | +| Excellux External Probe Temperature & Humidity Sensor (`temphumidsensor_excellux`) | `Excellux` | `NTCHT02` | | Fantem 4-in-1 Multi Sensor (`fantem_zb003x`) | `TS0202` | `_TZ3210_zmy9hjay` | | Finger Bot (`fingerbot`) | `TS0001`
`TS0001_fingerbot` | `_TZ3210_232nryqh`
`_TZ3210_dse8ogfy`
`_TZ3210_j4pdtz9v`
`_TZ3210_okbss9dy` | | Flood sensor (`flood_sensor`) | `RH3001`
`TS0207` | `TUYATEC-3tipnsrx`
`_TZ3000_3dfewsk1`
`_TZ3000_4uvovz4r`
`_TZ3000_bfopm9ga`
`_TZ3000_wuep9zng`
`_TZ3000_ww9i3e0y` | | Flood sensor (`flood_sensor_2`) | `TS0207` | `_TZ3000_baeiitad` | +| HOBEIAN Contact & Illuminance Sensor (`contact_lux_hobeian`) | `ZG-102ZL` | `HOBEIAN` | +| HOBEIAN Motion & Illuminance Sensor (`motion_lux_hobeian_zg204zl`) | `ZG-204ZL` | `HOBEIAN` | | HOBEIAN Temperature & Humidity Sensor (`temphumidsensor_hobeian`) | `ZG-227Z` | `HOBEIAN` | | HOBEIAN Water Leak Sensor (`hobeian_water_leak`) | `ZG-222Z` | `HOBEIAN` | | Illuminance Sensor (`illuminance_sensor`) | `TS0222` | `_TZ3000_8uxxzz4b`
`_TZ3000_do6txrcw`
`_TZ3000_hy6ncvmw` | @@ -82,6 +91,7 @@ This section is generated from the Homey manifest. It is the easiest place to ch | Motion Sensor (`motion_sensor_2`) | `TS0601` | `_TZE200_1ibpyhdc`
`_TZE200_3towulqd`
`_TZE200_bh3n6gk8`
`_TZE200_ttcovulf` | | Motion Sensor (`motion_sensor_3`) | `TS0601` | `_TZE200_mgxy2d9f` | | Motion Sensor & Scene Switch (`motion_scene_switch`) | `TS0202` | `_TZ3210_cwamkvua` | +| MOWE MW815R Rain Sensor (IAS) (`rain_sensor_mowe`) | `TS0207` | `_TZ3000_o9f2zqln` | | MTG075 Presence Sensor with Relay (`mtg075_radar_sensor`) | `TS0601` | `_TZE204_mtoaryre` | | Outdoor Plug without metering (`outdoor_plug`) | `TS0101` | `_TZ3000_br3laukf`
`_TZ3000_pnzfdr9y` | | Outdoor Smart Socket (`outdoor_2_socket`) | `TS011F` | `_TZ3000_uwkja6z1` | @@ -126,6 +136,8 @@ This section is generated from the Homey manifest. It is the easiest place to ch | Smoke Sensor (`smoke_sensor3`) | `TS0205` | `_TZ3210_up3pngle` | | Soil Sensor (`soilsensor`) | `TS0601` | `_TZE200_2se8efxh`
`_TZE200_9cqcpkgb`
`_TZE200_ga1maeof`
`_TZE200_myd45weu`
`_TZE204_myd45weu` | | Soil Sensor (`soilsensor_2`) | `TS0601` | `_TZE284_aao3yzhs`
`_TZE284_g2e6cpnw`
`_TZE284_sgabhwa6` | +| Standard Motion & Illuminance Sensor (`motion_lux_kb5noeto`) | `TS0601` | `_TZE200_kb5noeto` | +| Standard Zigbee Water Leak Sensor (battery unverified) (`flood_sensor_unverified_battery`) | `TS0207` | `_TZ3000_4qaowtdo`
`_TZ3000_bzt33cyu`
`_TZ3000_qhozxs2b` | | Temperature & Humidity Sensor (`temphumidsensor`) | `RH3052`
`TS0201` | `TUYATEC-1g3tawnp`
`TUYATEC-1uxx9cci`
`TUYATEC-Bfq2i2Sy`
`TUYATEC-HaoiuWzy`
`TUYATEC-abkehqus`
`TUYATEC-g3gl6cgy`
`TUYATEC-gqhxixyk`
`TUYATEC-ojmxeikg`
`TUYATEC-ojmxeikq`
`TUYATEC-prhs1rsd`
`TUYATEC-riuj5xzs`
`TUYATEC-v3uxbuxy`
`TUYATEC-vmgh3fxd`
`TUYATEC-yg5dcbfu`
`_TZ3000_8ybe88nf`
`_TZ3000_bgsigers`
`_TZ3000_bguser20`
`_TZ3000_f2bw0b6k`
`_TZ3000_fie1dpkm`
`_TZ3000_i8jfiezr`
`_TZ3000_unw0hpdv` | | Temperature & Humidity Sensor (`temphumidsensor2`) | `RH3052`
`TS0201` | `TUYATEC-qun7vq14`
`_TZ3000_0s1izerx`
`_TZ3000_akqdg6g7`
`_TZ3000_dowj6gyi` | | Temperature & Humidity Sensor (`temphumidsensor3`) | `TS0201`
`TS0601` | `Wing`
`Zbeacon`
`_TZ3000_6uzkisv2`
`_TZ3000_fllyghyj`
`_TZ3000_saiqcn0y`
`_TZ3000_utwgoauk`
`_TZ3000_v1w2k9dd`
`_TZ3000_xr3htd96`
`_TZ3000_zl1kmjqx`
`_TZE200_a8sdabtg` | @@ -133,6 +145,13 @@ This section is generated from the Homey manifest. It is the easiest place to ch | Temperature & Humidity Sensor (`temphumidsensor5`) | `TS0601` | `_TZE200_9yapgbuv` | | Temperature & Humidity Sensor (TH05Z) (`temphumidsensor_vvmbj46n`) | `TS0601` | `_TZE200_vvmbj46n` | | Thermostatic Radiator Valve (`thermostatic_radiator_valve`) | `TS0601` | `_TZE200_7yoranx2`
`_TZE200_e9ba97vf`
`_TZE200_hue3yfsn`
`_TZE200_husqqvux`
`_TZE200_kds0pmmv`
`_TZE200_kly8gjlz`
`_TZE200_lllliz3p`
`_TZE200_lnbfnyxd`
`_TZE200_mudxchsu`
`_TZE200_py4cm3he`
`_TZE200_sur6q7ko` | +| TS0001 Single-Channel On/Off Switch (`switch_1_gang_ts0001`) | `TS0001` | `_TZ3000_0t4zjtia`
`_TZ3000_hyarhbyx`
`_TZ3000_p26flek3`
`_TZ3000_y4che4dc` | +| TS0002 Two-Channel On/Off Switch (`switch_2_gang_ts0002`) | `TS0002` | `_TZ3000_l9brjwau`
`_TZ3000_lugaswf8`
`_TZ3000_pgcclddi`
`_TZ3000_ptjcjise`
`_TZ3000_rmiew70n`
`_TZ3000_zxrfobzw` | +| TS0003 Three-Channel Wall Switch (`switch_3_gang_ts0003`) | `TS0003` | `_TZ3000_iol4bl2y`
`_TZ3000_lmcp6b0a`
`_TZ3000_qkixdnon`
`_TZ3000_v4l4b0lp` | +| TS0004 Four-Channel On/Off Switch (`switch_4_gang_ts0004`) | `TS0004` | `_TZ3000_enmfaave`
`_TZ3000_s6ma1nh4` | +| TS0201 Standard Temperature & Humidity (`temphumidsensor_tsgqxdb4`) | `TS0201` | `_TZ3000_tsgqxdb4` | +| TS0601 Contact & Illuminance Sensor (`contact_lux_pay2byax`) | `TS0601` | `_TZE200_pay2byax` | +| TS0601 Standard Door & Window Sensor (`contact_sensor_n8dljorx`) | `TS0601` | `_TZE200_n8dljorx` | | Tunable Bulb E14 (`tunable_bulb_E14`) | `TS0502A` | `_TZ3000_oborybow` | | Tunable Bulb E27 (`tunable_bulb_E27`) | `TS0502A` | `_TZ3000_49qchf10` | | Tunable Spot GU10 (`tunable_spot_GU10`) | `TS0502A` | `_TZ3000_el5kt5im` | diff --git a/app.json b/app.json index fa0103e6fd..42761d1b89 100644 --- a/app.json +++ b/app.json @@ -1,7 +1,7 @@ { "_comment": "This file is generated. Please edit .homeycompose/app.json instead.", "id": "com.tuya.zigbee", - "version": "0.3.1", + "version": "0.4.0", "compatibility": ">=5.0.0", "platforms": [ "local" @@ -11,7 +11,7 @@ "en": "Tuya Zigbee" }, "description": { - "en": "Control your white label Zigbee devices made by Tuya" + "en": "Make everyday devices part of a smarter home" }, "tags": { "en": [ @@ -2226,6 +2226,290 @@ } } }, + { + "id": "contact_lux_hobeian", + "name": { + "en": "HOBEIAN Contact & Illuminance Sensor" + }, + "class": "sensor", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "alarm_contact", + "measure_luminance", + "measure_battery", + "alarm_battery" + ], + "energy": { + "batteries": [ + "OTHER" + ] + }, + "images": { + "large": "/drivers/contact_lux_hobeian/assets/images/large.png", + "small": "/drivers/contact_lux_hobeian/assets/images/small.png" + }, + "zigbee": { + "manufacturerName": [ + "HOBEIAN" + ], + "productId": [ + "ZG-102ZL" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 1, + 3, + 1024, + 1280, + 61184 + ], + "bindings": [ + 1, + 1024, + 1280 + ] + } + }, + "learnmode": { + "image": "/drivers/contact_lux_hobeian/assets/learn.svg", + "instruction": { + "en": "Follow the device instructions to enable Zigbee pairing mode." + } + } + } + }, + { + "id": "contact_lux_pay2byax", + "name": { + "en": "TS0601 Contact & Illuminance Sensor" + }, + "class": "sensor", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "alarm_contact", + "measure_luminance", + "measure_battery", + "alarm_battery" + ], + "energy": { + "batteries": [ + "OTHER" + ] + }, + "images": { + "large": "/drivers/contact_lux_pay2byax/assets/images/large.png", + "small": "/drivers/contact_lux_pay2byax/assets/images/small.png" + }, + "zigbee": { + "manufacturerName": [ + "_TZE200_pay2byax" + ], + "productId": [ + "TS0601" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 1, + 3, + 1024, + 1280 + ], + "bindings": [ + 1, + 1024, + 1280 + ] + } + }, + "learnmode": { + "image": "/drivers/contact_lux_pay2byax/assets/learn.svg", + "instruction": { + "en": "Follow the device instructions to enable Zigbee pairing mode." + } + } + } + }, + { + "id": "contact_sensor_elivco_x8q36xwf", + "name": { + "en": "ELIVCO Standard Door & Window Sensor" + }, + "class": "sensor", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "alarm_contact", + "measure_battery", + "alarm_battery" + ], + "energy": { + "batteries": [ + "OTHER" + ] + }, + "images": { + "large": "/drivers/contact_sensor_elivco_x8q36xwf/assets/images/large.png", + "small": "/drivers/contact_sensor_elivco_x8q36xwf/assets/images/small.png" + }, + "zigbee": { + "manufacturerName": [ + "_TZ3000_x8q36xwf" + ], + "productId": [ + "TS0203" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 1, + 3, + 32, + 1280 + ], + "bindings": [ + 1, + 1280 + ] + } + }, + "learnmode": { + "image": "/drivers/contact_sensor_elivco_x8q36xwf/assets/learn.svg", + "instruction": { + "en": "Follow the contact sensor's instructions to enable Zigbee pairing mode." + } + } + } + }, + { + "id": "contact_sensor_ewelink_snzb04", + "name": { + "en": "eWeLink SNZB-04 Door & Window Sensor" + }, + "class": "sensor", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "alarm_contact", + "measure_battery", + "alarm_battery" + ], + "energy": { + "batteries": [ + "OTHER" + ] + }, + "images": { + "large": "/drivers/contact_sensor_ewelink_snzb04/assets/images/large.png", + "small": "/drivers/contact_sensor_ewelink_snzb04/assets/images/small.png" + }, + "zigbee": { + "manufacturerName": [ + "eWeLink" + ], + "productId": [ + "SNZB-04" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 1, + 3, + 32, + 1280 + ], + "bindings": [ + 1, + 1280 + ] + } + }, + "learnmode": { + "image": "/drivers/contact_sensor_ewelink_snzb04/assets/learn.svg", + "instruction": { + "en": "Follow the contact sensor's instructions to enable Zigbee pairing mode." + } + } + } + }, + { + "id": "contact_sensor_n8dljorx", + "name": { + "en": "TS0601 Standard Door & Window Sensor" + }, + "class": "sensor", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "alarm_contact", + "measure_battery", + "alarm_battery" + ], + "energy": { + "batteries": [ + "CR2032" + ] + }, + "images": { + "large": "/drivers/contact_sensor_n8dljorx/assets/images/large.png", + "small": "/drivers/contact_sensor_n8dljorx/assets/images/small.png" + }, + "zigbee": { + "manufacturerName": [ + "_TZE200_n8dljorx" + ], + "productId": [ + "TS0601" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 1, + 3, + 1280 + ], + "bindings": [ + 1, + 1280 + ] + } + }, + "learnmode": { + "image": "/drivers/contact_sensor_n8dljorx/assets/learn.svg", + "instruction": { + "en": "Follow the contact sensor's instructions to enable Zigbee pairing mode." + } + } + } + }, { "id": "curtain_module", "name": { @@ -4375,11 +4659,11 @@ "settings": [] }, { - "id": "handheld_remote_4_buttons", + "id": "flood_sensor_unverified_battery", "name": { - "en": "4 Button Remote" + "en": "Standard Zigbee Water Leak Sensor (battery unverified)" }, - "class": "remote", + "class": "sensor", "platforms": [ "local" ], @@ -4387,7 +4671,63 @@ "zigbee" ], "capabilities": [ - "button" + "alarm_water", + "alarm_battery" + ], + "energy": { + "batteries": [ + "OTHER" + ] + }, + "images": { + "large": "/drivers/flood_sensor_unverified_battery/assets/images/large.png", + "small": "/drivers/flood_sensor_unverified_battery/assets/images/small.png" + }, + "zigbee": { + "manufacturerName": [ + "_TZ3000_bzt33cyu", + "_TZ3000_4qaowtdo", + "_TZ3000_qhozxs2b" + ], + "productId": [ + "TS0207" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 1, + 3, + 1280 + ], + "bindings": [ + 1, + 1280 + ] + } + }, + "learnmode": { + "image": "/drivers/flood_sensor_unverified_battery/assets/icon.svg", + "instruction": { + "en": "Follow the water leak sensor instructions to activate Zigbee pairing mode." + } + } + } + }, + { + "id": "handheld_remote_4_buttons", + "name": { + "en": "4 Button Remote" + }, + "class": "remote", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "button" ], "images": { "large": "/drivers/handheld_remote_4_buttons/assets/images/large.png", @@ -5119,6 +5459,122 @@ } ] }, + { + "id": "motion_lux_hobeian_zg204zl", + "name": { + "en": "HOBEIAN Motion & Illuminance Sensor" + }, + "class": "sensor", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "alarm_motion", + "measure_luminance", + "measure_battery", + "alarm_battery" + ], + "energy": { + "batteries": [ + "OTHER" + ] + }, + "images": { + "large": "/drivers/motion_lux_hobeian_zg204zl/assets/images/large.png", + "small": "/drivers/motion_lux_hobeian_zg204zl/assets/images/small.png" + }, + "zigbee": { + "manufacturerName": [ + "HOBEIAN" + ], + "productId": [ + "ZG-204ZL" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 1, + 3, + 1024, + 1280 + ], + "bindings": [ + 1, + 1024, + 1280 + ] + } + }, + "learnmode": { + "image": "/drivers/motion_lux_hobeian_zg204zl/assets/icon.svg", + "instruction": { + "en": "Follow the sensor instructions to activate Zigbee pairing mode." + } + } + } + }, + { + "id": "motion_lux_kb5noeto", + "name": { + "en": "Standard Motion & Illuminance Sensor" + }, + "class": "sensor", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "alarm_motion", + "measure_luminance", + "measure_battery", + "alarm_battery" + ], + "energy": { + "batteries": [ + "OTHER" + ] + }, + "images": { + "large": "/drivers/motion_lux_kb5noeto/assets/images/large.png", + "small": "/drivers/motion_lux_kb5noeto/assets/images/small.png" + }, + "zigbee": { + "manufacturerName": [ + "_TZE200_kb5noeto" + ], + "productId": [ + "TS0601" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 1, + 3, + 1024, + 1280 + ], + "bindings": [ + 1, + 1024, + 1280 + ] + } + }, + "learnmode": { + "image": "/drivers/motion_lux_kb5noeto/assets/icon.svg", + "instruction": { + "en": "Follow the sensor instructions to activate Zigbee pairing mode." + } + } + } + }, { "id": "motion_scene_switch", "name": { @@ -6960,6 +7416,61 @@ } ] }, + { + "id": "rain_sensor_mowe", + "name": { + "en": "MOWE MW815R Rain Sensor (IAS)" + }, + "class": "sensor", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "alarm_water", + "measure_battery", + "alarm_battery" + ], + "energy": { + "batteries": [ + "OTHER" + ] + }, + "images": { + "large": "/drivers/rain_sensor_mowe/assets/images/large.png", + "small": "/drivers/rain_sensor_mowe/assets/images/small.png" + }, + "zigbee": { + "manufacturerName": [ + "_TZ3000_o9f2zqln" + ], + "productId": [ + "TS0207" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 1, + 3, + 1280 + ], + "bindings": [ + 1, + 1280 + ] + } + }, + "learnmode": { + "image": "/drivers/rain_sensor_mowe/assets/icon.svg", + "instruction": { + "en": "Follow the MW815R instructions to activate Zigbee pairing mode." + } + } + } + }, { "id": "relay_board_1_channel", "name": { @@ -11040,6 +11551,59 @@ }, "settings": [] }, + { + "id": "switch_1_gang_bseed_ts0001", + "name": { + "en": "BSEED TS0001 Single-Channel Wall Switch" + }, + "class": "socket", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "onoff" + ], + "images": { + "large": "/drivers/switch_1_gang_bseed_ts0001/assets/images/large.png", + "small": "/drivers/switch_1_gang_bseed_ts0001/assets/images/small.png" + }, + "energy": { + "approximation": { + "usageOn": 0, + "usageOff": 0 + } + }, + "zigbee": { + "manufacturerName": [ + "_TZ3000_blhvsaqf" + ], + "productId": [ + "TS0001" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 4, + 5, + 6 + ], + "bindings": [ + 6 + ] + } + }, + "learnmode": { + "image": "/drivers/switch_1_gang_bseed_ts0001/assets/icon.svg", + "instruction": { + "en": "One Homey tile will be created for this BSEED neutral wall switch. Follow the physical device's instructions to enter Zigbee pairing mode." + } + } + } + }, { "id": "switch_1_gang_metering", "name": { @@ -11336,9 +11900,9 @@ ] }, { - "id": "switch_2_gang", + "id": "switch_1_gang_ts0001", "name": { - "en": "2 Gang Switch Module" + "en": "TS0001 Single-Channel On/Off Switch" }, "class": "socket", "platforms": [ @@ -11351,8 +11915,8 @@ "onoff" ], "images": { - "large": "/drivers/switch_2_gang/assets/images/large.png", - "small": "/drivers/switch_2_gang/assets/images/small.png" + "large": "/drivers/switch_1_gang_ts0001/assets/images/large.png", + "small": "/drivers/switch_1_gang_ts0001/assets/images/small.png" }, "energy": { "approximation": { @@ -11362,14 +11926,70 @@ }, "zigbee": { "manufacturerName": [ - "_TYZB01_zsl6z0pw", - "_TZ3000_4js9lo5d", - "_TZ3000_pmz6mjyu", - "_TYZB01_digziiav", - "_TZ3000_fisb3ajo", - "_TZ3000_bvrlqyj7", - "_TZ3000_jl7qyupf", - "_TZ3000_7ed9cqgi", + "_TZ3000_0t4zjtia", + "_TZ3000_p26flek3", + "_TZ3000_hyarhbyx", + "_TZ3000_y4che4dc" + ], + "productId": [ + "TS0001" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 4, + 5, + 6 + ], + "bindings": [ + 6 + ] + } + }, + "learnmode": { + "image": "/drivers/switch_1_gang_ts0001/assets/icon.svg", + "instruction": { + "en": "One Homey tile will be created for this exact TS0001 one-channel switch. Follow the physical device's pairing instructions." + } + } + } + }, + { + "id": "switch_2_gang", + "name": { + "en": "2 Gang Switch Module" + }, + "class": "socket", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "onoff" + ], + "images": { + "large": "/drivers/switch_2_gang/assets/images/large.png", + "small": "/drivers/switch_2_gang/assets/images/small.png" + }, + "energy": { + "approximation": { + "usageOn": 0, + "usageOff": 0 + } + }, + "zigbee": { + "manufacturerName": [ + "_TYZB01_zsl6z0pw", + "_TZ3000_4js9lo5d", + "_TZ3000_pmz6mjyu", + "_TYZB01_digziiav", + "_TZ3000_fisb3ajo", + "_TZ3000_bvrlqyj7", + "_TZ3000_jl7qyupf", + "_TZ3000_7ed9cqgi", "_TZ3000_llfaquvp", "_TZ3000_lmlsduws", "_TZ3000_qaa59zqd", @@ -11599,6 +12219,91 @@ } ] }, + { + "id": "switch_2_gang_ts0002", + "name": { + "en": "TS0002 Two-Channel On/Off Switch" + }, + "class": "socket", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "onoff" + ], + "images": { + "large": "/drivers/switch_2_gang_ts0002/assets/images/large.png", + "small": "/drivers/switch_2_gang_ts0002/assets/images/small.png" + }, + "energy": { + "approximation": { + "usageOn": 0, + "usageOff": 0 + } + }, + "zigbee": { + "manufacturerName": [ + "_TZ3000_lugaswf8", + "_TZ3000_zxrfobzw", + "_TZ3000_ptjcjise", + "_TZ3000_rmiew70n", + "_TZ3000_pgcclddi", + "_TZ3000_l9brjwau" + ], + "productId": [ + "TS0002" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 4, + 5, + 6 + ], + "bindings": [ + 6 + ] + }, + "2": { + "clusters": [ + 4, + 5, + 6 + ], + "bindings": [ + 6 + ] + } + }, + "devices": { + "secondSwitch": { + "class": "socket", + "capabilities": [ + "onoff" + ], + "name": { + "en": "TS0002 Switch - Channel 2" + }, + "energy": { + "approximation": { + "usageOn": 0, + "usageOff": 0 + } + } + } + }, + "learnmode": { + "image": "/drivers/switch_2_gang_ts0002/assets/icon.svg", + "instruction": { + "en": "Two tiles will be created, one for each channel. Follow the device's instructions to enter Zigbee pairing mode." + } + } + } + }, { "id": "switch_3_gang", "name": { @@ -11709,9 +12414,9 @@ "settings": [] }, { - "id": "switch_4_gang_metering", + "id": "switch_3_gang_ts0003", "name": { - "en": "4 Gang Switch Module with metering" + "en": "TS0003 Three-Channel Wall Switch" }, "class": "socket", "platforms": [ @@ -11721,46 +12426,32 @@ "zigbee" ], "capabilities": [ - "onoff", - "measure_power", - "meter_power", - "measure_current", - "measure_voltage" + "onoff" ], - "capabilitiesOptions": { - "measure_power": { - "approximated": true - } - }, "images": { - "large": "/drivers/switch_4_gang_metering/assets/images/large.png", - "small": "/drivers/switch_4_gang_metering/assets/images/small.png" + "large": "/drivers/switch_3_gang_ts0003/assets/images/large.png", + "small": "/drivers/switch_3_gang_ts0003/assets/images/small.png" + }, + "energy": { + "approximation": { + "usageOn": 0, + "usageOff": 0 + } }, "zigbee": { "manufacturerName": [ - "_TZ3000_mmkbptmx" + "_TZ3000_lmcp6b0a", + "_TZ3000_v4l4b0lp", + "_TZ3000_qkixdnon", + "_TZ3000_iol4bl2y" ], "productId": [ - "TS0004" + "TS0003" ], "endpoints": { "1": { "clusters": [ 0, - 4, - 5, - 6, - 1794, - 2820 - ], - "bindings": [ - 6, - 1794, - 2820 - ] - }, - "2": { - "clusters": [ 4, 5, 6 @@ -11769,7 +12460,7 @@ 6 ] }, - "3": { + "2": { "clusters": [ 4, 5, @@ -11779,7 +12470,7 @@ 6 ] }, - "4": { + "3": { "clusters": [ 4, 5, @@ -11797,7 +12488,13 @@ "onoff" ], "name": { - "en": "4 Gang Switch Module with metering - Second Switch" + "en": "TS0003 Switch - Channel 2" + }, + "energy": { + "approximation": { + "usageOn": 0, + "usageOff": 0 + } } }, "thirdSwitch": { @@ -11806,40 +12503,286 @@ "onoff" ], "name": { - "en": "4 Gang Switch Module with metering - Third Switch" - } - }, - "fourthSwitch": { - "class": "socket", - "capabilities": [ - "onoff" - ], - "name": { - "en": "4 Gang Switch Module with metering - Fourth Switch" + "en": "TS0003 Switch - Channel 3" + }, + "energy": { + "approximation": { + "usageOn": 0, + "usageOff": 0 + } } } }, "learnmode": { - "image": "/drivers/switch_4_gang_metering/assets/icon.svg", + "image": "/drivers/switch_3_gang_ts0003/assets/icon.svg", "instruction": { - "en": "Four tiles will be created, one for each channel of the device. Press the setup button for 10 seconds or switch the unit on and off five times to enter pairing mode (the LED should blink green)." + "en": "Three separate Homey tiles will be created, one for each channel. Follow the physical switch's instructions to enable Zigbee pairing." } } + } + }, + { + "id": "switch_4_gang_bseed_ts0726", + "name": { + "en": "BSEED TS0726 Four-Channel Wall Switch" }, - "settings": [ - { - "id": "metering_offset", - "type": "number", - "label": { - "en": "Metering Correction Factor" + "class": "socket", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "onoff" + ], + "images": { + "large": "/drivers/switch_4_gang_bseed_ts0726/assets/images/large.png", + "small": "/drivers/switch_4_gang_bseed_ts0726/assets/images/small.png" + }, + "energy": { + "approximation": { + "usageOn": 0, + "usageOff": 0 + } + }, + "zigbee": { + "manufacturerName": [ + "_TZ3002_pzao9ls1" + ], + "productId": [ + "TS0726" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 4, + 5, + 6 + ], + "bindings": [ + 6 + ] }, - "hint": { - "en": "Set a value to compensate if you experience that the Metered Power is not correct.\nRange: 0.8 - 1.2, step size 0.1, \ndefault: 1" + "2": { + "clusters": [ + 4, + 5, + 6 + ], + "bindings": [ + 6 + ] }, - "value": 1, - "attr": { - "min": 0.8, - "max": 1.2, + "3": { + "clusters": [ + 4, + 5, + 6 + ], + "bindings": [ + 6 + ] + }, + "4": { + "clusters": [ + 4, + 5, + 6 + ], + "bindings": [ + 6 + ] + } + }, + "devices": { + "secondSwitch": { + "class": "socket", + "capabilities": [ + "onoff" + ], + "name": { + "en": "BSEED TS0726 Switch - Channel 2" + }, + "energy": { + "approximation": { + "usageOn": 0, + "usageOff": 0 + } + } + }, + "thirdSwitch": { + "class": "socket", + "capabilities": [ + "onoff" + ], + "name": { + "en": "BSEED TS0726 Switch - Channel 3" + }, + "energy": { + "approximation": { + "usageOn": 0, + "usageOff": 0 + } + } + }, + "fourthSwitch": { + "class": "socket", + "capabilities": [ + "onoff" + ], + "name": { + "en": "BSEED TS0726 Switch - Channel 4" + }, + "energy": { + "approximation": { + "usageOn": 0, + "usageOff": 0 + } + } + } + }, + "learnmode": { + "image": "/drivers/switch_4_gang_bseed_ts0726/assets/icon.svg", + "instruction": { + "en": "Four independent Homey tiles will be created for this BSEED TS0726 neutral wall switch. Follow the physical device's instructions to enter Zigbee pairing mode." + } + } + } + }, + { + "id": "switch_4_gang_metering", + "name": { + "en": "4 Gang Switch Module with metering" + }, + "class": "socket", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "onoff", + "measure_power", + "meter_power", + "measure_current", + "measure_voltage" + ], + "capabilitiesOptions": { + "measure_power": { + "approximated": true + } + }, + "images": { + "large": "/drivers/switch_4_gang_metering/assets/images/large.png", + "small": "/drivers/switch_4_gang_metering/assets/images/small.png" + }, + "zigbee": { + "manufacturerName": [ + "_TZ3000_mmkbptmx" + ], + "productId": [ + "TS0004" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 4, + 5, + 6, + 1794, + 2820 + ], + "bindings": [ + 6, + 1794, + 2820 + ] + }, + "2": { + "clusters": [ + 4, + 5, + 6 + ], + "bindings": [ + 6 + ] + }, + "3": { + "clusters": [ + 4, + 5, + 6 + ], + "bindings": [ + 6 + ] + }, + "4": { + "clusters": [ + 4, + 5, + 6 + ], + "bindings": [ + 6 + ] + } + }, + "devices": { + "secondSwitch": { + "class": "socket", + "capabilities": [ + "onoff" + ], + "name": { + "en": "4 Gang Switch Module with metering - Second Switch" + } + }, + "thirdSwitch": { + "class": "socket", + "capabilities": [ + "onoff" + ], + "name": { + "en": "4 Gang Switch Module with metering - Third Switch" + } + }, + "fourthSwitch": { + "class": "socket", + "capabilities": [ + "onoff" + ], + "name": { + "en": "4 Gang Switch Module with metering - Fourth Switch" + } + } + }, + "learnmode": { + "image": "/drivers/switch_4_gang_metering/assets/icon.svg", + "instruction": { + "en": "Four tiles will be created, one for each channel of the device. Press the setup button for 10 seconds or switch the unit on and off five times to enter pairing mode (the LED should blink green)." + } + } + }, + "settings": [ + { + "id": "metering_offset", + "type": "number", + "label": { + "en": "Metering Correction Factor" + }, + "hint": { + "en": "Set a value to compensate if you experience that the Metered Power is not correct.\nRange: 0.8 - 1.2, step size 0.1, \ndefault: 1" + }, + "value": 1, + "attr": { + "min": 0.8, + "max": 1.2, "step": 0.1 } }, @@ -11876,113 +12819,805 @@ } }, { - "id": "minReportCurrent", + "id": "minReportCurrent", + "type": "number", + "label": { + "en": "Min report interval for current (s)" + }, + "hint": { + "en": "Min interval before a report is sent to Homey (s)" + }, + "value": 60, + "attr": { + "step": 1, + "min": 10, + "max": 86400 + } + }, + { + "id": "minReportVoltage", + "type": "number", + "label": { + "en": "Min report interval for voltage (s)" + }, + "hint": { + "en": "Min interval before a report is sent to Homey (s)" + }, + "value": 60, + "attr": { + "step": 1, + "min": 10, + "max": 86400 + } + } + ] + }, + { + "id": "switch_4_gang_ts0004", + "name": { + "en": "TS0004 Four-Channel On/Off Switch" + }, + "class": "socket", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "onoff" + ], + "images": { + "large": "/drivers/switch_4_gang_ts0004/assets/images/large.png", + "small": "/drivers/switch_4_gang_ts0004/assets/images/small.png" + }, + "energy": { + "approximation": { + "usageOn": 0, + "usageOff": 0 + } + }, + "zigbee": { + "manufacturerName": [ + "_TZ3000_s6ma1nh4", + "_TZ3000_enmfaave" + ], + "productId": [ + "TS0004" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 4, + 5, + 6 + ], + "bindings": [ + 6 + ] + }, + "2": { + "clusters": [ + 4, + 5, + 6 + ], + "bindings": [ + 6 + ] + }, + "3": { + "clusters": [ + 4, + 5, + 6 + ], + "bindings": [ + 6 + ] + }, + "4": { + "clusters": [ + 4, + 5, + 6 + ], + "bindings": [ + 6 + ] + } + }, + "devices": { + "secondSwitch": { + "class": "socket", + "capabilities": [ + "onoff" + ], + "name": { + "en": "TS0004 Switch - Channel 2" + }, + "energy": { + "approximation": { + "usageOn": 0, + "usageOff": 0 + } + } + }, + "thirdSwitch": { + "class": "socket", + "capabilities": [ + "onoff" + ], + "name": { + "en": "TS0004 Switch - Channel 3" + }, + "energy": { + "approximation": { + "usageOn": 0, + "usageOff": 0 + } + } + }, + "fourthSwitch": { + "class": "socket", + "capabilities": [ + "onoff" + ], + "name": { + "en": "TS0004 Switch - Channel 4" + }, + "energy": { + "approximation": { + "usageOn": 0, + "usageOff": 0 + } + } + } + }, + "learnmode": { + "image": "/drivers/switch_4_gang_ts0004/assets/icon.svg", + "instruction": { + "en": "Four Homey tiles will be created, one for each relay channel. Follow the device's own instructions to enter Zigbee pairing mode." + } + } + } + }, + { + "id": "temphumidsensor", + "name": { + "en": "Temperature & Humidity Sensor" + }, + "class": "sensor", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "measure_temperature", + "measure_humidity", + "measure_battery", + "alarm_battery" + ], + "energy": { + "batteries": [ + "CR2032" + ] + }, + "images": { + "large": "/drivers/temphumidsensor/assets/images/large.png", + "small": "/drivers/temphumidsensor/assets/images/small.png" + }, + "zigbee": { + "manufacturerName": [ + "TUYATEC-g3gl6cgy", + "TUYATEC-Bfq2i2Sy", + "TUYATEC-abkehqus", + "TUYATEC-yg5dcbfu", + "TUYATEC-prhs1rsd", + "TUYATEC-gqhxixyk", + "TUYATEC-vmgh3fxd", + "TUYATEC-ojmxeikg", + "TUYATEC-ojmxeikq", + "TUYATEC-1g3tawnp", + "_TZ3000_i8jfiezr", + "TUYATEC-v3uxbuxy", + "_TZ3000_bguser20", + "_TZ3000_bgsigers", + "_TZ3000_8ybe88nf", + "_TZ3000_fie1dpkm", + "TUYATEC-riuj5xzs", + "TUYATEC-1uxx9cci", + "_TZ3000_f2bw0b6k", + "_TZ3000_unw0hpdv", + "TUYATEC-HaoiuWzy" + ], + "productId": [ + "RH3052", + "TS0201" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 1, + 1026, + 1029 + ], + "bindings": [ + 1, + 1026, + 1029 + ] + } + }, + "learnmode": { + "image": "/drivers/temphumidsensor/assets/learn.svg", + "instruction": { + "en": "Insert a pin into the single hole on the side of the device and press it gently for aprox 10 seconds until the LED blinks rapidly." + } + } + }, + "settings": [ + { + "id": "temperature_offset", + "type": "number", + "label": { + "en": "Temperature offset (°C)" + }, + "hint": { + "en": "Set a value to compensate a temperature offset.\nRange: -10 - 10, step size 0.1, \ndefault: 0 [°C]" + }, + "value": 0, + "attr": { + "min": -10, + "max": 10, + "step": 0.1 + } + }, + { + "id": "temperature_decimals", + "type": "radio", + "label": { + "en": "Temperature reporting decimals" + }, + "value": "1", + "values": [ + { + "id": "1", + "label": { + "en": "Report temperature value with 1 decimal (21.4 °C)" + } + }, + { + "id": "2", + "label": { + "en": "Report temperature value with 2 decimals (21.37 °C)" + } + } + ] + }, + { + "id": "humidity_offset", + "type": "number", + "label": { + "en": "Humidity offset (%)", + "nl": "Luchtvochtigheids compensatie (%)" + }, + "hint": { + "en": "Set a correction to compensate a humidity offset.\nRange: -10 - 10, step size 1, \ndefault: 0 [%]", + "nl": "Stel een correctiewaarde in om een Luchtvochtigheids verschil te compenseren.\nBereik: -10 - 10, stap grootte 1, \nstandaard: 0 [%]" + }, + "value": 0, + "attr": { + "min": -10, + "max": 10, + "step": 1 + }, + "units": { + "en": "%", + "nl": "%" + } + }, + { + "id": "humidity_decimals", + "type": "radio", + "label": { + "en": "Humidity reporting" + }, + "value": "1", + "values": [ + { + "id": "1", + "label": { + "en": "Report humidity value with 1 decimal (35.2 %)" + } + }, + { + "id": "2", + "label": { + "en": "Report humidity value with 2 decimals (35.19 %)" + } + } + ] + } + ] + }, + { + "id": "temphumidsensor2", + "name": { + "en": "Temperature & Humidity Sensor" + }, + "class": "sensor", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "measure_temperature", + "measure_humidity", + "measure_battery", + "alarm_battery" + ], + "energy": { + "batteries": [ + "CR2450" + ] + }, + "images": { + "large": "/drivers/temphumidsensor2/assets/images/large.png", + "small": "/drivers/temphumidsensor2/assets/images/small.png" + }, + "zigbee": { + "manufacturerName": [ + "_TZ3000_dowj6gyi", + "_TZ3000_0s1izerx", + "TUYATEC-qun7vq14", + "_TZ3000_akqdg6g7" + ], + "productId": [ + "RH3052", + "TS0201" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 1, + 1026, + 1029 + ], + "bindings": [ + 1, + 1026, + 1029 + ] + } + }, + "learnmode": { + "image": "/drivers/temphumidsensor2/assets/learn.svg", + "instruction": { + "en": "Insert a pin into the single hole on the side of the device and press it gently for aprox 10 seconds until the LED blinks rapidly." + } + } + }, + "settings": [ + { + "id": "temperature_offset", + "type": "number", + "label": { + "en": "Temperature offset (°C)" + }, + "hint": { + "en": "Set a value to compensate a temperature offset.\nRange: -10 - 10, step size 0.1, \ndefault: 0 [°C]" + }, + "value": 0, + "attr": { + "min": -10, + "max": 10, + "step": 0.1 + } + }, + { + "id": "temperature_decimals", + "type": "radio", + "label": { + "en": "Temperature reporting decimals" + }, + "value": "1", + "values": [ + { + "id": "1", + "label": { + "en": "Report temperature value with 1 decimal (21.4 °C)" + } + }, + { + "id": "2", + "label": { + "en": "Report temperature value with 2 decimals (21.37 °C)" + } + } + ] + }, + { + "id": "humidity_offset", + "type": "number", + "label": { + "en": "Humidity offset (%)", + "nl": "Luchtvochtigheids compensatie (%)" + }, + "hint": { + "en": "Set a correction to compensate a humidity offset.\nRange: -10 - 10, step size 1, \ndefault: 0 [%]", + "nl": "Stel een correctiewaarde in om een Luchtvochtigheids verschil te compenseren.\nBereik: -10 - 10, stap grootte 1, \nstandaard: 0 [%]" + }, + "value": 0, + "attr": { + "min": -10, + "max": 10, + "step": 1 + }, + "units": { + "en": "%", + "nl": "%" + } + }, + { + "id": "humidity_decimals", + "type": "radio", + "label": { + "en": "Humidity reporting" + }, + "value": "1", + "values": [ + { + "id": "1", + "label": { + "en": "Report humidity value with 1 decimal (35.2 %)" + } + }, + { + "id": "2", + "label": { + "en": "Report humidity value with 2 decimals (35.19 %)" + } + } + ] + } + ] + }, + { + "id": "temphumidsensor3", + "name": { + "en": "Temperature & Humidity Sensor", + "it": "Sensore di temperatura ed umidità" + }, + "class": "sensor", + "capabilities": [ + "measure_battery", + "alarm_battery", + "measure_humidity", + "measure_temperature" + ], + "energy": { + "batteries": [ + "AAA", + "AAA" + ] + }, + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "images": { + "small": "/drivers/temphumidsensor3/assets/images/small.png", + "large": "/drivers/temphumidsensor3/assets/images/large.png" + }, + "zigbee": { + "manufacturerName": [ + "Wing", + "Zbeacon", + "_TZ3000_fllyghyj", + "_TZ3000_xr3htd96", + "_TZ3000_saiqcn0y", + "_TZE200_a8sdabtg", + "_TZ3000_utwgoauk", + "_TZ3000_zl1kmjqx", + "_TZ3000_6uzkisv2", + "_TZ3000_v1w2k9dd" + ], + "productId": [ + "TS0201", + "TS0601" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 1, + 1026, + 1029 + ], + "bindings": [ + 1, + 1026, + 1029 + ] + } + }, + "learnmode": { + "instruction": { + "en": "Press and hold the button inside the battery compartment for aprox 5 seconds until the LED blinks rapidly.", + "it": "Tenere premuto il pulsante all'interno del vano batteria per cicrca 5 secondi finchè il LED non lampeggia rapidamente." + } + } + }, + "settings": [ + { + "id": "temperature_offset", + "type": "number", + "label": { + "en": "Temperature offset (°C)", + "it": "Offset della temperatura (°C)" + }, + "hint": { + "en": "Set a value to compensate a temperature offset.\nRange: -10 - 10, step size 0.1, \ndefault: 0 [°C]", + "it": "Imposta un valore per compensare lo scostamento della temperatura.\nRange: -10 - 10, step ze 0.1, \ndefault: 0 [°C]" + }, + "value": 0, + "attr": { + "min": -10, + "max": 10, + "step": 0.1 + } + }, + { + "id": "temperature_decimals", + "type": "radio", + "label": { + "en": "Temperature reporting decimals", + "it": "Decimali del report della temperatura" + }, + "value": "1", + "values": [ + { + "id": "1", + "label": { + "en": "Report temperature value with 1 decimal (21.4 °C)", + "it": "Valore del report della temperatura con 1 decimale (21.4 °C)" + } + }, + { + "id": "2", + "label": { + "en": "Report temperature value with 2 decimals (21.37 °C)", + "it": "Valore del report della temperatura con 2 decimale (21.31 °C)" + } + } + ] + }, + { + "id": "humidity_offset", + "type": "number", + "label": { + "en": "Humidity offset (%)", + "nl": "Luchtvochtigheids compensatie (%)", + "it": "Offset dell'umidità (%)" + }, + "hint": { + "en": "Set a correction to compensate a humidity offset.\nRange: -10 - 10, step size 1, \ndefault: 0 [%]", + "nl": "Stel een correctiewaarde in om een Luchtvochtigheids verschil te compenseren.\nBereik: -10 - 10, stap grootte 1, \nstandaard: 0 [%]", + "it": "Imposta un valore per compensare lo scostamento dell'umidità.\nRange: -10 - 10, step size 1, \ndefault: 0 [%]" + }, + "value": 0, + "attr": { + "min": -10, + "max": 10, + "step": 1 + }, + "units": { + "en": "%", + "nl": "%" + } + }, + { + "id": "humidity_decimals", + "type": "radio", + "label": { + "en": "Humidity reporting", + "it": "Report dell'umidità" + }, + "value": "1", + "values": [ + { + "id": "1", + "label": { + "en": "Report humidity value with 1 decimal (35.2 %)", + "it": "Valore del report dell'umidità con 1 decimale (35.2 %)" + } + }, + { + "id": "2", + "label": { + "en": "Report humidity value with 2 decimals (35.19 %)", + "it": "Valore del report dell'umidità con 2 decimale (35.19 %)" + } + } + ] + } + ] + }, + { + "id": "temphumidsensor4", + "name": { + "en": "Temperature & Humidity Sensor", + "sv": "Temperatur- och fuktighetssensor" + }, + "class": "sensor", + "capabilities": [ + "measure_temperature", + "measure_humidity", + "measure_battery", + "alarm_battery" + ], + "capabilitiesOptions": {}, + "energy": { + "batteries": [ + "AAA", + "AAA" + ] + }, + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "images": { + "small": "/drivers/temphumidsensor4/assets/images/small.png", + "large": "/drivers/temphumidsensor4/assets/images/large.png" + }, + "zigbee": { + "manufacturerName": [ + "_TZE204_yjjdcqsq", + "_TZE200_yjjdcqsq", + "_TZE200_utkemkbs", + "_TZE204_upagmta9", + "_TZE204_utkemkbs", + "_TZE204_9yapgbuv", + "_TZE200_cirvgep4", + "_TZE204_cirvgep4" + ], + "productId": [ + "TS0601" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 4, + 5, + 61184 + ], + "bindings": [ + 10, + 25, + 61184 + ] + } + }, + "learnmode": { + "instruction": { + "en": "Press and hold the reset button for aprox 10 seconds until the LED blinks rapidly.", + "sv": "Tryck in nollnings-knappen under ca 10 sekunder tills LED-lampan binkar snabbt" + } + } + }, + "settings": [ + { + "id": "temperature_offset", "type": "number", "label": { - "en": "Min report interval for current (s)" + "en": "Temperature offset (°C)", + "it": "Offset della temperatura (°C)" }, "hint": { - "en": "Min interval before a report is sent to Homey (s)" + "en": "Set a value to compensate a temperature offset.\nRange: -10 - 10, step size 0.1, \ndefault: 0 [°C]", + "it": "Imposta un valore per compensare lo scostamento della temperatura.\nRange: -10 - 10, step ze 0.1, \ndefault: 0 [°C]", + "sv": "Ange ett värde för att korrigera felaktig temperatur.\nIntervall: -10 - 10, steg om 0.1, \nstandard: 0 [°C]" }, - "value": 60, + "value": 0, "attr": { - "step": 1, - "min": 10, - "max": 86400 + "min": -10, + "max": 10, + "step": 0.1 } }, { - "id": "minReportVoltage", + "id": "humidity_offset", "type": "number", "label": { - "en": "Min report interval for voltage (s)" + "en": "Humidity offset (%)", + "nl": "Luchtvochtigheids compensatie (%)", + "it": "Offset dell'umidità (%)", + "sv": "Fuktighetskorrigering (%)" }, "hint": { - "en": "Min interval before a report is sent to Homey (s)" + "en": "Set a correction to compensate a humidity offset.\nRange: -10 - 10, step size 1, \ndefault: 0 [%]", + "nl": "Stel een correctiewaarde in om een Luchtvochtigheids verschil te compenseren.\nBereik: -10 - 10, stap grootte 1, \nstandaard: 0 [%]", + "it": "Imposta un valore per compensare lo scostamento dell'umidità.\nRange: -10 - 10, step size 1, \ndefault: 0 [%]", + "sv": "Ange ett värde för att korrigera felaktig fuktighet.\nIntervall: -10 - 10, steg om 1, \nstandard: 0 [%]" }, - "value": 60, + "value": 0, "attr": { - "step": 1, - "min": 10, - "max": 86400 + "min": -10, + "max": 10, + "step": 1 } } ] }, { - "id": "temphumidsensor", + "id": "temphumidsensor5", "name": { - "en": "Temperature & Humidity Sensor" + "en": "Temperature & Humidity Sensor", + "sv": "Temperatur- och fuktighetssensor" }, "class": "sensor", - "platforms": [ - "local" - ], - "connectivity": [ - "zigbee" - ], "capabilities": [ "measure_temperature", "measure_humidity", "measure_battery", "alarm_battery" ], + "capabilitiesOptions": {}, "energy": { "batteries": [ "CR2032" ] }, + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], "images": { - "large": "/drivers/temphumidsensor/assets/images/large.png", - "small": "/drivers/temphumidsensor/assets/images/small.png" + "small": "/drivers/temphumidsensor5/assets/images/small.png", + "large": "/drivers/temphumidsensor5/assets/images/large.png" }, "zigbee": { "manufacturerName": [ - "TUYATEC-g3gl6cgy", - "TUYATEC-Bfq2i2Sy", - "TUYATEC-abkehqus", - "TUYATEC-yg5dcbfu", - "TUYATEC-prhs1rsd", - "TUYATEC-gqhxixyk", - "TUYATEC-vmgh3fxd", - "TUYATEC-ojmxeikg", - "TUYATEC-ojmxeikq", - "TUYATEC-1g3tawnp", - "_TZ3000_i8jfiezr", - "TUYATEC-v3uxbuxy", - "_TZ3000_bguser20", - "_TZ3000_bgsigers", - "_TZ3000_8ybe88nf", - "_TZ3000_fie1dpkm", - "TUYATEC-riuj5xzs", - "TUYATEC-1uxx9cci", - "_TZ3000_f2bw0b6k", - "_TZ3000_unw0hpdv", - "TUYATEC-HaoiuWzy" + "_TZE200_9yapgbuv" ], "productId": [ - "RH3052", - "TS0201" + "TS0601" ], "endpoints": { "1": { "clusters": [ 0, - 1, - 1026, - 1029 + 4, + 5, + 61184 ], "bindings": [ - 1, - 1026, - 1029 + 10, + 25, + 61184 ] } }, "learnmode": { - "image": "/drivers/temphumidsensor/assets/learn.svg", "instruction": { - "en": "Insert a pin into the single hole on the side of the device and press it gently for aprox 10 seconds until the LED blinks rapidly." + "en": "Press and hold the reset button for aprox 10 seconds until the LED blinks rapidly.", + "sv": "Tryck in nollnings-knappen under ca 10 sekunder tills LED-lampan binkar snabbt" } } }, @@ -11991,10 +13626,13 @@ "id": "temperature_offset", "type": "number", "label": { - "en": "Temperature offset (°C)" + "en": "Temperature offset (°C)", + "it": "Offset della temperatura (°C)" }, "hint": { - "en": "Set a value to compensate a temperature offset.\nRange: -10 - 10, step size 0.1, \ndefault: 0 [°C]" + "en": "Set a value to compensate a temperature offset.\nRange: -10 - 10, step size 0.1, \ndefault: 0 [°C]", + "it": "Imposta un valore per compensare lo scostamento della temperatura.\nRange: -10 - 10, step ze 0.1, \ndefault: 0 [°C]", + "sv": "Ange ett värde för att korrigera felaktig temperatur.\nIntervall: -10 - 10, steg om 0.1, \nstandard: 0 [°C]" }, "value": 0, "attr": { @@ -12003,78 +13641,34 @@ "step": 0.1 } }, - { - "id": "temperature_decimals", - "type": "radio", - "label": { - "en": "Temperature reporting decimals" - }, - "value": "1", - "values": [ - { - "id": "1", - "label": { - "en": "Report temperature value with 1 decimal (21.4 °C)" - } - }, - { - "id": "2", - "label": { - "en": "Report temperature value with 2 decimals (21.37 °C)" - } - } - ] - }, { "id": "humidity_offset", "type": "number", "label": { "en": "Humidity offset (%)", - "nl": "Luchtvochtigheids compensatie (%)" + "nl": "Luchtvochtigheids compensatie (%)", + "it": "Offset dell'umidità (%)", + "sv": "Fuktighetskorrigering (%)" }, "hint": { "en": "Set a correction to compensate a humidity offset.\nRange: -10 - 10, step size 1, \ndefault: 0 [%]", - "nl": "Stel een correctiewaarde in om een Luchtvochtigheids verschil te compenseren.\nBereik: -10 - 10, stap grootte 1, \nstandaard: 0 [%]" + "nl": "Stel een correctiewaarde in om een Luchtvochtigheids verschil te compenseren.\nBereik: -10 - 10, stap grootte 1, \nstandaard: 0 [%]", + "it": "Imposta un valore per compensare lo scostamento dell'umidità.\nRange: -10 - 10, step size 1, \ndefault: 0 [%]", + "sv": "Ange ett värde för att korrigera felaktig fuktighet.\nIntervall: -10 - 10, steg om 1, \nstandard: 0 [%]" }, "value": 0, "attr": { "min": -10, "max": 10, "step": 1 - }, - "units": { - "en": "%", - "nl": "%" } - }, - { - "id": "humidity_decimals", - "type": "radio", - "label": { - "en": "Humidity reporting" - }, - "value": "1", - "values": [ - { - "id": "1", - "label": { - "en": "Report humidity value with 1 decimal (35.2 %)" - } - }, - { - "id": "2", - "label": { - "en": "Report humidity value with 2 decimals (35.19 %)" - } - } - ] } ] }, { - "id": "temphumidsensor2", + "id": "temphumidsensor_aubess_qoy0ekbd", "name": { - "en": "Temperature & Humidity Sensor" + "en": "Aubess Standard Zigbee Temperature & Humidity" }, "class": "sensor", "platforms": [ @@ -12089,25 +13683,16 @@ "measure_battery", "alarm_battery" ], - "energy": { - "batteries": [ - "CR2450" - ] - }, "images": { - "large": "/drivers/temphumidsensor2/assets/images/large.png", - "small": "/drivers/temphumidsensor2/assets/images/small.png" + "large": "/drivers/temphumidsensor_aubess_qoy0ekbd/assets/images/large.png", + "small": "/drivers/temphumidsensor_aubess_qoy0ekbd/assets/images/small.png" }, "zigbee": { "manufacturerName": [ - "_TZ3000_dowj6gyi", - "_TZ3000_0s1izerx", - "TUYATEC-qun7vq14", - "_TZ3000_akqdg6g7" + "_TZE200_qoy0ekbd" ], "productId": [ - "RH3052", - "TS0201" + "TS0601" ], "endpoints": { "1": { @@ -12125,12 +13710,17 @@ } }, "learnmode": { - "image": "/drivers/temphumidsensor2/assets/learn.svg", + "image": "/drivers/temphumidsensor_aubess_qoy0ekbd/assets/learn.svg", "instruction": { - "en": "Insert a pin into the single hole on the side of the device and press it gently for aprox 10 seconds until the LED blinks rapidly." + "en": "Follow your sensor's instructions to put it into Zigbee pairing mode." } } }, + "energy": { + "batteries": [ + "OTHER" + ] + }, "settings": [ { "id": "temperature_offset", @@ -12217,50 +13807,33 @@ ] }, { - "id": "temphumidsensor3", + "id": "temphumidsensor_ewelink", "name": { - "en": "Temperature & Humidity Sensor", - "it": "Sensore di temperatura ed umidità" + "en": "eWeLink Temperature & Humidity Sensor" }, "class": "sensor", - "capabilities": [ - "measure_battery", - "alarm_battery", - "measure_humidity", - "measure_temperature" - ], - "energy": { - "batteries": [ - "AAA", - "AAA" - ] - }, "platforms": [ "local" ], "connectivity": [ "zigbee" ], + "capabilities": [ + "measure_temperature", + "measure_humidity", + "measure_battery", + "alarm_battery" + ], "images": { - "small": "/drivers/temphumidsensor3/assets/images/small.png", - "large": "/drivers/temphumidsensor3/assets/images/large.png" + "large": "/drivers/temphumidsensor_ewelink/assets/images/large.png", + "small": "/drivers/temphumidsensor_ewelink/assets/images/small.png" }, "zigbee": { "manufacturerName": [ - "Wing", - "Zbeacon", - "_TZ3000_fllyghyj", - "_TZ3000_xr3htd96", - "_TZ3000_saiqcn0y", - "_TZE200_a8sdabtg", - "_TZ3000_utwgoauk", - "_TZ3000_zl1kmjqx", - "_TZ3000_6uzkisv2", - "_TZ3000_v1w2k9dd" + "eWeLink" ], "productId": [ - "TS0201", - "TS0601" + "CK-TLSR8656-SS5-01(7014)" ], "endpoints": { "1": { @@ -12278,23 +13851,27 @@ } }, "learnmode": { + "image": "/drivers/temphumidsensor_ewelink/assets/learn.svg", "instruction": { - "en": "Press and hold the button inside the battery compartment for aprox 5 seconds until the LED blinks rapidly.", - "it": "Tenere premuto il pulsante all'interno del vano batteria per cicrca 5 secondi finchè il LED non lampeggia rapidamente." + "en": "Follow the device's instructions to enable Zigbee pairing mode." } } }, + "energy": { + "batteries": [ + "AAA", + "AAA" + ] + }, "settings": [ { "id": "temperature_offset", "type": "number", "label": { - "en": "Temperature offset (°C)", - "it": "Offset della temperatura (°C)" + "en": "Temperature offset (°C)" }, "hint": { - "en": "Set a value to compensate a temperature offset.\nRange: -10 - 10, step size 0.1, \ndefault: 0 [°C]", - "it": "Imposta un valore per compensare lo scostamento della temperatura.\nRange: -10 - 10, step ze 0.1, \ndefault: 0 [°C]" + "en": "Set a value to compensate a temperature offset.\nRange: -10 - 10, step size 0.1, \ndefault: 0 [°C]" }, "value": 0, "attr": { @@ -12307,23 +13884,20 @@ "id": "temperature_decimals", "type": "radio", "label": { - "en": "Temperature reporting decimals", - "it": "Decimali del report della temperatura" + "en": "Temperature reporting decimals" }, "value": "1", "values": [ { "id": "1", "label": { - "en": "Report temperature value with 1 decimal (21.4 °C)", - "it": "Valore del report della temperatura con 1 decimale (21.4 °C)" + "en": "Report temperature value with 1 decimal (21.4 °C)" } }, { "id": "2", "label": { - "en": "Report temperature value with 2 decimals (21.37 °C)", - "it": "Valore del report della temperatura con 2 decimale (21.31 °C)" + "en": "Report temperature value with 2 decimals (21.37 °C)" } } ] @@ -12333,13 +13907,11 @@ "type": "number", "label": { "en": "Humidity offset (%)", - "nl": "Luchtvochtigheids compensatie (%)", - "it": "Offset dell'umidità (%)" + "nl": "Luchtvochtigheids compensatie (%)" }, "hint": { "en": "Set a correction to compensate a humidity offset.\nRange: -10 - 10, step size 1, \ndefault: 0 [%]", - "nl": "Stel een correctiewaarde in om een Luchtvochtigheids verschil te compenseren.\nBereik: -10 - 10, stap grootte 1, \nstandaard: 0 [%]", - "it": "Imposta un valore per compensare lo scostamento dell'umidità.\nRange: -10 - 10, step size 1, \ndefault: 0 [%]" + "nl": "Stel een correctiewaarde in om een Luchtvochtigheids verschil te compenseren.\nBereik: -10 - 10, stap grootte 1, \nstandaard: 0 [%]" }, "value": 0, "attr": { @@ -12356,23 +13928,20 @@ "id": "humidity_decimals", "type": "radio", "label": { - "en": "Humidity reporting", - "it": "Report dell'umidità" + "en": "Humidity reporting" }, "value": "1", "values": [ { "id": "1", "label": { - "en": "Report humidity value with 1 decimal (35.2 %)", - "it": "Valore del report dell'umidità con 1 decimale (35.2 %)" + "en": "Report humidity value with 1 decimal (35.2 %)" } }, { "id": "2", "label": { - "en": "Report humidity value with 2 decimals (35.19 %)", - "it": "Valore del report dell'umidità con 2 decimale (35.19 %)" + "en": "Report humidity value with 2 decimals (35.19 %)" } } ] @@ -12380,83 +13949,70 @@ ] }, { - "id": "temphumidsensor4", + "id": "temphumidsensor_excellux", "name": { - "en": "Temperature & Humidity Sensor", - "sv": "Temperatur- och fuktighetssensor" + "en": "Excellux External Probe Temperature & Humidity Sensor" }, "class": "sensor", - "capabilities": [ - "measure_temperature", - "measure_humidity", - "measure_battery", - "alarm_battery" - ], - "capabilitiesOptions": {}, - "energy": { - "batteries": [ - "AAA", - "AAA" - ] - }, "platforms": [ "local" ], "connectivity": [ "zigbee" ], + "capabilities": [ + "measure_temperature", + "measure_humidity", + "measure_battery", + "alarm_battery" + ], "images": { - "small": "/drivers/temphumidsensor4/assets/images/small.png", - "large": "/drivers/temphumidsensor4/assets/images/large.png" + "large": "/drivers/temphumidsensor_excellux/assets/images/large.png", + "small": "/drivers/temphumidsensor_excellux/assets/images/small.png" }, "zigbee": { "manufacturerName": [ - "_TZE204_yjjdcqsq", - "_TZE200_yjjdcqsq", - "_TZE200_utkemkbs", - "_TZE204_upagmta9", - "_TZE204_utkemkbs", - "_TZE204_9yapgbuv", - "_TZE200_cirvgep4", - "_TZE204_cirvgep4" + "NTCHT02" ], "productId": [ - "TS0601" + "Excellux" ], "endpoints": { "1": { "clusters": [ 0, - 4, - 5, - 61184 + 1, + 1026, + 1029 ], "bindings": [ - 10, - 25, - 61184 + 1, + 1026, + 1029 ] } }, "learnmode": { + "image": "/drivers/temphumidsensor_excellux/assets/learn.svg", "instruction": { - "en": "Press and hold the reset button for aprox 10 seconds until the LED blinks rapidly.", - "sv": "Tryck in nollnings-knappen under ca 10 sekunder tills LED-lampan binkar snabbt" + "en": "Put the sensor into Zigbee pairing mode according to the device instructions." } } }, + "energy": { + "batteries": [ + "OTHER" + ] + }, "settings": [ { "id": "temperature_offset", "type": "number", "label": { - "en": "Temperature offset (°C)", - "it": "Offset della temperatura (°C)" + "en": "Temperature offset (°C)" }, "hint": { - "en": "Set a value to compensate a temperature offset.\nRange: -10 - 10, step size 0.1, \ndefault: 0 [°C]", - "it": "Imposta un valore per compensare lo scostamento della temperatura.\nRange: -10 - 10, step ze 0.1, \ndefault: 0 [°C]", - "sv": "Ange ett värde för att korrigera felaktig temperatur.\nIntervall: -10 - 10, steg om 0.1, \nstandard: 0 [°C]" + "en": "Set a value to compensate a temperature offset.\nRange: -10 - 10, step size 0.1, \ndefault: 0 [°C]" }, "value": 0, "attr": { @@ -12465,100 +14021,140 @@ "step": 0.1 } }, + { + "id": "temperature_decimals", + "type": "radio", + "label": { + "en": "Temperature reporting decimals" + }, + "value": "1", + "values": [ + { + "id": "1", + "label": { + "en": "Report temperature value with 1 decimal (21.4 °C)" + } + }, + { + "id": "2", + "label": { + "en": "Report temperature value with 2 decimals (21.37 °C)" + } + } + ] + }, { "id": "humidity_offset", "type": "number", "label": { "en": "Humidity offset (%)", - "nl": "Luchtvochtigheids compensatie (%)", - "it": "Offset dell'umidità (%)", - "sv": "Fuktighetskorrigering (%)" + "nl": "Luchtvochtigheids compensatie (%)" }, "hint": { "en": "Set a correction to compensate a humidity offset.\nRange: -10 - 10, step size 1, \ndefault: 0 [%]", - "nl": "Stel een correctiewaarde in om een Luchtvochtigheids verschil te compenseren.\nBereik: -10 - 10, stap grootte 1, \nstandaard: 0 [%]", - "it": "Imposta un valore per compensare lo scostamento dell'umidità.\nRange: -10 - 10, step size 1, \ndefault: 0 [%]", - "sv": "Ange ett värde för att korrigera felaktig fuktighet.\nIntervall: -10 - 10, steg om 1, \nstandard: 0 [%]" + "nl": "Stel een correctiewaarde in om een Luchtvochtigheids verschil te compenseren.\nBereik: -10 - 10, stap grootte 1, \nstandaard: 0 [%]" }, "value": 0, "attr": { "min": -10, "max": 10, "step": 1 + }, + "units": { + "en": "%", + "nl": "%" } + }, + { + "id": "humidity_decimals", + "type": "radio", + "label": { + "en": "Humidity reporting" + }, + "value": "1", + "values": [ + { + "id": "1", + "label": { + "en": "Report humidity value with 1 decimal (35.2 %)" + } + }, + { + "id": "2", + "label": { + "en": "Report humidity value with 2 decimals (35.19 %)" + } + } + ] } ] }, { - "id": "temphumidsensor5", + "id": "temphumidsensor_hobeian", "name": { - "en": "Temperature & Humidity Sensor", - "sv": "Temperatur- och fuktighetssensor" + "en": "HOBEIAN Temperature & Humidity Sensor" }, "class": "sensor", - "capabilities": [ - "measure_temperature", - "measure_humidity", - "measure_battery", - "alarm_battery" - ], - "capabilitiesOptions": {}, - "energy": { - "batteries": [ - "CR2032" - ] - }, "platforms": [ "local" ], "connectivity": [ "zigbee" ], + "capabilities": [ + "measure_temperature", + "measure_humidity", + "measure_battery", + "alarm_battery" + ], "images": { - "small": "/drivers/temphumidsensor5/assets/images/small.png", - "large": "/drivers/temphumidsensor5/assets/images/large.png" + "large": "/drivers/temphumidsensor_hobeian/assets/images/large.png", + "small": "/drivers/temphumidsensor_hobeian/assets/images/small.png" }, "zigbee": { "manufacturerName": [ - "_TZE200_9yapgbuv" + "HOBEIAN" ], "productId": [ - "TS0601" + "ZG-227Z" ], "endpoints": { "1": { "clusters": [ 0, - 4, - 5, - 61184 + 1, + 1026, + 1029 ], "bindings": [ - 10, - 25, - 61184 + 1, + 1026, + 1029 ] } }, "learnmode": { + "image": "/drivers/temphumidsensor_hobeian/assets/learn.svg", "instruction": { - "en": "Press and hold the reset button for aprox 10 seconds until the LED blinks rapidly.", - "sv": "Tryck in nollnings-knappen under ca 10 sekunder tills LED-lampan binkar snabbt" + "en": "Insert a pin into the single hole on the side of the device and press it gently for aprox 10 seconds until the LED blinks rapidly." } } }, + "energy": { + "batteries": [ + "AAA", + "AAA" + ] + }, "settings": [ { "id": "temperature_offset", "type": "number", "label": { - "en": "Temperature offset (°C)", - "it": "Offset della temperatura (°C)" + "en": "Temperature offset (°C)" }, "hint": { - "en": "Set a value to compensate a temperature offset.\nRange: -10 - 10, step size 0.1, \ndefault: 0 [°C]", - "it": "Imposta un valore per compensare lo scostamento della temperatura.\nRange: -10 - 10, step ze 0.1, \ndefault: 0 [°C]", - "sv": "Ange ett värde för att korrigera felaktig temperatur.\nIntervall: -10 - 10, steg om 0.1, \nstandard: 0 [°C]" + "en": "Set a value to compensate a temperature offset.\nRange: -10 - 10, step size 0.1, \ndefault: 0 [°C]" }, "value": 0, "attr": { @@ -12567,34 +14163,78 @@ "step": 0.1 } }, + { + "id": "temperature_decimals", + "type": "radio", + "label": { + "en": "Temperature reporting decimals" + }, + "value": "1", + "values": [ + { + "id": "1", + "label": { + "en": "Report temperature value with 1 decimal (21.4 °C)" + } + }, + { + "id": "2", + "label": { + "en": "Report temperature value with 2 decimals (21.37 °C)" + } + } + ] + }, { "id": "humidity_offset", "type": "number", "label": { "en": "Humidity offset (%)", - "nl": "Luchtvochtigheids compensatie (%)", - "it": "Offset dell'umidità (%)", - "sv": "Fuktighetskorrigering (%)" + "nl": "Luchtvochtigheids compensatie (%)" }, "hint": { "en": "Set a correction to compensate a humidity offset.\nRange: -10 - 10, step size 1, \ndefault: 0 [%]", - "nl": "Stel een correctiewaarde in om een Luchtvochtigheids verschil te compenseren.\nBereik: -10 - 10, stap grootte 1, \nstandaard: 0 [%]", - "it": "Imposta un valore per compensare lo scostamento dell'umidità.\nRange: -10 - 10, step size 1, \ndefault: 0 [%]", - "sv": "Ange ett värde för att korrigera felaktig fuktighet.\nIntervall: -10 - 10, steg om 1, \nstandard: 0 [%]" + "nl": "Stel een correctiewaarde in om een Luchtvochtigheids verschil te compenseren.\nBereik: -10 - 10, stap grootte 1, \nstandaard: 0 [%]" }, "value": 0, "attr": { "min": -10, "max": 10, "step": 1 + }, + "units": { + "en": "%", + "nl": "%" } + }, + { + "id": "humidity_decimals", + "type": "radio", + "label": { + "en": "Humidity reporting" + }, + "value": "1", + "values": [ + { + "id": "1", + "label": { + "en": "Report humidity value with 1 decimal (35.2 %)" + } + }, + { + "id": "2", + "label": { + "en": "Report humidity value with 2 decimals (35.19 %)" + } + } + ] } ] }, { - "id": "temphumidsensor_hobeian", + "id": "temphumidsensor_tsgqxdb4", "name": { - "en": "HOBEIAN Temperature & Humidity Sensor" + "en": "TS0201 Standard Temperature & Humidity" }, "class": "sensor", "platforms": [ @@ -12610,15 +14250,15 @@ "alarm_battery" ], "images": { - "large": "/drivers/temphumidsensor_hobeian/assets/images/large.png", - "small": "/drivers/temphumidsensor_hobeian/assets/images/small.png" + "large": "/drivers/temphumidsensor_tsgqxdb4/assets/images/large.png", + "small": "/drivers/temphumidsensor_tsgqxdb4/assets/images/small.png" }, "zigbee": { "manufacturerName": [ - "HOBEIAN" + "_TZ3000_tsgqxdb4" ], "productId": [ - "ZG-227Z" + "TS0201" ], "endpoints": { "1": { @@ -12636,16 +14276,15 @@ } }, "learnmode": { - "image": "/drivers/temphumidsensor_hobeian/assets/learn.svg", + "image": "/drivers/temphumidsensor_tsgqxdb4/assets/learn.svg", "instruction": { - "en": "Insert a pin into the single hole on the side of the device and press it gently for aprox 10 seconds until the LED blinks rapidly." + "en": "Follow your sensor's instructions to put it into Zigbee pairing mode." } } }, "energy": { "batteries": [ - "AAA", - "AAA" + "OTHER" ] }, "settings": [ diff --git a/docs/0.3.1_LIVE_REVIEW.md b/docs/0.3.1_LIVE_REVIEW.md new file mode 100644 index 0000000000..e8be9771a1 --- /dev/null +++ b/docs/0.3.1_LIVE_REVIEW.md @@ -0,0 +1,89 @@ +# Frozen 0.3.1 Live-candidate review — 2026-10-04 + +> Current routing, 2026-10-25: `main` = 0.3.3 Live; `dev` = 0.3.4 Test. +> 0.4.0 remains an unpublished candidate on `develop-0.4`; new work targets +> `develop-0.4.1`. The earlier 0.3.2-Live-first prerequisite has been satisfied. +> [Current policy and branch cleanup audit](BRANCHES.md) supersede dated channel +> status and provisional dates below. Physical acceptance still follows public Test. + +**Source:** `modernize-2026-issues` at exactly +`7583b4bb2fa91600c2301eb142335312a6a7cac4`. No release-source changes. +**Sequence:** 0.3.1 Live BEFORE 0.4.0 Test. Release PR #1470 remains Draft; +this review does not publish an app or assert Athom certification. + +## Technical evidence + +- [CI275](https://github.com/JohanBendz/com.tuya.zigbee/actions/runs/36902401304) + remains SUCCESS at that exact frozen SHA: clean install, Homey Compose, + generated manifest/index, repository tests, publish validation and whitespace. +- Re-ran the unchanged frozen source locally on 2026-10-04: **95 tests, + 95 passed, zero failures, zero TODOs**. These are automated tests, + not physical Homey acceptance. +- Compared generated 0.3.1 manifest with actual Live-source `SDK3` + `328d24ed315131528f2358b66bb0b8259615a49e` (0.2.76): **113 → 135 drivers**, + no removed existing driver ID, no removed existing capability ID, + no removed/renamed setting ID or changed setting type, no removed Flow-card ID. + This is a structural compatibility audit, not proof of unchanged runtime. +- Existing Flow triggers/conditions remain identical; the retained + `siren_volume_setting` action keeps its argument/value IDs and corrects + labels to DP5 `0=Low, 1=Medium, 2=High` (#1333). Existing saved numeric + arguments are not rewritten; users may notice their labels now reflect + the device's actual volume. Two trigger cards are added. +- Existing `radar_sensor_ceiling` adds `target_distance` and + `smart_air_detection_box` adds `measure_pm25`; inspected source has guarded + `addCapability` paths for existing pairings. Existing capabilities are retained. +- Frozen regression tests cover switch/meter endpoints and existing sensor, + remote, FingerBot SEND_DATA and cached-identity TH05Z paths. Static validity + does not establish the outcome on every already-paired physical device. + +## Feedback examined + +Read all **650 GitHub issue/PR conversation comments updated since +2026-09-30**, through the 2026-10-04 review, plus the targeted histories below. +No new report in that retrieved set establishes a 0.3.1 app crash or broad +upgrade regression. Maintainer/triage annotations were distinguished from +independent user testing; interviews and future test promises are not passes. + +- Maintainer's [2026-10-02 report](https://github.com/JohanBendz/com.tuya.zigbee/pull/1470#issuecomment-5959672756): + over 2,600 0.3.1 Test installations and no crashes/errors reported then. + This adoption figure has not been independently refreshed. +- [#1370 physical report](https://github.com/JohanBendz/com.tuya.zigbee/issues/1370#issuecomment-5933131485): + three `_TZ3000_hafsqare / TS0011` units have reliable OnOff/manual reporting + and Homey-restart recovery. **App version was not stated**, so do not count + this as exact-build 0.3.1 acceptance. +- #1366 and #1461 contain willingness to test after availability/opportunity; + neither establishes a new completed 0.3.1/0.4 physical acceptance result. +- #1434 supplies new curtain DP evidence. That is future exact-profile work, + not a regression requiring a change to frozen 0.3.1. +- #1501 preserves the 0.3.0 Build 127 DP36 thermostat-log observation. + Source is identical in 0.3.0/0.3.1; no crash/regression is established. + Logging mitigation exists only in 0.4.0, with hardware identity/meaning + still unresolved. Do not advertise it as a 0.3.1 fix. +- Public Homey forum retrieval was unavailable in this session. Private + diagnostics and current Athom telemetry were not accessible. This review + therefore does not claim all feedback channels have been exhausted. + +## Remaining targeted checks / release decision + +Record actual app version and exact manufacturer/model with each physical +result. Evaluate significance individually rather than treating every open +historical issue as a global Live blocker. + +| Scope | Available evidence / remaining check | +| --- | --- | +| Existing paired-device upgrade | Maintainer adoption signal is positive; version-tagged app/Homey restart and existing Flow confirmation still needed for final sign-off | +| Core switches/plugs/dimmers | Frozen endpoint/meter regression tests pass; check representative actual OnOff, metering, physical feedback and existing Flow after upgrade | +| TH05Z #867 | Cached-identity DP4=49 regression passes; same already-paired sensor battery result on 0.3.1 not yet recorded | +| FingerBot #869 | Isolated SEND_DATA 0x04 implementation/tests pass; physical press, settings and battery retest still open | +| Silvercrest #423 | BoundCluster implementation/tests pass; exact single/double click and Flow count retest still open | +| TS0044 #457 / TS004F #270 | Scoped debounce/button mapping tests pass; Alternate On/Off and duplicate-trigger physical outcomes still open | +| Two-gang #576 | Exact OnOff reporting repair present; immediate Flow/state feedback on both endpoints still needs physical confirmation | +| Smart Knob | Bound-cluster regression passes; physical press/rotation and existing Flow check remains part of representative review | +| Thermostat #1501 | Existing DP36 logging observation; obtain exact identity and current resource/known-DP behavior before classifying severity | + +**Assessment:** no new code change to the frozen 0.3.1 candidate is justified +by the reviewed evidence. Technical checks are green; final operational +sign-off, Athom certification and actual Live availability remain pending. +Use the existing tested build for promotion rather than incorporating 0.4 work. +Only after confirmed 0.3.1 Live availability may the separate 0.4.0 candidate +replace Test. New post-freeze implementation belongs in `develop-0.4.1`. diff --git a/docs/0.3.2_PUBLICATION.md b/docs/0.3.2_PUBLICATION.md new file mode 100644 index 0000000000..f05adce52c --- /dev/null +++ b/docs/0.3.2_PUBLICATION.md @@ -0,0 +1,53 @@ +# 0.3.2 publication correction — 2026-10-04 + +> Current routing, 2026-10-25: `main` = 0.3.3 Live; `dev` = 0.3.4 Test. +> 0.4.0 remains an unpublished candidate on `develop-0.4`; new work targets +> `develop-0.4.1`. The earlier 0.3.2-Live-first prerequisite has been satisfied. +> [Current policy and branch cleanup audit](BRANCHES.md) supersede dated channel +> status and provisional dates below. Physical acceptance still follows public Test. + +The maintainer selected a documentation-only successor to the frozen 0.3.1 +submission before continuing 0.4.1 development. `release-0.3.2` starts from +`7583b4bb2fa91600c2301eb142335312a6a7cac4` and preserves its device/runtime +sources, dependencies, pairing contracts, capabilities, settings and Flow +definitions. The 0.3.1 source remains an immutable compatibility reference. + +## Corrected submission material + +- README.txt: two short user-facing plain-text paragraphs, no Markdown, + links, channel status, contributor credits or release plan. +- README.md: device use, compatibility and support; development and release + instructions are linked in maintainer/contributor documentation. +- App tagline: purpose-oriented wording without repeating the app name. +- Homey changelog: short user-visible changes, no Test/Live/beta labels, + candidate status, rollout planning or CI/implementation details. Historical + channel labels are cleaned without deleting version entries or the old + light re-pairing notice. The 0.3.2 entry summarizes functional changes since + current 0.2.76 Live, rather than describing only this text correction. +- Version 0.3.2 is aligned across package.json, both lockfile roots, Compose + and generated app.json. Generate the latter using Homey Compose. +- .homeyignore excludes docs/ as well as existing maintainer files; keep + README.txt available to Homey's publishing workflow. +- Apply the same channel-neutral copy policy to 0.4.0 and 0.4.1 without + changing their runtime, app version or historical 0.3.1 contract fixtures. + +## Validation and actual release status + +Check the final SHA with clean install, Homey Compose, repository tests, +generated manifest/index reproducibility, publish-level Homey validation and +whitespace checks. Compare the complete generated manifest with frozen 0.3.1: +only version and app description may differ. Compare every driver/library, +locale, Flow/capability definition, dependency and app runtime source unchanged. + +**Release order: 0.3.2 Live BEFORE 0.4.0 Test.** This replaces the original +0.3.1-Live-first submission plan without changing its intended runtime. +The corrected 0.3.2 build is now in Homey Test and was submitted to Athom for Live approval. Await explicit Athom approval AND confirm 0.3.2 has actually appeared in Live before replacing the occupied Test channel with 0.4.0. +The same targeted operational checks still apply to the inherited runtime. + +Version metadata and a green validator are not Athom approval or publication. +**Maintainer status update, 2026-10-04:** version **0.3.2 is now the published Homey Test version**, and the maintainer has **submitted 0.3.2 to Athom for Live approval**. Athom approval and actual Live availability are NOT YET confirmed. This factual release-channel update comes from the maintainer, not an inference from GitHub PR state. At this checkpoint the prior Live remains 0.2.76. The corrected, CI-validated source remains on `release-0.3.2` (SHA `e0ef3f3c66298453549900719b9904f55157b0fa`); GitHub Draft PR #1514 may still be unmerged even though the actual Homey submission is underway. Do not treat GitHub PR state as Homey Store publication status. + +Official references: +- https://apps.developer.homey.app/app-store/guidelines +- https://apps.developer.homey.app/app-store/updates +- https://apps.developer.homey.app/app-store/publishing diff --git a/docs/0.4.0_PHYSICAL_ACCEPTANCE.md b/docs/0.4.0_PHYSICAL_ACCEPTANCE.md new file mode 100644 index 0000000000..7c1f6ee3fe --- /dev/null +++ b/docs/0.4.0_PHYSICAL_ACCEPTANCE.md @@ -0,0 +1,142 @@ +# 0.4.0 physical acceptance and release gates + +> Current routing, 2026-10-25: `main` = 0.3.3 Live; `dev` = 0.3.4 Test. +> 0.4.0 remains an unpublished candidate on `develop-0.4`; new work targets +> `develop-0.4.1`. The earlier 0.3.2-Live-first prerequisite has been satisfied. +> [Current policy and branch cleanup audit](BRANCHES.md) supersede dated channel +> status and provisional dates below. Physical acceptance still follows public Test. + +Started 2026-10-02; updated 2026-10-04. This is the inventory of **33 distinct exact Zigbee identities in nineteen NEW development drivers** relative to frozen 0.3.1 Test. **This is the community's physical TEST plan, to be executed after 0.4.0 is published to Homey Test; no row must pass physically before Test publication.** A Homey Zigbee interview establishes actual identity and announced endpoints, NOT working functionality in the newly added 0.4 driver. A passed build, unit test, Compose/index check or publish validation is not physical acceptance. Independent testing in a third-party fork or private Homey driver also is not acceptance of these 0.4 changes. + +## Release-lane boundary + +For the static candidate sign-off, the currently occupied 0.3.1 Test channel and safe higher-version recovery procedure, consult [0.4.0 release preflight](0.4.0_RELEASE_PREFLIGHT.md). This document tracks physical acceptance during public Test, not an approval to publish or to promote to Live. + +- Current Live prior to approval: **0.2.76** (SDK3). **0.3.2 is the current Homey Test version and was submitted to Athom for Live approval** (maintainer status 2026-10-04); actual Live publication is pending. Frozen **0.3.1 runtime/manifest reference** remains `modernize-2026-issues` at `7583b4b`. Corrected 0.3.2 source: `release-0.3.2` at `e0ef3f3c`; the former Draft PR [#1470](https://github.com/JohanBendz/com.tuya.zigbee/pull/1470) remains a historical frozen 0.3.1 reference, not the 0.3.2 submission. +- At inventory start, 0.4 development HEAD was 3a065cd87c2f7ff64b3272ac68c89b300eec66d6; [CI 36976674058](https://github.com/JohanBendz/com.tuya.zigbee/actions/runs/36976674058) passed **145 tests, 142 pass, zero failures, three pre-existing CCT TODOs**, with Homey publish validation. +- **0.4 is not yet published to Test or Live** as of this document: the published 0.3.1 cannot validate these new drivers. The confirmed order is **0.3.2 Live BEFORE 0.4.0 Test** (documentation-only successor to frozen 0.3.1, selected 2026-10-04). See [the publication correction](0.3.2_PUBLICATION.md). Confirm actual 0.3.2 Live availability first, then **publish 0.4 to Test and gather physical feedback there**. An optional developer build is helpful but never a mandatory pre-Test hardware gate. + +**Gate A: before publishing 0.4 Test (NO physical-test prerequisite).** Examine reported 0.3.1 feedback; complete the separate corrected 0.3.2 release review and confirm 0.3.2 actually available in Live; prepare issue reporting and an explicit rollback version. CI at the exact 0.4 candidate SHA must be green (Compose build, generated app.json, SUPPORTED_DEVICES.md, tests, Homey publish validation, whitespace); review manifest compatibility and sensitive legacy light/global cluster protection, and rule out known reproducible release-blocking source-level issues. **Publish to Test with new fingerprints explicitly marked unverified so that actual users can test them. No Test pairing results or completed hardware checklists are demanded in advance.** + +**Gate B: during 0.4 Test and before a subsequent Live release.** Collect and triage the exact hardware tests below **from users running the published 0.4 Test version**; attach evidence to each original/canonical GitHub issue and close only separately verified scope. Missing reports are normal when Test first opens. Before claiming full physical support or publishing Live, evaluate reports and regressions; if an included identity has inadequate evidence, explicitly assess/defer/remove it rather than treating another manufacturer's result as acceptance. The 0.4 candidate changes existing plug drivers (#1503) and the wall-thermostat logger (#1501); specifically regress these during the Test rollout. Research-only light gate #1502 and three intentional CCT TODOs remain separate. + +## Exact hardware acceptance matrix + +Each row starts Pending when 0.4 Test is published; each physical report from Test users moves only that exact identity toward acceptance. Pending status does not block publishing the Test candidate. Expected tiles counts parent EP1 + physical subdevices EP2, EP3 and EP4 where present. BSEED original #1339, #1337 and #1401 were consolidated into still-OPEN canonical [#1338](https://github.com/JohanBendz/com.tuya.zigbee/issues/1338), NOT completed. #1368 is a separate physical source for #1035; #1500 is the distinct non-metering interview in first comment of the original metering source #1152. + + +| manufacturerName | modelId / productId | 0.4 driver | Original physical source | Expected tiles | 0.4 physical result | +| --- | --- | --- | --- | ---: | --- | +| `eWeLink` | `CK-TLSR8656-SS5-01(7014)` | `temphumidsensor_ewelink` | [#1284](https://github.com/JohanBendz/com.tuya.zigbee/issues/1284) | 1 | Pending 0.4 physical | +| `NTCHT02` | `Excellux` | `temphumidsensor_excellux` | [#1461](https://github.com/JohanBendz/com.tuya.zigbee/issues/1461) | 1 | Pending 0.4 physical | +| `_TZ3000_o9f2zqln` | `TS0207` | `rain_sensor_mowe` | [#473](https://github.com/JohanBendz/com.tuya.zigbee/issues/473) | 1 | Pending 0.4 physical | +| `_TZE200_qoy0ekbd` | `TS0601` | `temphumidsensor_aubess_qoy0ekbd` | [#797](https://github.com/JohanBendz/com.tuya.zigbee/issues/797) | 1 | Pending 0.4 physical | +| `_TZ3000_tsgqxdb4` | `TS0201` | `temphumidsensor_tsgqxdb4` | [#1246](https://github.com/JohanBendz/com.tuya.zigbee/issues/1246) | 1 | Pending 0.4 physical | +| `_TZ3000_bzt33cyu` | `TS0207` | `flood_sensor_unverified_battery` | [#1041](https://github.com/JohanBendz/com.tuya.zigbee/issues/1041) | 1 | Pending 0.4 physical; battery hardware unknown | +| `_TZ3000_4qaowtdo` | `TS0207` | `flood_sensor_unverified_battery` | [#1032](https://github.com/JohanBendz/com.tuya.zigbee/issues/1032) | 1 | Pending 0.4 physical; battery hardware unknown | +| `_TZ3000_qhozxs2b` | `TS0207` | `flood_sensor_unverified_battery` | [#952](https://github.com/JohanBendz/com.tuya.zigbee/issues/952) | 1 | Pending 0.4 physical; battery hardware unknown | +| `HOBEIAN` | `ZG-102ZL` | `contact_lux_hobeian` | [#1298](https://github.com/JohanBendz/com.tuya.zigbee/issues/1298) | 1 | Pending 0.4 physical; confirm IAS, lux encoding, cells | +| `_TZE200_pay2byax` | `TS0601` | `contact_lux_pay2byax` | [#414](https://github.com/JohanBendz/com.tuya.zigbee/issues/414) | 1 | Pending 0.4 physical; confirm IAS, lux encoding, cells | +| `_TZ3000_x8q36xwf` | `TS0203` | `contact_sensor_elivco_x8q36xwf` | [#1143](https://github.com/JohanBendz/com.tuya.zigbee/issues/1143) | 1 | Pending 0.4 physical; IAS contact + battery; battery cell unknown | +| `eWeLink` | `SNZB-04` | `contact_sensor_ewelink_snzb04` | [#1013](https://github.com/JohanBendz/com.tuya.zigbee/issues/1013) | 1 | Pending 0.4 physical; IAS contact + battery; battery cell unknown | +| `_TZE200_n8dljorx` | `TS0601` | `contact_sensor_n8dljorx` | [#868](https://github.com/JohanBendz/com.tuya.zigbee/issues/868) | 1 | Pending 0.4 physical; IAS contact + battery | +| `HOBEIAN` | `ZG-204ZL` | `motion_lux_hobeian_zg204zl` | [#1267](https://github.com/JohanBendz/com.tuya.zigbee/issues/1267) | 1 | Pending 0.4 physical; motion/clear, lux scale, battery cells | +| `_TZE200_kb5noeto` | `TS0601` | `motion_lux_kb5noeto` | [#1481](https://github.com/JohanBendz/com.tuya.zigbee/issues/1481) | 1 | Pending 0.4 physical; motion/clear, lux scale, battery cells | +| `_TZ3000_blhvsaqf` | `TS0001` | `switch_1_gang_bseed_ts0001` | [#1339](https://github.com/JohanBendz/com.tuya.zigbee/issues/1339) | 1 | Pending 0.4 physical | +| `_TZ3000_0t4zjtia` | `TS0001` | `switch_1_gang_ts0001` | [#1366](https://github.com/JohanBendz/com.tuya.zigbee/issues/1366) | 1 | Pending 0.4 physical | +| `_TZ3000_p26flek3` | `TS0001` | `switch_1_gang_ts0001` | [#1172](https://github.com/JohanBendz/com.tuya.zigbee/issues/1172) | 1 | Pending 0.4 physical | +| `_TZ3000_hyarhbyx` | `TS0001` | `switch_1_gang_ts0001` | [#1395](https://github.com/JohanBendz/com.tuya.zigbee/issues/1395) | 1 | Pending 0.4 physical | +| `_TZ3000_y4che4dc` | `TS0001` | `switch_1_gang_ts0001` | [#674](https://github.com/JohanBendz/com.tuya.zigbee/issues/674) | 1 | Pending 0.4 physical | +| `_TZ3000_lugaswf8` | `TS0002` | `switch_2_gang_ts0002` | [#991](https://github.com/JohanBendz/com.tuya.zigbee/issues/991) | 2 | Pending 0.4 physical | +| `_TZ3000_zxrfobzw` | `TS0002` | `switch_2_gang_ts0002` | [#1239](https://github.com/JohanBendz/com.tuya.zigbee/issues/1239) | 2 | Pending 0.4 physical | +| `_TZ3000_ptjcjise` | `TS0002` | `switch_2_gang_ts0002` | [#1367](https://github.com/JohanBendz/com.tuya.zigbee/issues/1367) | 2 | Pending 0.4 physical | +| `_TZ3000_rmiew70n` | `TS0002` | `switch_2_gang_ts0002` | [#993](https://github.com/JohanBendz/com.tuya.zigbee/issues/993) | 2 | Pending 0.4 physical | +| `_TZ3000_pgcclddi` | `TS0002` | `switch_2_gang_ts0002` | [#1084](https://github.com/JohanBendz/com.tuya.zigbee/issues/1084) | 2 | Pending 0.4 physical | +| `_TZ3000_l9brjwau` | `TS0002` | `switch_2_gang_ts0002` | [#1337](https://github.com/JohanBendz/com.tuya.zigbee/issues/1337) | 2 | Pending 0.4 physical | +| `_TZ3000_lmcp6b0a` | `TS0003` | `switch_3_gang_ts0003` | [#795](https://github.com/JohanBendz/com.tuya.zigbee/issues/795) | 3 | Pending 0.4 physical | +| `_TZ3000_v4l4b0lp` | `TS0003` | `switch_3_gang_ts0003` | [#1353](https://github.com/JohanBendz/com.tuya.zigbee/issues/1353) | 3 | Pending 0.4 physical | +| `_TZ3000_qkixdnon` | `TS0003` | `switch_3_gang_ts0003` | [#1338](https://github.com/JohanBendz/com.tuya.zigbee/issues/1338) | 3 | Pending 0.4 physical | +| `_TZ3000_iol4bl2y` | `TS0003` | `switch_3_gang_ts0003` | [#1500](https://github.com/JohanBendz/com.tuya.zigbee/issues/1500) | 3 | Pending 0.4 physical | +| `_TZ3002_pzao9ls1` | `TS0726` | `switch_4_gang_bseed_ts0726` | [#1401](https://github.com/JohanBendz/com.tuya.zigbee/issues/1401) | 4 | Pending 0.4 physical | +| `_TZ3000_s6ma1nh4` | `TS0004` | `switch_4_gang_ts0004` | [#1035](https://github.com/JohanBendz/com.tuya.zigbee/issues/1035) | 4 | Pending 0.4 physical | +| `_TZ3000_enmfaave` | `TS0004` | `switch_4_gang_ts0004` | [#1368](https://github.com/JohanBendz/com.tuya.zigbee/issues/1368) | 4 | Pending 0.4 physical | + + +### #1041 exact standard IAS water-leak profile — public Test checks + +The three new fingerprints `_TZ3000_bzt33cyu`, `_TZ3000_4qaowtdo` and `_TZ3000_qhozxs2b` share independent physical interviews for `TS0207` EP1 standard Basic0/Power1/Identify3/IAS Zone1280 (`zoneType=waterSensor`), and reuse only the existing IAS alarm runtime. Each has an independent acceptance row above. **Before finalizing Homey energy metadata, users must physically report the battery cell type and count for EACH exact specimen.** The 3.0 V interview does not distinguish a coin cell from two alkaline cells, so this dedicated new profile provisionally declares `energy.batteries:["OTHER"]`, with no unjustified percentage-measurement capability. Verify dry → wet → dry IAS `alarm_water`, low-battery `alarm_battery` if practical, pairing, native IAS enrollment/rejoin, UI/Flow and sleep behavior after public 0.4 Test is published. Distinct existing CR2032 `_TZ3000_bfopm9ga` and 2×AAA `_TZ3000_baeiitad` must remain on their frozen drivers and should be used as separate regression checks. MOWE rain (`_TZ3000_o9f2zqln`) and solar DP105 rain remain separate. + +### #1298 contact + illuminance exact identities — public 0.4 Test checks + +- **HOBEIAN / ZG-102ZL** (original #1298): physical EP1 advertises [Basic0, Identify3, IAS Zone1280 (`contactSwitch`), **EF00/61184**, Power1, Illuminance1024]. The new isolated driver declares EF00 for this identity ONLY but makes **no EF00 bindings, datapoint writes or private mapping** without runtime evidence. +- **_TZE200_pay2byax / TS0601** (physical source #414, consolidated #1486): later repeated physical interviews announce Basic0, Identify3, IAS Zone1280 (`contactSwitch`), Power1, Illuminance1024, **no EF00 input**, despite TS0601. The oldest #414 interview had contradictory IAS `fireSensor`/cluster information: capture actual device firmware/zoneType when evaluating this exact identity, do not assume all retail revisions are equivalent. + +For EACH exact row: verify IAS contact open/closed polarity, enrollment and rejoin; ZCL `illuminanceMeasurement.measuredValue` compared against measured/known real lux (standard logarithmic conversion is a **hypothesis to verify**; HOBEIAN interview raw 33273 with maxMeasuredValue 4000 warrants special attention); battery half-percent and `alarm_battery`, ACTUAL battery cell type/count (provisional `OTHER`), UI/Flow/Insights and sleepy reporting. A report that contact works must NOT be taken as proof that lux calibration, manufacturer DP behavior or physical battery metadata is correct. Neither identity is a generic contact-only pairing, other HOBEIAN device or bed pressure device. Real physical hardware validation occurs after publishing public 0.4 Test, NOT before. + +### #1013 plain standard-IAS contact + Power — per-identity public 0.4 Test + +Three independently interviewed missing identities now have separate exact-matcher candidate drivers, and **`zbeacon / DS01` is already present in frozen 0.3.1 / `doorwindowsensor_4`, NOT a fourth new driver**. eWeLink `SNZB-04` (original #1013) and ELIVCO `_TZ3000_x8q36xwf / TS0203` (source #1143) advertise PollControl32 in addition to EP1 Basic0/Identify3/Power1/IAS1280; its use is optional and no new app-level Poll Control writes are assumed. `_TZE200_n8dljorx / TS0601` (source #868) has no PollControl32 or EF00 and declares the reporter's physically specified CR2032. The first two have unproven physical battery type/count, provisionally `OTHER`; 3 V alone is not cell proof. **eWeLink SNZB-04 is also supported by the distinct Sonoff Zigbee app**: this candidate implements the specific community request to use it in Tuya Zigbee, not a claim of exclusive app ownership or proof of physical behavior here. + +For each exact 0.4 Test installation: verify IAS open/closed polarity, deliberate open → close → open sequence, `alarm_battery` IAS bit, received standard batteryPercentageRemaining and 0..100% conversion where available, battery cell hardware, native/fallback IAS enrollment, sleepy wake/rejoin and Homey Flow/UI. Specifically exercise ELIVCO #1143 for **over 70 minutes** to investigate the historical ~63-minute false-close issue observed in an external integration without attributing that defect to this Homey app. Do NOT interpret absent IAS flags as a close event. Compare `zbeacon / DS01` on its existing driver separately as a 0.3.1 regression gate. No EF00, lux, tamper or manufacturer-specific features are implied for these plain contacts. Physical acceptance follows PUBLIC 0.4 Test publication, not a requirement before Test. + +### #1481 standard IAS motion + illuminance (two exact independent Test gates) + +Two new independent profiles use only EP1 Basic0/Identify3/IAS Zone1280 (physically reported `zoneType=motionSensor`), Power Configuration1 and Illuminance Measurement1024. Physically interviewed `_TZE200_kb5noeto / TS0601` (#1481; source historical PR #1122, #942 and #1064) and `HOBEIAN / ZG-204ZL` (#1267) have NO EF00; they must never be inserted into existing EF00-dependent `motion_sensor_2`. The separate standard runtime listens to IAS motion set/clear, the IAS low-battery bit, half-percent battery and conventional Zigbee logarithmic illuminance. **Actual battery type/count remains unknown** for both despite sampled 3.0V, so `energy.batteries:["OTHER"]` is provisional. Verify native IAS enrollment/pairing, motion→clear→motion, real cooldown timing (no invented auto-clear timeout), battery sample 200→100% and alarm bit, illuminance at multiple measured light levels (physical interviews reported raw values around 33k with maxMeasuredValue 4000, so standard lux conversion is a hypothesis), Flow/Insights, app restart and rejoin separately for EACH exact ID after public 0.4 Test. Do not add `HOBEIAN / ZG-204Z` without trailing L (#1275) on the strength of this interview. #1113/#1475 ambiguous eWeLink SNZB-03 motion vs flood remains **excluded**, pending disambiguation rather than unsafe driver matching. + +## Switch acceptance protocol (for Homey 0.4 Test users; perform per exact row) + +Use an approved non-production test Homey when possible; do not remove a reliable production pairing merely to provide a test. Any necessary mains electrical work must be done safely by a qualified person. + +1. Record real Homey hardware/firmware, exact 0.4 build SHA, retail model, manufacturerName, modelId and selected driver. Count created tiles. Do not mistake Green Power endpoint 242 for a relay. +2. Independently issue Homey OFF → ON → OFF on EACH tile; check correct physical output with no unintended other-gang action. Then operate EACH physical switch/button and ensure Homey receives both OnOff transitions with correct state. +3. Verify correct Homey Flow triggers on EACH tile/channel. Expected mapping: parent EP1, secondSwitch EP2, thirdSwitch EP3, fourthSwitch EP4. Capture delayed, inverted or missing reports and failed sequence. +4. Check app restart, Homey restart, rejoin and safely arranged mains loss/restore where relevant. Observe power-on state but DO NOT assume a configurable manufacturer setting exists. Previously paired Generic Zigbee/other-app devices are not automatically migrated to new driver IDs. + +### Prioritize known physical failure cases + +- [#1500](https://github.com/JohanBendz/com.tuya.zigbee/issues/1500): _TZ3000_iol4bl2y / TS0003 previously exposed ONLY Gang 1 when generically paired; both Gang 2/3 must pass remote action, physical action, state report and Flow. Keep apart from actual metering variant in #408. +- [#795](https://github.com/JohanBendz/com.tuya.zigbee/issues/795): _TZ3000_v4l4b0lp / TS0003 also had a first-gang-only complaint. Test independently of other TS0003s. +- [#1338](https://github.com/JohanBendz/com.tuya.zigbee/issues/1338): all FOUR independent BSEED 1/2/3/4 variants. Four-gang _TZ3002_pzao9ls1 is **TS0726, not TS0004**; third-party auto-resolver comments do not prove its three-gang sibling works here. +- [#991](https://github.com/JohanBendz/com.tuya.zigbee/issues/991): original five non-metering two-gang fingerprints plus BSEED #1337, each independently. Optional manufacturer E000/E001/Basic layouts differ; no global configuration assumption. +- [#1035](https://github.com/JohanBendz/com.tuya.zigbee/issues/1035): both separate four-gang TS0004 sources #1035/#1368. No phantom energy readings. +- [#1395](https://github.com/JohanBendz/com.tuya.zigbee/issues/1395): CR-MINI2Z1 has basic OnOff pairing only. Requested momentary/retractive, edge and rocker input mode is **NOT** implemented and remains a separate acceptance request. + +## Sensor acceptance during Homey 0.4 Test + +**[#1284 eWeLink](https://github.com/JohanBendz/com.tuya.zigbee/issues/1284):** exact literal Zigbee identity eWeLink / CK-TLSR8656-SS5-01(7014), single Homey sensor tile. Physically validate standard temperature /100, RH /100, half-percent ZCL battery /2, **2×AAA** documented by source #1378, normal wake/report cadence and persistence after app/Homey restart. Observe real alarm_battery when legitimately available; do not short or force-drain cells. + +**[#1461 Excellux](https://github.com/JohanBendz/com.tuya.zigbee/issues/1461):** Zigbee identity NTCHT02 / Excellux; C3007 is a retail model. A historical PRIVATE driver showed physical-probe raw 2340 = 23.40 degrees C, RH 4648 = 46.48%, battery raw 166 = 83%. Verify these standard scales with the NEW 0.4 driver, plus restart, battery reporting and only ONE temperature capability (probe, no imagined ambient value). Original EF00 was a client/output cluster, not a confirmed input Tuya DP. **AAA battery count remains unknown**: energy.batteries is currently provisional ["OTHER"]; ask physical tester for cell count before final Live metadata. + +**[#1288 MOWE MW815R (source #473)](https://github.com/JohanBendz/com.tuya.zigbee/issues/1288):** exact `_TZ3000_o9f2zqln / TS0207` standard-IAS-only rain profile. During public 0.4 Test verify a real IAS enrollment and dry → wet → dry `alarm_water` transitions, Flow triggers, half-percent Power Configuration battery reporting, low-battery alarm, app/Homey restart and rejoin. Physical battery type/count is still UNKNOWN (provisional `energy.batteries: ["OTHER"]`). No proprietary EF00, DP105, rain-intensity, solar/battery inference or acceptance by testing the separate `_TZ3210_tgvtvdoc` RB-SRAIN01. + +**[#797 standard temp/RH, distinct originals #797 and #1246](https://github.com/JohanBendz/com.tuya.zigbee/issues/797):** Test `_TZE200_qoy0ekbd / TS0601` and `_TZ3000_tsgqxdb4 / TS0201` **independently** on public 0.4 Test. Both are actual standard-ZCL Power Configuration1 + Temperature1026 + AIR Relative Humidity1029; the TS0601 physical interview does NOT expose EF00/61184, and TS0201's Identify3 is optional. Verify temperature and RH reporting in centi-units (/100), battery half-percent (/2), settings/Flow, sleepy first-init reporting and restart/rejoin. Battery type/count MUST be reported physically for each specimen (both provisional `OTHER`; Aubess retail CR2450 claim not yet confirmed on hardware). Do NOT claim soil-moisture capability or mix these identities into a cross-product manufacturer/product array. Already-coded eWeLink and Excellux remain separate independent acceptance rows. + +## Existing plug Power-On State regression DURING Test #1503 + +These do not add identities in the matrix but WERE changed in 0.4: smartplug, smartplug_2_socket (parent EP1 only), wall_socket and smartPlug_DinRail. + +- On actual supported firmware, startup must only READ Tuya relayStatus attribute **0x8002**, normalize 0 Off / 1 On / 2 Remember into existing Homey relay_status, and send ZERO power-state writes until a user deliberately changes the setting. +- A missing/unsupported/unknown relayStatus must preserve the Homey setting and not interrupt normal switching; unsupported childLock or indicatorMode reads must not suppress a supported relayStatus read. +- Verify deliberate user writes of 0/1/2, optional readback and safely observed mains restoration on a non-critical load. Failed Zigbee writes must surface as failures to Homey. Do not confuse Tuya 0x8002 (previous = 2) with standard Zigbee StartUpOnOff 0x4003 (previous = 0xFF), and do not blindly add this option to newly paired generic TS000x switches. + +## Existing wall-thermostat diagnostic-only regression DURING Test #1501 + +The existing `wall_thermostat` runtime also changed in 0.4 despite the byte-identical 0.3.1 driver manifest: it now throttles **identical unknown datapoint log messages** (e.g. physically observed DP36) for 60 seconds and summarizes suppressed repeats. This is a logging change, NOT new DP36 interpretation or reduced Zigbee traffic. If a representative device is available, confirm normal known DP1/DP2/DP16/DP24/DP40 Homey values/Flow remain correct, the first new unknown DP/value is still logged immediately, a changed unknown value remains visible, and a repeated value does not flood logs. Record the exact hardware fingerprint before proposing any new DP mapping. See [#1501](https://github.com/JohanBendz/com.tuya.zigbee/issues/1501). + +## Copyable test report for source or canonical GitHub issue + +~~~text +0.4 app version and exact development/Test SHA: +Homey model / firmware: +Retail device and exact manufacturerName / modelId: +Selected driver / number of tiles: +EP1: Homey OFF/ON [pass/fail], physical/report [pass/fail], Flow [pass/fail] +EP2 (if present): Homey [ ], physical/report [ ], Flow [ ] +EP3 (if present): Homey [ ], physical/report [ ], Flow [ ] +EP4 (if present): Homey [ ], physical/report [ ], Flow [ ] +App restart / Homey restart / rejoin / safely managed mains restore: +Sensor values, reporting and actual battery count (if applicable): +Actual failures, reproduction and diagnostic reference: +~~~ + +Avoid exposing private device identifiers, network addresses or secrets publicly. Keep an issue OPEN after static CI and through Test until its physical scope passes; the absence of such evidence does **not** block publishing Test. A new driver profile is not an implicit migration of a previously paired device. diff --git a/docs/0.4.0_RELEASE_PREFLIGHT.md b/docs/0.4.0_RELEASE_PREFLIGHT.md new file mode 100644 index 0000000000..e3e6758e6b --- /dev/null +++ b/docs/0.4.0_RELEASE_PREFLIGHT.md @@ -0,0 +1,139 @@ +# Tuya Zigbee 0.4.0: Test candidate preflight and release decision + +> Current routing, 2026-10-25: `main` = 0.3.3 Live; `dev` = 0.3.4 Test. +> 0.4.0 remains an unpublished candidate on `develop-0.4`; new work targets +> `develop-0.4.1`. The earlier 0.3.2-Live-first prerequisite has been satisfied. +> [Current policy and branch cleanup audit](BRANCHES.md) supersede dated channel +> status and provisional dates below. Physical acceptance still follows public Test. + +Snapshot recorded **2026-10-04**, beginning at `develop-0.4` commit +`ca85393ce55269d8e808f1c7a749d9d158ba3ac1`. +This is a working release checklist, **not an assertion that 0.4.0 has been published**. +The final release commit may advance through narrow documentation or static-check changes, +and MUST be revalidated at the actual selected release SHA. Target: 6–7 October 2026, +subject to confirmed 0.3.2 Live availability and final candidate sign-off. No background or automatic deployment. + +## Candidate inventory and evidence + +| Contract | Preflight observation | +| --- | --- | +| Frozen Test source | `modernize-2026-issues`, version 0.3.1, SHA `7583b4bb2fa91600c2301eb142335312a6a7cac4` | +| 0.3.1 release PR | [Draft #1470](https://github.com/JohanBendz/com.tuya.zigbee/pull/1470), still separate and unmerged at this snapshot | +| Current Homey Test and submitted Live candidate | **0.3.2 is in Test** and **submitted to Athom for Live approval**, confirmed by maintainer 2026-10-04; approval and actual Live publication pending | +| Source for 0.3.2 candidate | `release-0.3.2` at `e0ef3f3c66298453549900719b9904f55157b0fa`; publication-only successor of immutable 0.3.1 runtime | +| App target version | 0.4.0 consistently in package.json, package-lock.json, Homey Compose and generated app.json | +| Existing manifests retained | All 135 existing 0.3.1 driver manifest objects pinned by immutable automated contract | +| New profiles | 19 isolated driver IDs / 33 separately exact manufacturerName + modelId identity rows | +| Protected existing source | 15 sensitive light device.js files and five shared Zigbee/Tuya source blobs pinned to frozen 0.3.1 | +| Existing runtime differences needing physical regression | Four opted-in plug device.js files for [#1503](https://github.com/JohanBendz/com.tuya.zigbee/issues/1503); wall_thermostat logging for [#1501](https://github.com/JohanBendz/com.tuya.zigbee/issues/1501) | +| Source audit | 0.4 is 46 commits ahead, zero behind frozen 0.3.1 at the audit starting SHA; no silent merge of #1470 | + +[CI run 37161668778](https://github.com/JohanBendz/com.tuya.zigbee/actions/runs/37161668778) +was successful on the preceding exact implementation tree (167 tests, 164 pass, zero +failures, three pre-existing CCT TODOs, deterministic Compose and supported index, +Homey validation at publish level). **Run and record CI again on the final +release SHA after any further changes.** Never claim this earlier CI validates an +untested new tree. + +## Pre-Test decision register + +- **Static contracts / old-user compatibility:** prior CI GREEN at audit start. + Recheck final tree and all changes after this snapshot. Do not rewrite the immutable + 0.3.1 fixtures or weaken the protected-runtime test to obtain a pass. +- **Scope and device identities:** 33 exact profiles-inventory rows, verified + mechanically in `test/0.4-physical-acceptance-inventory.test.js`. + This includes all new driver manufacturer/product combinations, with no + unsafe eWeLink/SNZB-03 matcher: a PIR (#1113) and SQ510A water sensor (#1475) + share that exact identity and are deliberately deferred. +- **Test reporting path:** [exact physical acceptance and copyable test report](0.4.0_PHYSICAL_ACCEPTANCE.md). + Record actual app version, exact Zigbee identity, driver, Homey firmware, device + behaviors, Flow, restart/rejoin and real cell type/count. Do not put private IEEE + addresses, network IDs or access tokens in public issues. +- **Manual UI / artwork / pairing check:** review new profile names, icons, images and + instructions in Homey pairing preview, especially inherited artwork shared by + isolated driver profiles. The successful automated validator is necessary but is + not a substitute for the maintainer's visual review. +- **0.3.1 feedback and Test-channel transition:** **CONFIRMED: 0.3.2 Live BEFORE 0.4.0 Test**. + The maintainer originally selected 0.3.1 Live first in tracker #1469 / PR #1470, + then selected a documentation-only 0.3.2 resubmission on 2026-10-04. + `release-0.3.2` preserves the frozen 0.3.1 runtime; only publication copy, + version metadata and packaging/maintenance files change. See [the correction](0.3.2_PUBLICATION.md). + **0.3.2 is already in Homey Test and has been submitted to Athom for Live review** + (maintainer status, 2026-10-04). The final 0.3.2 SHA has previously passed CI. + Continue observing current 0.3.2 Test feedback, await Athom's Live approval, + and confirm actual 0.3.2 Live availability BEFORE submitting 0.4.0 to Test. The [0.3.1 review checkpoint](0.3.1_LIVE_REVIEW.md) + remains evidence for the inherited runtime, not a claim that 0.3.2 is published. + Live approval/publication of 0.3.2 is still pending; Homey Test publication and + Athom submission are already reported complete. No release-PR merge is implied + by this checklist. +- **Physical verification of new profiles:** deliberately **PENDING until public + 0.4 Test**; it is not an entry gate for publishing Test. It DOES matter before + claiming device support is fully verified or proposing a later Live rollout. + +## Priority order when 0.4.0 becomes publicly available in Test + +1. Smoke-check upgrade, pairing and existing critical light/Flow behaviors with + current users; monitor crashes, initialization errors and rollback readiness. +2. Regress four pre-existing plug drivers' relay_status behavior (#1503): optional + 0x8002 read, supported value 0/1/2, no silent default write, unaffected onoff. + Check wall_thermostat recognized DPs versus diagnostics-only DP36 suppression (#1501). +3. For multi-channel switches, test each independent EP/tile both from Homey and + physical switch, including Flow/report feedback; prioritize #1500, #795, + #1338, #991 and #1035. +4. Physically test all 33 new identities separately using the [acceptance matrix](0.4.0_PHYSICAL_ACCEPTANCE.md). + Standard ZCL contact/rain/motion/water/battery/lux and the four temperature/RH + sensors require real report values, polarity and accuracy. Check actual battery + type/count where marked `OTHER`; validate illuminance conversion against real + light levels and motion/cooldown/clear, not just whether a device paired. +5. Keep canonical issues open for individual missing or failed results. A positive + report for one manufacturer must never be generalized to another exact ID. + +## Recovery / rollback policy (version-safe) + +- **Before 0.4 Test submission:** retain the frozen 0.3.1 branch, its validated SHA + unchanged. Keep PR #1470 as the frozen 0.3.1 reference and use the separate `release-0.3.2` submission lane. Stop or defer the submission if a reproducible + static blocker is found. There is no need to roll back a version that is not + yet published. +- **After 0.4.0 is published to Test:** do **not** assume that publishing 0.3.1 + again will downgrade installed 0.4.0 Test apps; Homey release versions are + monotonic. If a critical fault appears, pause further promotion, document + the affected fingerprints and produce a **higher-version corrective Test build**, + normally 0.4.1. Depending on scope, selectively revert the offending 0.4 + changes or build a conservative 0.3.1-compatible source tree released under + the higher version. Update ALL relevant version metadata, Homey Compose, + generated app.json/index, changelog and tests; run full CI and publish + validation on the exact corrective commit. +- Keep 0.2.76 Live and the untouched 0.3.1 source available as references. + Do not automatically merge #1470 or bypass Athom review. A subsequent Live + promotion has its own acceptance decision and must evaluate individual + public Test evidence, not simply the green mock-test result. + +**Manual release sign-off fields (fill after actual decision):** + +| Item | Value | +| --- | --- | +| Selected final 0.4 release SHA | PENDING | +| CI run for selected SHA / conclusion | PENDING | +| Review of pairing labels and images | PENDING | +| Current 0.3.2 Test feedback reviewed by | PENDING contemporaneous review | +| Test-channel path chosen / maintainer approval | CONFIRMED 2026-10-04: 0.3.2 is Test + submitted to Athom for Live; **0.4.0 Test only after 0.3.2 actually becomes Live** | +| Actual 0.3.2 Live availability | PENDING Athom approval and actual Live publication (0.3.2 Test is already published) | +| Date/time 0.4 actually submitted to Test | NOT SUBMITTED | + +## Feature freeze and next development lane + +The 0.4.0 feature scope is frozen at the implementation inventory above: 154 +drivers, 19 new profiles and 33 exact acceptance rows. `develop-0.4` is the +0.4.0 stabilization/release lane; only identified release blockers, reviewed +0.3.0/0.3.1 feedback fixes and release documentation belong here, followed by +CI on the selected final SHA. Freeze is not an assertion of final sign-off. + +**`develop-0.4.1` already exists** from the validated freeze checkpoint for all new +development (and currently includes the exact 0.3.2 publication-copy corrections +carried into the 0.4 release lane). It initially inherits unchanged 0.4.0 +version metadata; advance +package/lock/Compose/generated manifest/changelog together when preparing the +first 0.4.1 implementation candidate, and adapt candidate-specific preflight +checks explicitly. Do not silently add new work to the frozen 0.4.0 scope or +merge the 0.4.1 branch wholesale back into it. Narrow fixes discovered during +Test may be selectively carried between lanes with independent validation. diff --git a/docs/0.4.0_TEST_READINESS.md b/docs/0.4.0_TEST_READINESS.md new file mode 100644 index 0000000000..f07ba024d6 --- /dev/null +++ b/docs/0.4.0_TEST_READINESS.md @@ -0,0 +1,45 @@ +# 0.4.0 Test readiness · updated 2026-10-04 + +> Current routing, 2026-10-25: `main` = 0.3.3 Live; `dev` = 0.3.4 Test. +> 0.4.0 remains an unpublished candidate on `develop-0.4`; new work targets +> `develop-0.4.1`. The earlier 0.3.2-Live-first prerequisite has been satisfied. +> [Current policy and branch cleanup audit](BRANCHES.md) supersede dated channel +> status and provisional dates below. Physical acceptance still follows public Test. + +**Provisional target:** submit 0.4.0 to the Homey Test channel **6–7 October 2026 only if 0.3.2 has first actually become Live**; otherwise move the Test submission, not the gate. Subject to the *pre-Test static/release gates* below. **The Homey Test channel is our real-world physical testing and community feedback phase: completed physical acceptance of new devices is NOT a prerequisite to publishing Test.** This is a planning target, not a scheduled auto-release. Live/Test versions and Draft PR #1470 are not modified by this document. + +## Evidence and scope + +- Maintainer-reported 0.3.1 Test adoption on October 2: **over 2,600 installs and no crash or error reports received**. This is a report-status snapshot, not proof that crashes can never occur or that new 0.4 runtime is verified. The 0.3.1 Test line is at commit 7583b4bb2fa91600c2301eb142335312a6a7cac4. +- Preflight compared both generated Homey manifests property for property: 0.3.1 contains **135 drivers**; 0.4 adds **nineteen isolated new profiles**, and all **135 existing driver manifest objects are identical**. No existing Flow-card object or custom capability definition differs. This comparison was turned into a permanent automated baseline test: test/0.4-legacy-manifest-contract.test.js and immutable test/fixtures/0.3.1-manifest-contract.json. +- Nineteen new Compose drivers match 33 distinct Zigbee manufacturerName + modelId pairs pending independent physical acceptance, recorded in docs/0.4.0_PHYSICAL_ACCEPTANCE.md. No existing driver capability migrations or new Flow contracts have been introduced. +- Existing runtime changes requiring extra attention despite identical manifests: four opted-in plug runtimes (smartplug, smartplug_2_socket parent EP1, wall_socket, smartPlug_DinRail) using Tuya relayStatus 0x8002 (#1503); PLUS wall_thermostat's diagnostic-only limiter for high-frequency unmapped DP36 messages (#1501). The thermostat's recognized datapoint values/command handling is not intentionally changed. +- Existing intentional color-temperature audit TODOs (#1502) remain TODOs. The 0.3.1 byte-identical source baseline now includes five core shared Zigbee/Tuya runtime files AND all 15 existing light device.js files; CI checks actual Git blob identities using test/0.4-protected-runtime-contract.test.js. The shared light/runtime stack is too sensitive for a broad, unverified rewrite during this Test preparation window. + +## Test-candidate gates + +**Gate 1 – build/compatibility:** clean Homey Compose generation; generated app.json and SUPPORTED_DEVICES.md committed and reproducible; full Node test suite including the immutable 0.3.1 contract; Homey app validate at publish level; whitespace; review actual diff from frozen 0.3.1. Any intentional change to an existing driver, custom capability or Flow card must have an explicitly reviewed, issue-linked pinned entry in test/fixtures/0.4-approved-manifest-deltas.json. The 20 protected source files likewise must remain identical to frozen 0.3.1 or require an approved issue-linked exact blob in test/fixtures/0.4-approved-runtime-deltas.json. NEVER modify the 0.3.1 snapshot to make a new change pass. This catches a changed existing driver declaration even if the new code appears harmless. + +**Gate 2 – confirmed release order:** **0.3.2 Live BEFORE 0.4.0 Test**, the documentation-only 0.3.2 candidate replaces the original 0.3.1 Live submission plan at the maintainer's request on 2026-10-04. Review the [frozen 0.3.1 runtime feedback](0.3.1_LIVE_REVIEW.md) and [0.3.2 publication correction](0.3.2_PUBLICATION.md), validate the corrected 0.3.2 SHA, complete its separate Athom certification/Live publication, and confirm actual 0.3.2 Live availability before submitting 0.4.0 to Test. **0.3.2 is now in Test and submitted to Athom for Live review; Live approval/publication remains pending (maintainer report 2026-10-04).** Keep the historical 0.3.1 runtime/manifest fixtures at 7583b4bb2fa91600c2301eb142335312a6a7cac4 unchanged. Do not silently merge Draft PR #1470, publish an app, or assume Athom's review timing. Homey Test users may receive newer Test updates: treat moving from 0.3.2 to 0.4 as a meaningful rollout, not a private smoke-test. + +**Gate 3 – prepare the physical Test programme, not perform it before publishing:** make the public GitHub issue/reporting path, 33-row exact-identity acceptance matrix, version-safe recovery procedure and reporter instructions ready. No physical pairing, relay/sensor checks or completed hardware acceptance is required to submit 0.4.0 to Test. Once 0.4.0 is available in Test, collect real Homey feedback, prioritizing multichannel EP2/EP3 operation and physical status/Flow (#795/#1500), existing plug power-on-setting regression (#1503), wall-thermostat known datapoints and DP36 log behavior (#1501), and the four added temperature/humidity sensors, MOWE standard-IAS rain sensor (#1288), and three pending standard-IAS flood-sensor fingerprints (#1041; provisional unknown battery cells), and two exact contact + lux profiles (#1298; distinct EF00 endpoint requirements and unknown battery cells), and three plain standard-IAS contact profiles (#1013; Poll Control optional and two unknown battery cell specifications), and two standard IAS PIR + illuminance profiles (#1481; actual lux scaling/battery cells pending). Each manufacturer's actual result is recorded separately; missing or failed Test feedback remains an OPEN issue and feeds subsequent Test patches. Passing a mocked test is never described as physical acceptance. + +**Gate 4 – release artifacts:** Follow the [candidate-specific sign-off, Test transition and version-safe recovery plan](0.4.0_RELEASE_PREFLIGHT.md). Keep README and changelog channel-neutral and user-facing; describe added pairing profiles without asserting physical validation. Keep Test/Live status, CI, rollout plans and per-device acceptance in maintainer documentation and GitHub issues. Check the exact supported-device index, pairing instructions/artwork, publish validation at FINAL SHA and documented recovery path. Check source file diff to ensure shared light and global Zigbee cluster handling were not modified inadvertently. + +**Separate Live gate (AFTER Test):** evaluate issues/diagnostics from actual installed 0.4 Test hardware, ensure no significant crash/regression signal, physically confirm relevant existing runtime regressions (#1503/#1501), and individually accept each new fingerprint intended for Live (or explicitly defer/remove those without adequate evidence). Never substitute a successful Homey manifest/CI test for real feedback. + +## Working sequence + +- **Oct 2–3:** Freeze a trusted 0.3.1 compatibility contract in CI; inspect only narrow 0.4 regressions and evidence-backed device work. Do not trade regressions for issue-count reduction. +- **Oct 4:** Resolve outstanding code-review, targeted mocked tests and static regression checks; prepare clear GitHub reporting instructions and physical Test checklist. Do **not** block Test submission on hardware that can only be validated once Test is published. +- **Oct 5:** Re-run CI on the FINAL 0.4 candidate commit (not just an older PR), review Homey publish validation, README/changelog/index, pairing artwork and the explicit Test release-lane decision. Fix known static/publish blockers and unacceptable identified risk; ordinary *absence of physical testing* is expected at this stage, not a Test blocker. +- **Oct 6–7:** Submit 0.4.0 to Test once the **non-physical pre-Test Gates 1–4** are satisfied. Begin physical testing **through Test installs**: community pairing, EP-by-EP switching/Flow, plug and thermostat regression, and sensor behavior. Triage reported failures into narrow 0.4.x Test corrections. Do not describe any of the 33 new identities as physically verified without separate public 0.4 Test evidence. +- **Following Test feedback:** perform the distinct Live acceptance review using real installation reports; hardware verification is a Live/support-claim decision, NOT a requirement to open Test. + +**Feature freeze:** keep the current 154-driver / 19-new-profile / 33-identity +scope in `develop-0.4` for 0.4.0 stabilization. Carry all new development in +`develop-0.4.1`, forked from the validated freeze checkpoint. Review incoming +0.3.2 Test feedback for narrow release corrections, with final-SHA CI after +any correction; do not expand the frozen candidate with unrelated features. + +Useful official references: https://apps.developer.homey.app/app-store/publishing and https://apps.developer.homey.app/app-store/updates. Homey apps use semver; a lower-version release cannot force a downgrade. diff --git a/docs/BRANCHES.md b/docs/BRANCHES.md new file mode 100644 index 0000000000..d24f20962b --- /dev/null +++ b/docs/BRANCHES.md @@ -0,0 +1,104 @@ +# Branches and Homey release channels + +Updated 2026-10-25. This is the current branch policy; dated release snapshots +and older GitHub comments remain historical evidence. + +## Current channels and source anchors + +| Branch | Role | Version / published source | +| --- | --- | --- | +| `main` | Homey App Store Live | 0.3.3, source `130854f4c6d1b5a3537e956d941eb2e3caec9a9a` | +| `dev` | Homey App Store Test | 0.3.4, source `21b60ce07d91421aeba08357960c8fc910d87593` | +| `develop-0.4` | Frozen next Test candidate; not published | 0.4.0, pre-migration source `3e5695667cab9d6a3296d58909b90a8dc0376e93` | +| `develop-0.4.1` | New development after the 0.4.0 feature freeze | Pre-migration source `08d85dd59177826ff35436b9802f305f372e9bc7`; inherited 0.4.0 metadata until a coordinated 0.4.1 version bump | + +Observed directly on the official Store pages on 2026-10-25: +- Live: https://homey.app/en-us/app/com.tuya.zigbee/Tuya-Zigbee/ shows 0.3.3. +- Test: https://homey.app/en-us/app/com.tuya.zigbee/Tuya-Zigbee/test/ shows 0.3.4. + +The Store pages establish channel versions; the release-source mapping also uses +tracker #1469 and PR #1525. Source anchors above identify the repository source +of those releases; they are not a cryptographic comparison with Store packages. +Documentation/CI-only commits may follow the anchors without changing the +published runtime, manifests, dependencies, version or changelog. A GitHub merge +or branch move never publishes to Homey by itself. + +## Work and promotion policy + +- Keep `main` aligned with the actual Live runtime and `dev` with the actual Test + runtime. Prepare runtime changes on dedicated branches. Review narrow Test + corrections against `dev`; move the tested source into `dev` in coordination + with its actual Homey Test publication. +- Direct new features and device additions to `develop-0.4.1`. Do not use the + default branch as a blanket contribution target. Keep frozen `develop-0.4` + limited to identified release corrections and presentation cleanup. +- Before publishing 0.4.0 Test, review current 0.3.4 feedback and its Smart Knob + correction (#1389), the frozen candidate's final CI and remaining artwork. + After actual 0.4.0 Test publication, advance `dev` to the selected candidate + without pulling in unrelated 0.4.1 work. Preserve any unique dev history when + promotion is not a fast-forward. +- Once a tested version is approved and actually published Live, advance `main` + to that release source. Carry reviewed fixes into the future branches + selectively. Preserve existing saved-device/Flow contracts. +- CI runs on `main`, `dev`, `develop-0.4`, `develop-0.4.1` and pull requests. +- Use `main` as the GitHub default branch. At migration inspection the default + was still `SDK3`; changing it requires repository administration access. + Check the actual repository setting before deleting `SDK3`. +- `SDK3`, `modernize-*` and `release-0.3.*` are historical sources, not active + contribution targets. Use pinned commit URLs for immutable review evidence. +- README and Homey changelog stay user-facing and channel-neutral. Keep branch, + CI and rollout detail in maintainer docs and GitHub release tracking. + +## Outstanding pull requests + +- #1470 and #1514: historical 0.3.1/0.3.2 release proposals; their full history is + already retained by `main`. Close as superseded without merging them again. +- #1525: the published 0.3.4 Test source is already retained by `dev`; close the + old release-source PR without implying Live promotion or physical acceptance. +- #1535: AVATTO TRV addition belongs against `develop-0.4.1`, not old `SDK3` or + the Store-matching branches. Retargeting is routing only, not code approval; + reconcile generated app.json through Compose and review the implementation + independently before any merge. +- Canonical hardware issues remain open until their own acceptance criteria are + met. This migration does not close device bugs or assert physical tests. + +## Branch cleanup audit + +No branch is deleted by this migration. The following 16 old heads are ancestors +of the retained branches shown, verified with `git merge-base --is-ancestor`. +Close/retarget the release PRs above first. Change the default to main before +removing SDK3. The old release commits and 0.3.1 compatibility fixtures remain +reachable through the retained histories even after these branch names go away. + +| Branch removable after those steps | Audited old head | History retained by | +| --- | --- | --- | +| `SDK3` | `328d24ed315131528f2358b66bb0b8259615a49e` | `main`, `dev`, `develop-0.4`, `develop-0.4.1` | +| `modernize-2026` | `44ed7a650b62f47e7e3e08dea037a02d351b62c7` | `main`, `dev`, `develop-0.4`, `develop-0.4.1` | +| `modernize-2026-issues` | `7583b4bb2fa91600c2301eb142335312a6a7cac4` | `main`, `dev`, `develop-0.4`, `develop-0.4.1` | +| `release-0.3.2` | `e0ef3f3c66298453549900719b9904f55157b0fa` | `main`, `dev` | +| `release-0.3.3` | `130854f4c6d1b5a3537e956d941eb2e3caec9a9a` | `main`, `dev` | +| `release-0.3.4` | `21b60ce07d91421aeba08357960c8fc910d87593` | `dev` | +| `chore/0.3.2-live-review-state` | `6cf4e54c216bf6aa68d7bfd170dff1ec37ea2507` | `develop-0.4`, `develop-0.4.1` | +| `chore/0.4-test-candidate-preflight` | `5c17783c5d8a71da8803695365a052995e673784` | `develop-0.4`, `develop-0.4.1` | +| `chore/channel-neutral-publishing` | `df1607a092bd6f05c7e384bee513de067608a6e8` | `develop-0.4`, `develop-0.4.1` | +| `chore/release-lanes-031-live-041` | `d62606e534ff577f5db6878fb050abdbd73e5467` | `develop-0.4`, `develop-0.4.1` | +| `feature/0.4-contact-illuminance-1298` | `47c7ee181158c74cdca8a35690e30472e13c8759` | `develop-0.4`, `develop-0.4.1` | +| `feature/0.4-ias-leak-unknown-cells-1041` | `0d997ab856d822e4d8d544521ce669fc3028174b` | `develop-0.4`, `develop-0.4.1` | +| `feature/0.4-mowe-ias-rain` | `565d80948c22688fc61786e1379bf430402bdedf` | `develop-0.4`, `develop-0.4.1` | +| `feature/0.4-standard-ias-contact-1013` | `9380d45e1165dbfd78e5d9296f6788363e628401` | `develop-0.4`, `develop-0.4.1` | +| `feature/0.4-standard-ias-motion-lux-1481` | `b1242d4c7acfebe3f5508087b9c8049e5a0109d8` | `develop-0.4`, `develop-0.4.1` | +| `feature/0.4-standard-zcl-temphumids-797` | `a87613f4b88a58a41b484fae93a2040d97702d9c` | `develop-0.4`, `develop-0.4.1` | + +Keep these additional branches pending a separate history decision: + +| Branch | Reason | +| --- | --- | +| `archive/dev-0.0.2-2026-10-25` | Preserves the former dev head `b05cbe1a702ca95604d2de39815fb22dff0f5b88`, with 8 commits outside all four active histories | +| `SDK3-test` | 20 commits outside all four active histories | +| `master` | 4 commits outside all four active histories | +| `sdk-3` | 8 commits outside all four active histories | +| `refactor/type-based-drivers` | 16 commits outside all four active histories; separate experimental architecture | + +Counts describe commit ancestry, not a claim that every patch is unique or useful. +The two 0.4 heads had identical trees but divergent cherry-pick histories at +migration; retain both for their distinct frozen-candidate and development roles. diff --git a/docs/LIGHT_TEMPERATURE_AUDIT.md b/docs/LIGHT_TEMPERATURE_AUDIT.md new file mode 100644 index 0000000000..6a7ad69571 --- /dev/null +++ b/docs/LIGHT_TEMPERATURE_AUDIT.md @@ -0,0 +1,52 @@ +# Color-temperature code audit — issue #1502 + +**Date:** 2026-10-01. **Baseline:** `develop-0.4` at `37e95b8` (before the audit). **Scope:** investigation and tests only; there is NO production code, pairing, manifest, dependency, Homey Store or release change in this audit. Do not classify this audit as adding a supported device or fixing existing CCT behavior. + +## Triple check: source / physical evidence / SDK + +1. **Actual app code:** `lib/TuyaZigBeeLightDevice.js` defines `MAX_COLORTEMPERATURE=254`; the color-temp capability set parser uses `round(x*254)`, report parser uses `1-m/254`, while `changeColorTemperature(x)` and the `light_mode=temperature` path use `round(254-x*254)`. `onEndDeviceAnnounce()` uses `1-m/254`. `changeColorTemperature` also sends proprietary `tuyaRgbMode({ enable: 0 })` before a standard Color Control `moveToColorTemperature` command. The executable test `test/light-temperature-audit.test.js` loads and invokes the real source through an isolated mock: it characterizes legacy behavior, NOT the desired fix. +2. **Impact search:** the following **15 existing** light-temperature profiles directly inherit the shared runtime without overriding these methods: `dimmable_led_strip`, `dimmable_recessed_led`, `rgb_bulb_E14`, `rgb_bulb_E27`, `rgb_ceiling_led_light`, `rgb_floor_led_light`, `rgb_led_light_bar`, `rgb_led_strip`, `rgb_mood_light`, `rgb_spot_GU10`, `rgb_spot_GardenLight`, `rgb_wall_led_light`, `tunable_bulb_E14`, `tunable_bulb_E27`, `tunable_spot_GU10`. Changing this shared file or removing all F0 handling affects existing paired device types. +3. **Independent physical records:** #113 TS0502A has actual `colorTemperatureMireds=255`; #271 TS0501A has `153`; #178, a **different EF00-capable TS0502B family**, explicitly reports `colorTempPhysicalMinMireds=153` and `colorTempPhysicalMaxMireds=500`. These are readings/interview attributes, not confirmation of each #113/#271 product's full physical range. Never silently use 153–500 for *every* Tuya lamp. +4. **Official Homey documentation:** Homey's `ZigBeeLightDevice.changeColorTemperature(temperature)` accepts a normalized 0–1 value. The official Light best practices require correct externally reported state and prohibit changing ON/OFF solely as a side effect of changing color/temperature. Sources: https://athombv.github.io/node-homey-zigbeedriver/ZigBeeLightDevice.html and https://apps.developer.homey.app/the-basics/devices/best-practices/lights. Homey's Zigbee documentation covers endpoint bindings/cluster input vs output: https://apps.developer.homey.app/wireless/zigbee. + +### Reproducible legacy behavior (NOT expected future behavior) + +| Code path in real runtime | Homey input 0 | Homey input 1 | Additional observation | +| --- | ---: | ---: | --- | +| Registered `light_temperature.setParser` | **0 mired** | **254 mired** | Direct fallback/individual-set mapping. | +| `changeColorTemperature` grouped path | **254 mired** | **0 mired** | Sends proprietary `tuyaRgbMode({enable:0})` first, then standard command. | +| `light_mode=temperature` | Uses `round(254 - storedHomeyValue*254)` | — | Also invokes vendor mode first. | +| Registered report parser / end-device announce | — | — | `1 - mired/254`; actual #113 reading **255** becomes approximately **-0.00394**; 500 becomes approximately **-0.9685**. | + +The two set paths are *opposite* at both endpoints regardless of the precise temperature scale interpretation. A vendor mode command failure can prevent the standard command because the latter occurs after the awaited vendor command; this is a conditional code-path risk, **not verified failure for any specific #113/#271 device**. Source tests already assert vendor mode use for parts of the legacy light runtime in `test/repository.test.js`. + +## Third check: EXACT installed Homey dependency, not only its online API docs + +The pinned app dependency in `package.json` is `homey-zigbeedriver@2.1.4`. Inspected the original `lib/ZigBeeLightDevice.js` from the official Athom repository **at tag `v2.1.4`** (blob `49984f0fa48744f0bbc2dc70651290f50310ac33`), without copying this third-party code into the app: + +- `readColorControlAttributes()` attempts to read `colorCapabilities`, `colorTemperatureMireds`, `colorTempPhysicalMinMireds`, `colorTempPhysicalMaxMireds` and other color attributes. It stores `colorTempMin`/`colorTempMax` and its `supportsColorTemperature` decision. +- `changeColorTemperature(x)` uses `mapValueRange(0, 1, min, max, x)` and calls standard `moveToColorTemperature` when `supportsColorTemperature` is true. `onEndDeviceAnnounce` reverses using the same stored min/max. The official class **does not call `tuyaRgbMode`**. +- However, the **actual original physical Homey interviews** attached to **#113** and **#271** include a `colorTemperatureMireds` observation but **do not include** `colorCapabilities` or either physical-min/max attribute. A missing interview attribute does not prove the device cannot return it on a later direct read, but it means we cannot assume that v2.1.4 will initialize `supportsColorTemperature` and valid bounds for either family. Its fallback on unsupported color temperature may use CIE/HSV color emulation instead of standard CCT; that is not an acceptable unverified substitution for a newly advertised CCT-only profile. +- In contrast, the physically interviewed **#178** TS0502B *does* contain all three metadata attributes, including 153/500 mireds, but is a separate EF00-capable hardware family; this cannot be projected onto #113/#271. + +**Revised implementation gate:** test whether the exact #113/#271 physical units answer direct reads for `0x0300` Color Capabilities `0x400A`, Physical Min `0x400B` and Max `0x400C` (and confirm min <= current <= max), or establish an explicit *per-fingerprint* physically verified bounded fallback before installing a standard-only candidate driver. If a vendor command is demonstrably required for a particular device, isolate that behavior to its exact profile; do not apply it to all lights. + +## Fourth check: global Color Control override (exact pinned cluster library) + +Read the official athombv/node-zigbee-clusters tag **v2.4.1**, which matches the app's pinned dependency. Stock lib/clusters/colorControl.js includes Color Capabilities (0x400A), Physical Min (0x400B) and Max (0x400C). The app's own lib/TuyaColorControlCluster.js **overrides its static ATTRIBUTES getter without spreading super.ATTRIBUTES** and omits all three. lib/TuyaZigBeeLightDevice.js calls Cluster.addCluster(TuyaColorControlCluster) at import time. The official Cluster.addCluster() replaces the global implementation by both ID (0x0300) and name (colorControl) and builds the attribute registry from global attributes plus the replacement getter. Cluster.readAttributes() rejects unknown attribute names *before sending Zigbee frames*. + +**Additional implementation gate:** Athom's stock ZigBeeLightDevice expects these attributes; merely switching inheritance may throw a local TypeError even if the hardware would respond. Do not apply a global super.ATTRIBUTES / super.COMMANDS change without testing existing RGB modes/commands/reports. Do not register competing Color Control clusters as an attempted per-device solution. + +Executable test/standard-cct-preflight.test.js uses the installed 2.4.1 library to demonstrate this mismatch, including no outbound Zigbee frame. Standalone, currently unreferenced lib/StandardCctRange.js supplies a fail-closed pure mapping candidate: no generic 153–500 default, explicit confirmed capability plus physical min/max, normalized Homey 0 => min mired and 1 => max mired, bidirectional tests and no old driver imports. Its 153–500 test fixture is solely the different physical #178 family, not an assumption for #113/#271. + +This is preflight work only, not a new device or fix for already paired devices. Before implementing standard-CCT pairing, separately resolve the global cluster metadata API and require per-fingerprint physical range/command evidence. +## Safe implementation path — still pending + +- **Do not change `TuyaZigBeeLightDevice` globally as part of adding #113/#271.** In particular, don't simply replace constant 254 with 500: that leaves opposite set-parser/change paths, the report parser, `light_mode`, and `onEndDeviceAnnounce` inconsistent. Blindly deleting F0 might break existing RGB. +- Use the now-inspected **actual `homey-zigbeedriver@2.1.4`** `ZigBeeLightDevice` as a behavioral reference, but first prove each target unit supplies Color Capabilities and physical min/max on a direct read or establish a separately tested, physically justified per-fingerprint fallback. A blind inheritance switch is *not* safe: original #113/#271 interviews omit these metadata attributes. +- If implementing an isolated candidate, use exact `TS0502A` identities under #113 (four original physical interviews), separately exact `TS0501A` identities under #271 (four original physical interviews, including one in #273 comment). Never pair by a manufacturer-only wildcard or broaden unrelated RGB profiles. No invented RGB capabilities, unknown vendor settings or assumed min/max ranges. +- Physical acceptance **per fingerprint:** verify its exact Homey `ids` and read Color Control physical min/max if available, cold/warm direction and clamping, set/get/report round trip, on/off and dim/Level Control, local reporting, grouping/Flow actions, restart/power cycle, and whether vendor F0 is actually necessary before enabling it. +- Keep #178's EF00-capable TS0502B profiles outside the standard-only pilot. A later shared-runtime migration would require representative installed RGB, CCT, strip and spot regression coverage on actual Homey hardware. +- Characterization tests deliberately assert today's flawed mapping; when implementing a correction, replace those snapshots with behavior/acceptance assertions and resolve the three TODO tests intentionally. + +**Decision gate:** #1502 is an independent technical blocker/tracking issue. #113/#271 remain OPEN and **not implemented** until a separately verified standard-CCT path is ready. `modernize-2026-issues` remains frozen on published 0.3.1 Test; `SDK3` remains Live 0.2.76. diff --git a/drivers/contact_lux_hobeian/assets/icon.svg b/drivers/contact_lux_hobeian/assets/icon.svg new file mode 100644 index 0000000000..540b92d529 --- /dev/null +++ b/drivers/contact_lux_hobeian/assets/icon.svg @@ -0,0 +1,123 @@ + +image/svg+xml + + + + diff --git a/drivers/contact_lux_hobeian/assets/images/large.png b/drivers/contact_lux_hobeian/assets/images/large.png new file mode 100644 index 0000000000..b4c88cb8c7 Binary files /dev/null and b/drivers/contact_lux_hobeian/assets/images/large.png differ diff --git a/drivers/contact_lux_hobeian/assets/images/small.png b/drivers/contact_lux_hobeian/assets/images/small.png new file mode 100644 index 0000000000..b2469e3b59 Binary files /dev/null and b/drivers/contact_lux_hobeian/assets/images/small.png differ diff --git a/drivers/contact_lux_hobeian/assets/learn.svg b/drivers/contact_lux_hobeian/assets/learn.svg new file mode 100644 index 0000000000..f0e77cbb54 --- /dev/null +++ b/drivers/contact_lux_hobeian/assets/learn.svg @@ -0,0 +1,317 @@ + +image/svg+xml + + + + diff --git a/drivers/contact_lux_hobeian/device.js b/drivers/contact_lux_hobeian/device.js new file mode 100644 index 0000000000..56eefb1e9f --- /dev/null +++ b/drivers/contact_lux_hobeian/device.js @@ -0,0 +1,80 @@ +'use strict'; + +// #1298: shared standard-cluster subset ONLY. HOBEIAN announces EF00 on EP1, +// but no private datapoint mapping is implemented without physical evidence. +// The exact _TZE200_pay2byax/TS0601 profile reuses this ZCL runtime without EF00. +const { ZigBeeDevice } = require('homey-zigbeedriver'); +const { CLUSTER } = require('zigbee-clusters'); +const { illuminanceMeasuredValueToLux } = require('../illuminance_sensor/measurements'); + +class ContactIlluminanceSensor extends ZigBeeDevice { + async onNodeInit({ zclNode }) { + const endpoint = zclNode.endpoints[1]; + const ias = endpoint.clusters[CLUSTER.IAS_ZONE.NAME]; + + // Homey handles IAS CIE addressing during pairing; keep an enrollment + // response callback for devices/firmware that forward an enroll request. + ias.onZoneEnrollRequest = () => { + Promise.resolve().then(() => ias.zoneEnrollResponse({ + enrollResponseCode: 0, zoneId: 0, + })).catch(error => this.error('IAS enroll response:', error)); + }; + + ias.onZoneStatusChangeNotification = ({ zoneStatus } = {}) => { + this.onContactStatus(zoneStatus); + }; + + // Some firmware reports zoneStatus as a ZCL attribute instead of command. + // Ignore non-decoded payloads rather than changing an existing alarm. + ias.on('attr.zoneStatus', this.onContactStatus.bind(this)); + + endpoint.clusters[CLUSTER.ILLUMINANCE_MEASUREMENT.NAME] + .on('attr.measuredValue', this.onIlluminanceMeasured.bind(this)); + endpoint.clusters[CLUSTER.POWER_CONFIGURATION.NAME] + .on('attr.batteryPercentageRemaining', this.onBatteryReported.bind(this)); + + // These are sleepy end devices. Optional first-pair reporting negotiation + // must never prevent initialization; there are no unsolicited reads. + if (this.isFirstInit()) { + for (const config of [ + { endpointId: 1, cluster: CLUSTER.ILLUMINANCE_MEASUREMENT, + attributeName: 'measuredValue', minInterval: 30, maxInterval: 3600, minChange: 100 }, + { endpointId: 1, cluster: CLUSTER.POWER_CONFIGURATION, + attributeName: 'batteryPercentageRemaining', minInterval: 3600, + maxInterval: 21600, minChange: 2 }, + ]) { + await this.configureAttributeReporting([config]) + .catch(error => this.log('Optional contact/lux reporting skipped:', error.message)); + } + } + } + + onContactStatus(status) { + if (typeof status?.alarm1 === 'boolean') { + this.setCapabilityValue('alarm_contact', status.alarm1).catch(this.error); + } + if (typeof status?.battery === 'boolean') { + this.setCapabilityValue('alarm_battery', status.battery).catch(this.error); + } + } + + onIlluminanceMeasured(value) { + // Use the ZCL logarithmic encoding as a starting hypothesis. + // Verify actual manufacturer lux calibration independently in public Test. + if (!Number.isInteger(value) || value < 0 || value > 0xffff) return; + const lux = illuminanceMeasuredValueToLux(value); + if (lux === null || !Number.isFinite(lux)) return; + this.setCapabilityValue('measure_luminance', Math.round(lux * 100) / 100) + .catch(this.error); + } + + onBatteryReported(value) { + // ZCL batteryPercentageRemaining is half-percent, 0xff is unavailable. + if (!Number.isInteger(value) || value < 0 || value > 200) return; + const pct = value / 2; + this.setCapabilityValue('measure_battery', pct).catch(this.error); + this.setCapabilityValue('alarm_battery', pct < 20).catch(this.error); + } +} + +module.exports = ContactIlluminanceSensor; diff --git a/drivers/contact_lux_hobeian/driver.compose.json b/drivers/contact_lux_hobeian/driver.compose.json new file mode 100644 index 0000000000..d7d61b16c9 --- /dev/null +++ b/drivers/contact_lux_hobeian/driver.compose.json @@ -0,0 +1,59 @@ +{ + "id": "contact_lux_hobeian", + "name": { + "en": "HOBEIAN Contact & Illuminance Sensor" + }, + "class": "sensor", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "alarm_contact", + "measure_luminance", + "measure_battery", + "alarm_battery" + ], + "energy": { + "batteries": [ + "OTHER" + ] + }, + "images": { + "large": "{{driverAssetsPath}}/images/large.png", + "small": "{{driverAssetsPath}}/images/small.png" + }, + "zigbee": { + "manufacturerName": [ + "HOBEIAN" + ], + "productId": [ + "ZG-102ZL" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 1, + 3, + 1024, + 1280, + 61184 + ], + "bindings": [ + 1, + 1024, + 1280 + ] + } + }, + "learnmode": { + "image": "{{driverAssetsPath}}/learn.svg", + "instruction": { + "en": "Follow the device instructions to enable Zigbee pairing mode." + } + } + } +} diff --git a/drivers/contact_lux_pay2byax/assets/icon.svg b/drivers/contact_lux_pay2byax/assets/icon.svg new file mode 100644 index 0000000000..540b92d529 --- /dev/null +++ b/drivers/contact_lux_pay2byax/assets/icon.svg @@ -0,0 +1,123 @@ + +image/svg+xml + + + + diff --git a/drivers/contact_lux_pay2byax/assets/images/large.png b/drivers/contact_lux_pay2byax/assets/images/large.png new file mode 100644 index 0000000000..b4c88cb8c7 Binary files /dev/null and b/drivers/contact_lux_pay2byax/assets/images/large.png differ diff --git a/drivers/contact_lux_pay2byax/assets/images/small.png b/drivers/contact_lux_pay2byax/assets/images/small.png new file mode 100644 index 0000000000..b2469e3b59 Binary files /dev/null and b/drivers/contact_lux_pay2byax/assets/images/small.png differ diff --git a/drivers/contact_lux_pay2byax/assets/learn.svg b/drivers/contact_lux_pay2byax/assets/learn.svg new file mode 100644 index 0000000000..f0e77cbb54 --- /dev/null +++ b/drivers/contact_lux_pay2byax/assets/learn.svg @@ -0,0 +1,317 @@ + +image/svg+xml + + + + diff --git a/drivers/contact_lux_pay2byax/device.js b/drivers/contact_lux_pay2byax/device.js new file mode 100644 index 0000000000..584561ec05 --- /dev/null +++ b/drivers/contact_lux_pay2byax/device.js @@ -0,0 +1,5 @@ +'use strict'; + +// #414 / #1486: independently interviewed standard IAS/illuminance TS0601. +// No EF00 input is advertised in the repeated physical Homey interviews. +module.exports = require('../contact_lux_hobeian/device'); diff --git a/drivers/contact_lux_pay2byax/driver.compose.json b/drivers/contact_lux_pay2byax/driver.compose.json new file mode 100644 index 0000000000..f62652e7f3 --- /dev/null +++ b/drivers/contact_lux_pay2byax/driver.compose.json @@ -0,0 +1,58 @@ +{ + "id": "contact_lux_pay2byax", + "name": { + "en": "TS0601 Contact & Illuminance Sensor" + }, + "class": "sensor", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "alarm_contact", + "measure_luminance", + "measure_battery", + "alarm_battery" + ], + "energy": { + "batteries": [ + "OTHER" + ] + }, + "images": { + "large": "{{driverAssetsPath}}/images/large.png", + "small": "{{driverAssetsPath}}/images/small.png" + }, + "zigbee": { + "manufacturerName": [ + "_TZE200_pay2byax" + ], + "productId": [ + "TS0601" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 1, + 3, + 1024, + 1280 + ], + "bindings": [ + 1, + 1024, + 1280 + ] + } + }, + "learnmode": { + "image": "{{driverAssetsPath}}/learn.svg", + "instruction": { + "en": "Follow the device instructions to enable Zigbee pairing mode." + } + } + } +} diff --git a/drivers/contact_sensor_elivco_x8q36xwf/assets/icon.svg b/drivers/contact_sensor_elivco_x8q36xwf/assets/icon.svg new file mode 100644 index 0000000000..00dd60008e --- /dev/null +++ b/drivers/contact_sensor_elivco_x8q36xwf/assets/icon.svg @@ -0,0 +1,104 @@ + +image/svg+xml + + + + diff --git a/drivers/contact_sensor_elivco_x8q36xwf/assets/images/large.png b/drivers/contact_sensor_elivco_x8q36xwf/assets/images/large.png new file mode 100644 index 0000000000..e7cafc94c0 Binary files /dev/null and b/drivers/contact_sensor_elivco_x8q36xwf/assets/images/large.png differ diff --git a/drivers/contact_sensor_elivco_x8q36xwf/assets/images/small.png b/drivers/contact_sensor_elivco_x8q36xwf/assets/images/small.png new file mode 100644 index 0000000000..dd65dd83c1 Binary files /dev/null and b/drivers/contact_sensor_elivco_x8q36xwf/assets/images/small.png differ diff --git a/drivers/contact_sensor_elivco_x8q36xwf/assets/learn.svg b/drivers/contact_sensor_elivco_x8q36xwf/assets/learn.svg new file mode 100644 index 0000000000..a08e0c2531 --- /dev/null +++ b/drivers/contact_sensor_elivco_x8q36xwf/assets/learn.svg @@ -0,0 +1,195 @@ + +image/svg+xml + + + + diff --git a/drivers/contact_sensor_elivco_x8q36xwf/device.js b/drivers/contact_sensor_elivco_x8q36xwf/device.js new file mode 100644 index 0000000000..59a96817fb --- /dev/null +++ b/drivers/contact_sensor_elivco_x8q36xwf/device.js @@ -0,0 +1,44 @@ +'use strict'; + +// #1013 / #1143 / #868: exact standard IAS Zone contact profiles, independent +// Zigbee manufacturer/model pairing, with Poll Control optional per interview. +const { ZigBeeDevice } = require('homey-zigbeedriver'); +const { CLUSTER } = require('zigbee-clusters'); + +class StandardIASContact extends ZigBeeDevice { + async onNodeInit({ zclNode }) { + const endpoint = zclNode.endpoints[1]; + const ias = endpoint.clusters[CLUSTER.IAS_ZONE.NAME]; + + // Modern Homey enrolls IAS automatically. Respond to a forwarded request + // for compatibility; do not send unsolicited startup or sleepy-device reads. + ias.onZoneEnrollRequest = () => { + Promise.resolve() + .then(() => ias.zoneEnrollResponse({ enrollResponseCode: 0, zoneId: 0 })) + .catch(error => this.error('IAS contact enrollment response failed:', error)); + }; + ias.onZoneStatusChangeNotification = ({ zoneStatus } = {}) => { + // Some devices send partial status frames. Never clear alarms based on + // an absent bit (the historical external false-close regression). + if (typeof zoneStatus?.alarm1 === 'boolean') { + this.setCapabilityValue('alarm_contact', zoneStatus.alarm1).catch(this.error); + } + if (typeof zoneStatus?.battery === 'boolean') { + this.setCapabilityValue('alarm_battery', zoneStatus.battery).catch(this.error); + } + }; + + // Standard Power Configuration batteryPercentageRemaining is half-percent. + // 0xff means unknown; do not overwrite a valid Homey battery measurement. + endpoint.clusters[CLUSTER.POWER_CONFIGURATION.NAME] + .on('attr.batteryPercentageRemaining', value => { + if (!Number.isInteger(value) || value < 0 || value > 200) return; + this.setCapabilityValue('measure_battery', value / 2).catch(this.error); + }); + + // All three interviews already advertise/report standard Power1; no + // mandatory PollControl32 actions, vendor DP, or wake-time writes are added. + } +} + +module.exports = StandardIASContact; diff --git a/drivers/contact_sensor_elivco_x8q36xwf/driver.compose.json b/drivers/contact_sensor_elivco_x8q36xwf/driver.compose.json new file mode 100644 index 0000000000..0366c44a4b --- /dev/null +++ b/drivers/contact_sensor_elivco_x8q36xwf/driver.compose.json @@ -0,0 +1,56 @@ +{ + "id": "contact_sensor_elivco_x8q36xwf", + "name": { + "en": "ELIVCO Standard Door & Window Sensor" + }, + "class": "sensor", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "alarm_contact", + "measure_battery", + "alarm_battery" + ], + "energy": { + "batteries": [ + "OTHER" + ] + }, + "images": { + "large": "{{driverAssetsPath}}/images/large.png", + "small": "{{driverAssetsPath}}/images/small.png" + }, + "zigbee": { + "manufacturerName": [ + "_TZ3000_x8q36xwf" + ], + "productId": [ + "TS0203" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 1, + 3, + 32, + 1280 + ], + "bindings": [ + 1, + 1280 + ] + } + }, + "learnmode": { + "image": "{{driverAssetsPath}}/learn.svg", + "instruction": { + "en": "Follow the contact sensor's instructions to enable Zigbee pairing mode." + } + } + } +} diff --git a/drivers/contact_sensor_ewelink_snzb04/assets/icon.svg b/drivers/contact_sensor_ewelink_snzb04/assets/icon.svg new file mode 100644 index 0000000000..00dd60008e --- /dev/null +++ b/drivers/contact_sensor_ewelink_snzb04/assets/icon.svg @@ -0,0 +1,104 @@ + +image/svg+xml + + + + diff --git a/drivers/contact_sensor_ewelink_snzb04/assets/images/large.png b/drivers/contact_sensor_ewelink_snzb04/assets/images/large.png new file mode 100644 index 0000000000..e7cafc94c0 Binary files /dev/null and b/drivers/contact_sensor_ewelink_snzb04/assets/images/large.png differ diff --git a/drivers/contact_sensor_ewelink_snzb04/assets/images/small.png b/drivers/contact_sensor_ewelink_snzb04/assets/images/small.png new file mode 100644 index 0000000000..dd65dd83c1 Binary files /dev/null and b/drivers/contact_sensor_ewelink_snzb04/assets/images/small.png differ diff --git a/drivers/contact_sensor_ewelink_snzb04/assets/learn.svg b/drivers/contact_sensor_ewelink_snzb04/assets/learn.svg new file mode 100644 index 0000000000..a08e0c2531 --- /dev/null +++ b/drivers/contact_sensor_ewelink_snzb04/assets/learn.svg @@ -0,0 +1,195 @@ + +image/svg+xml + + + + diff --git a/drivers/contact_sensor_ewelink_snzb04/device.js b/drivers/contact_sensor_ewelink_snzb04/device.js new file mode 100644 index 0000000000..ff7bfb3add --- /dev/null +++ b/drivers/contact_sensor_ewelink_snzb04/device.js @@ -0,0 +1,4 @@ +'use strict'; + +// Independently exact standard IAS contact identity: eWeLink / SNZB-04 (#1013). +module.exports = require('../contact_sensor_elivco_x8q36xwf/device'); diff --git a/drivers/contact_sensor_ewelink_snzb04/driver.compose.json b/drivers/contact_sensor_ewelink_snzb04/driver.compose.json new file mode 100644 index 0000000000..c597f85a88 --- /dev/null +++ b/drivers/contact_sensor_ewelink_snzb04/driver.compose.json @@ -0,0 +1,56 @@ +{ + "id": "contact_sensor_ewelink_snzb04", + "name": { + "en": "eWeLink SNZB-04 Door & Window Sensor" + }, + "class": "sensor", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "alarm_contact", + "measure_battery", + "alarm_battery" + ], + "energy": { + "batteries": [ + "OTHER" + ] + }, + "images": { + "large": "{{driverAssetsPath}}/images/large.png", + "small": "{{driverAssetsPath}}/images/small.png" + }, + "zigbee": { + "manufacturerName": [ + "eWeLink" + ], + "productId": [ + "SNZB-04" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 1, + 3, + 32, + 1280 + ], + "bindings": [ + 1, + 1280 + ] + } + }, + "learnmode": { + "image": "{{driverAssetsPath}}/learn.svg", + "instruction": { + "en": "Follow the contact sensor's instructions to enable Zigbee pairing mode." + } + } + } +} diff --git a/drivers/contact_sensor_n8dljorx/assets/icon.svg b/drivers/contact_sensor_n8dljorx/assets/icon.svg new file mode 100644 index 0000000000..00dd60008e --- /dev/null +++ b/drivers/contact_sensor_n8dljorx/assets/icon.svg @@ -0,0 +1,104 @@ + +image/svg+xml + + + + diff --git a/drivers/contact_sensor_n8dljorx/assets/images/large.png b/drivers/contact_sensor_n8dljorx/assets/images/large.png new file mode 100644 index 0000000000..e7cafc94c0 Binary files /dev/null and b/drivers/contact_sensor_n8dljorx/assets/images/large.png differ diff --git a/drivers/contact_sensor_n8dljorx/assets/images/small.png b/drivers/contact_sensor_n8dljorx/assets/images/small.png new file mode 100644 index 0000000000..dd65dd83c1 Binary files /dev/null and b/drivers/contact_sensor_n8dljorx/assets/images/small.png differ diff --git a/drivers/contact_sensor_n8dljorx/assets/learn.svg b/drivers/contact_sensor_n8dljorx/assets/learn.svg new file mode 100644 index 0000000000..a08e0c2531 --- /dev/null +++ b/drivers/contact_sensor_n8dljorx/assets/learn.svg @@ -0,0 +1,195 @@ + +image/svg+xml + + + + diff --git a/drivers/contact_sensor_n8dljorx/device.js b/drivers/contact_sensor_n8dljorx/device.js new file mode 100644 index 0000000000..c1c31b1ff3 --- /dev/null +++ b/drivers/contact_sensor_n8dljorx/device.js @@ -0,0 +1,4 @@ +'use strict'; + +// Independently exact standard IAS contact identity: _TZE200_n8dljorx / TS0601 (#868). +module.exports = require('../contact_sensor_elivco_x8q36xwf/device'); diff --git a/drivers/contact_sensor_n8dljorx/driver.compose.json b/drivers/contact_sensor_n8dljorx/driver.compose.json new file mode 100644 index 0000000000..13c653fc38 --- /dev/null +++ b/drivers/contact_sensor_n8dljorx/driver.compose.json @@ -0,0 +1,55 @@ +{ + "id": "contact_sensor_n8dljorx", + "name": { + "en": "TS0601 Standard Door & Window Sensor" + }, + "class": "sensor", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "alarm_contact", + "measure_battery", + "alarm_battery" + ], + "energy": { + "batteries": [ + "CR2032" + ] + }, + "images": { + "large": "{{driverAssetsPath}}/images/large.png", + "small": "{{driverAssetsPath}}/images/small.png" + }, + "zigbee": { + "manufacturerName": [ + "_TZE200_n8dljorx" + ], + "productId": [ + "TS0601" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 1, + 3, + 1280 + ], + "bindings": [ + 1, + 1280 + ] + } + }, + "learnmode": { + "image": "{{driverAssetsPath}}/learn.svg", + "instruction": { + "en": "Follow the contact sensor's instructions to enable Zigbee pairing mode." + } + } + } +} diff --git a/drivers/curtain_module_2_gang/driver.js b/drivers/curtain_module_2_gang/driver.js index b21e252f10..ef38aed883 100644 --- a/drivers/curtain_module_2_gang/driver.js +++ b/drivers/curtain_module_2_gang/driver.js @@ -1,8 +1,8 @@ 'use strict'; -const Homey = require('homey'); +const { ZigBeeDriver } = require('homey-zigbeedriver'); -class CurtainModule2GangDriver extends Homey.Driver { +class CurtainModule2GangDriver extends ZigBeeDriver { async onInit() { this.homey.flow diff --git a/drivers/flood_sensor_unverified_battery/assets/icon.svg b/drivers/flood_sensor_unverified_battery/assets/icon.svg new file mode 100644 index 0000000000..238110df57 --- /dev/null +++ b/drivers/flood_sensor_unverified_battery/assets/icon.svg @@ -0,0 +1,135 @@ + +image/svg+xml + + + + diff --git a/drivers/flood_sensor_unverified_battery/assets/images/large.png b/drivers/flood_sensor_unverified_battery/assets/images/large.png new file mode 100644 index 0000000000..4d965b7356 Binary files /dev/null and b/drivers/flood_sensor_unverified_battery/assets/images/large.png differ diff --git a/drivers/flood_sensor_unverified_battery/assets/images/small.png b/drivers/flood_sensor_unverified_battery/assets/images/small.png new file mode 100644 index 0000000000..9cb75f36eb Binary files /dev/null and b/drivers/flood_sensor_unverified_battery/assets/images/small.png differ diff --git a/drivers/flood_sensor_unverified_battery/device.js b/drivers/flood_sensor_unverified_battery/device.js new file mode 100644 index 0000000000..d1aa0c6970 --- /dev/null +++ b/drivers/flood_sensor_unverified_battery/device.js @@ -0,0 +1,6 @@ +'use strict'; + +// #1041 / #1032 / #952: identical interviewed standard IAS waterSensor layout. +// Reuse the unchanged existing flood_sensor runtime. Battery cell type/count is +// deliberately not inferred from the 3.0 V interview; verify each in public Test. +module.exports = require('../flood_sensor/device'); diff --git a/drivers/flood_sensor_unverified_battery/driver.compose.json b/drivers/flood_sensor_unverified_battery/driver.compose.json new file mode 100644 index 0000000000..7a4a5ff5d4 --- /dev/null +++ b/drivers/flood_sensor_unverified_battery/driver.compose.json @@ -0,0 +1,56 @@ +{ + "id": "flood_sensor_unverified_battery", + "name": { + "en": "Standard Zigbee Water Leak Sensor (battery unverified)" + }, + "class": "sensor", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "alarm_water", + "alarm_battery" + ], + "energy": { + "batteries": [ + "OTHER" + ] + }, + "images": { + "large": "{{driverAssetsPath}}/images/large.png", + "small": "{{driverAssetsPath}}/images/small.png" + }, + "zigbee": { + "manufacturerName": [ + "_TZ3000_bzt33cyu", + "_TZ3000_4qaowtdo", + "_TZ3000_qhozxs2b" + ], + "productId": [ + "TS0207" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 1, + 3, + 1280 + ], + "bindings": [ + 1, + 1280 + ] + } + }, + "learnmode": { + "image": "{{driverAssetsPath}}/icon.svg", + "instruction": { + "en": "Follow the water leak sensor instructions to activate Zigbee pairing mode." + } + } + } +} diff --git a/drivers/motion_lux_hobeian_zg204zl/assets/icon.svg b/drivers/motion_lux_hobeian_zg204zl/assets/icon.svg new file mode 100644 index 0000000000..d245c6363a --- /dev/null +++ b/drivers/motion_lux_hobeian_zg204zl/assets/icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/drivers/motion_lux_hobeian_zg204zl/assets/images/large.png b/drivers/motion_lux_hobeian_zg204zl/assets/images/large.png new file mode 100644 index 0000000000..dfc2131079 Binary files /dev/null and b/drivers/motion_lux_hobeian_zg204zl/assets/images/large.png differ diff --git a/drivers/motion_lux_hobeian_zg204zl/assets/images/small.png b/drivers/motion_lux_hobeian_zg204zl/assets/images/small.png new file mode 100644 index 0000000000..5b07b83d11 Binary files /dev/null and b/drivers/motion_lux_hobeian_zg204zl/assets/images/small.png differ diff --git a/drivers/motion_lux_hobeian_zg204zl/device.js b/drivers/motion_lux_hobeian_zg204zl/device.js new file mode 100644 index 0000000000..e0120a2e95 --- /dev/null +++ b/drivers/motion_lux_hobeian_zg204zl/device.js @@ -0,0 +1,76 @@ +'use strict'; + +// #1481: ONLY standard IAS Zone + Illuminance Measurement + Power Configuration. +// The two exact manufacturer/product profiles are independent of the existing +// EF00-based motion_sensor_2. No Zigbee vendor datapoints are presumed. +const { ZigBeeDevice } = require('homey-zigbeedriver'); +const { CLUSTER } = require('zigbee-clusters'); +const { illuminanceMeasuredValueToLux } = require('../illuminance_sensor/measurements'); + +class StandardMotionIlluminance extends ZigBeeDevice { + async onNodeInit({ zclNode }) { + const ep = zclNode.endpoints[1]; + const ias = ep.clusters[CLUSTER.IAS_ZONE.NAME]; + + // Homey usually handles IAS enrollment itself. Only respond if requested. + ias.onZoneEnrollRequest = () => { + Promise.resolve().then(() => ias.zoneEnrollResponse({ + enrollResponseCode: 0, zoneId: 0, + })).catch(error => this.error('IAS motion enrollment:', error)); + }; + ias.onZoneStatusChangeNotification = ({ zoneStatus } = {}) => { + this.onZoneStatus(zoneStatus); + }; + ias.on('attr.zoneStatus', this.onZoneStatus.bind(this)); + + ep.clusters[CLUSTER.ILLUMINANCE_MEASUREMENT.NAME] + .on('attr.measuredValue', this.onIlluminance.bind(this)); + ep.clusters[CLUSTER.POWER_CONFIGURATION.NAME] + .on('attr.batteryPercentageRemaining', this.onBattery.bind(this)); + + // The devices sleep between events; a rejected optional reporting setup + // must not block subsequent status notifications or a restored app. + if (this.isFirstInit()) { + for (const config of [ + { endpointId: 1, cluster: CLUSTER.ILLUMINANCE_MEASUREMENT, + attributeName: 'measuredValue', minInterval: 30, maxInterval: 3600, + minChange: 100 }, + { endpointId: 1, cluster: CLUSTER.POWER_CONFIGURATION, + attributeName: 'batteryPercentageRemaining', minInterval: 3600, + maxInterval: 21600, minChange: 2 }, + ]) { + await this.configureAttributeReporting([config]) + .catch(error => this.log('Optional IAS motion/lux reporting skipped:', error.message)); + } + } + } + + onZoneStatus(status) { + // Do NOT infer motion clear from an omitted alarm1 in partial IAS reports. + if (typeof status?.alarm1 === 'boolean') { + this.setCapabilityValue('alarm_motion', status.alarm1).catch(this.error); + } + if (typeof status?.battery === 'boolean') { + this.setCapabilityValue('alarm_battery', status.battery).catch(this.error); + } + } + + onIlluminance(value) { + // Standard Zigbee logarithmic encoding; real lux scale is a public Test gate. + if (!Number.isInteger(value) || value < 0 || value > 0xffff) return; + const lux = illuminanceMeasuredValueToLux(value); + if (lux === null || !Number.isFinite(lux)) return; + this.setCapabilityValue('measure_luminance', Math.round(lux * 100) / 100) + .catch(this.error); + } + + onBattery(value) { + // Zigbee batteryPercentageRemaining is in half-percent, 0xff unavailable. + if (!Number.isInteger(value) || value < 0 || value > 200) return; + const percentage = value / 2; + this.setCapabilityValue('measure_battery', percentage).catch(this.error); + this.setCapabilityValue('alarm_battery', percentage < 20).catch(this.error); + } +} + +module.exports = StandardMotionIlluminance; diff --git a/drivers/motion_lux_hobeian_zg204zl/driver.compose.json b/drivers/motion_lux_hobeian_zg204zl/driver.compose.json new file mode 100644 index 0000000000..f4a6d32a97 --- /dev/null +++ b/drivers/motion_lux_hobeian_zg204zl/driver.compose.json @@ -0,0 +1,58 @@ +{ + "id": "motion_lux_hobeian_zg204zl", + "name": { + "en": "HOBEIAN Motion & Illuminance Sensor" + }, + "class": "sensor", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "alarm_motion", + "measure_luminance", + "measure_battery", + "alarm_battery" + ], + "energy": { + "batteries": [ + "OTHER" + ] + }, + "images": { + "large": "{{driverAssetsPath}}/images/large.png", + "small": "{{driverAssetsPath}}/images/small.png" + }, + "zigbee": { + "manufacturerName": [ + "HOBEIAN" + ], + "productId": [ + "ZG-204ZL" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 1, + 3, + 1024, + 1280 + ], + "bindings": [ + 1, + 1024, + 1280 + ] + } + }, + "learnmode": { + "image": "{{driverAssetsPath}}/icon.svg", + "instruction": { + "en": "Follow the sensor instructions to activate Zigbee pairing mode." + } + } + } +} diff --git a/drivers/motion_lux_kb5noeto/assets/icon.svg b/drivers/motion_lux_kb5noeto/assets/icon.svg new file mode 100644 index 0000000000..d245c6363a --- /dev/null +++ b/drivers/motion_lux_kb5noeto/assets/icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/drivers/motion_lux_kb5noeto/assets/images/large.png b/drivers/motion_lux_kb5noeto/assets/images/large.png new file mode 100644 index 0000000000..dfc2131079 Binary files /dev/null and b/drivers/motion_lux_kb5noeto/assets/images/large.png differ diff --git a/drivers/motion_lux_kb5noeto/assets/images/small.png b/drivers/motion_lux_kb5noeto/assets/images/small.png new file mode 100644 index 0000000000..5b07b83d11 Binary files /dev/null and b/drivers/motion_lux_kb5noeto/assets/images/small.png differ diff --git a/drivers/motion_lux_kb5noeto/device.js b/drivers/motion_lux_kb5noeto/device.js new file mode 100644 index 0000000000..ec1fb568a8 --- /dev/null +++ b/drivers/motion_lux_kb5noeto/device.js @@ -0,0 +1,4 @@ +'use strict'; + +// Physical exact _TZE200_kb5noeto / TS0601; standard EP1 only, no EF00. +module.exports = require('../motion_lux_hobeian_zg204zl/device'); diff --git a/drivers/motion_lux_kb5noeto/driver.compose.json b/drivers/motion_lux_kb5noeto/driver.compose.json new file mode 100644 index 0000000000..c961a2c531 --- /dev/null +++ b/drivers/motion_lux_kb5noeto/driver.compose.json @@ -0,0 +1,58 @@ +{ + "id": "motion_lux_kb5noeto", + "name": { + "en": "Standard Motion & Illuminance Sensor" + }, + "class": "sensor", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "alarm_motion", + "measure_luminance", + "measure_battery", + "alarm_battery" + ], + "energy": { + "batteries": [ + "OTHER" + ] + }, + "images": { + "large": "{{driverAssetsPath}}/images/large.png", + "small": "{{driverAssetsPath}}/images/small.png" + }, + "zigbee": { + "manufacturerName": [ + "_TZE200_kb5noeto" + ], + "productId": [ + "TS0601" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 1, + 3, + 1024, + 1280 + ], + "bindings": [ + 1, + 1024, + 1280 + ] + } + }, + "learnmode": { + "image": "{{driverAssetsPath}}/icon.svg", + "instruction": { + "en": "Follow the sensor instructions to activate Zigbee pairing mode." + } + } + } +} diff --git a/drivers/rain_sensor_mowe/assets/icon.svg b/drivers/rain_sensor_mowe/assets/icon.svg new file mode 100644 index 0000000000..238110df57 --- /dev/null +++ b/drivers/rain_sensor_mowe/assets/icon.svg @@ -0,0 +1,135 @@ + +image/svg+xml + + + + diff --git a/drivers/rain_sensor_mowe/assets/images/large.png b/drivers/rain_sensor_mowe/assets/images/large.png new file mode 100644 index 0000000000..4d965b7356 Binary files /dev/null and b/drivers/rain_sensor_mowe/assets/images/large.png differ diff --git a/drivers/rain_sensor_mowe/assets/images/small.png b/drivers/rain_sensor_mowe/assets/images/small.png new file mode 100644 index 0000000000..9cb75f36eb Binary files /dev/null and b/drivers/rain_sensor_mowe/assets/images/small.png differ diff --git a/drivers/rain_sensor_mowe/device.js b/drivers/rain_sensor_mowe/device.js new file mode 100644 index 0000000000..fe2d3b6ae3 --- /dev/null +++ b/drivers/rain_sensor_mowe/device.js @@ -0,0 +1,42 @@ +'use strict'; + +// #1288 / original physical interview #473: MOWE MW815R is standard IAS rain, +// not the solar RB-SRAIN01 EF00/DP105 rain sensor. +const { ZigBeeDevice } = require('homey-zigbeedriver'); +const { CLUSTER } = require('zigbee-clusters'); + +class MoweRainSensor extends ZigBeeDevice { + async onNodeInit({ zclNode }) { + const endpoint = zclNode.endpoints[1]; + const iasZone = endpoint.clusters[CLUSTER.IAS_ZONE.NAME]; + + // Homey >=13.1.2 enrolls IAS Zone automatically when cluster 1280 is + // declared in the manifest. This callback is a compatibility fallback + // for older Homey firmware that still forwards Zone Enroll Requests. + // Never poll this sleepy end device on startup. + iasZone.onZoneEnrollRequest = () => { + Promise.resolve(iasZone.zoneEnrollResponse({ enrollResponseCode: 0, zoneId: 0 })) + .catch(error => this.error('MOWE IAS enrollment response failed:', error)); + }; + + iasZone.onZoneStatusChangeNotification = ({ zoneStatus }) => { + if (typeof zoneStatus?.alarm1 === 'boolean') { + this.setCapabilityValue('alarm_water', zoneStatus.alarm1).catch(this.error); + } + if (typeof zoneStatus?.battery === 'boolean') { + this.setCapabilityValue('alarm_battery', zoneStatus.battery).catch(this.error); + } + }; + + // Standard ZCL battery percentage is encoded in half-percent units; + // 0xff and other invalid/unavailable samples must not overwrite Homey. + endpoint.clusters[CLUSTER.POWER_CONFIGURATION.NAME] + .on('attr.batteryPercentageRemaining', value => { + if (Number.isInteger(value) && value >= 0 && value <= 200) { + this.setCapabilityValue('measure_battery', value / 2).catch(this.error); + } + }); + } +} + +module.exports = MoweRainSensor; diff --git a/drivers/rain_sensor_mowe/driver.compose.json b/drivers/rain_sensor_mowe/driver.compose.json new file mode 100644 index 0000000000..e7e4ae9de0 --- /dev/null +++ b/drivers/rain_sensor_mowe/driver.compose.json @@ -0,0 +1,55 @@ +{ + "id": "rain_sensor_mowe", + "name": { + "en": "MOWE MW815R Rain Sensor (IAS)" + }, + "class": "sensor", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "alarm_water", + "measure_battery", + "alarm_battery" + ], + "energy": { + "batteries": [ + "OTHER" + ] + }, + "images": { + "large": "{{driverAssetsPath}}/images/large.png", + "small": "{{driverAssetsPath}}/images/small.png" + }, + "zigbee": { + "manufacturerName": [ + "_TZ3000_o9f2zqln" + ], + "productId": [ + "TS0207" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 1, + 3, + 1280 + ], + "bindings": [ + 1, + 1280 + ] + } + }, + "learnmode": { + "image": "{{driverAssetsPath}}/icon.svg", + "instruction": { + "en": "Follow the MW815R instructions to activate Zigbee pairing mode." + } + } + } +} diff --git a/drivers/sirentemphumidsensor/device.js b/drivers/sirentemphumidsensor/device.js index eebbd64f48..a0f9ebedb5 100644 --- a/drivers/sirentemphumidsensor/device.js +++ b/drivers/sirentemphumidsensor/device.js @@ -3,6 +3,7 @@ const { Cluster, BoundCluster } = require('zigbee-clusters'); const TuyaSpecificCluster = require('../../lib/TuyaSpecificCluster'); const TuyaSpecificClusterDevice = require('../../lib/TuyaSpecificClusterDevice'); +const { isDeviceUnreachableError } = require('../../lib/util'); Cluster.addCluster(TuyaSpecificCluster); @@ -256,74 +257,72 @@ class sensortemphumidsensor extends TuyaSpecificClusterDevice { } async bootstrap() { - await this.bootstrapBasicRead(); - await this.forceCelsiusMode(); - await this.sendMcuVersionRequest(); - await this.queryAll(); + const steps = [ + ['basic read', () => this.bootstrapBasicRead()], + ['set Celsius mode', () => this.forceCelsiusMode()], + ['MCU version request', () => this.sendMcuVersionRequest()], + ['data query', () => this.queryAll()], + ]; + + for (const [label, run] of steps) { + try { + await run(); + } catch (error) { + if (isDeviceUnreachableError(error)) { + this.log(`Device unreachable during startup (${label}); skipping remaining bootstrap commands`); + return; + } + this.error(`Bootstrap ${label} failed`, error); + } + } } async bootstrapBasicRead() { - try { - const basicCluster = this.zclNode?.endpoints?.[1]?.clusters?.basic; - if (!basicCluster) return; + const basicCluster = this.zclNode?.endpoints?.[1]?.clusters?.basic; + if (!basicCluster) return; - this.log('Bootstrap read: basic cluster'); + this.log('Bootstrap read: basic cluster'); - const result = await basicCluster.readAttributes([ - 'manufacturerName', - 'zclVersion', - 'appVersion', - 'modelId', - 'powerSource', - 'attributeReportingStatus', - ]); + const result = await basicCluster.readAttributes([ + 'manufacturerName', + 'zclVersion', + 'appVersion', + 'modelId', + 'powerSource', + 'attributeReportingStatus', + ]); - this.log('Bootstrap read result:', result); - } catch (error) { - this.error('Bootstrap read failed', error); - } + this.log('Bootstrap read result:', result); } async forceCelsiusMode() { - try { - this.log('Setting Tuya temperature unit DP 0x70 => Celsius'); - await this.writeBool(dataPoints.TEMP_UNIT, true); - } catch (error) { - this.error('Failed to set Celsius mode', error); - } + this.log('Setting Tuya temperature unit DP 0x70 => Celsius'); + await this.writeBool(dataPoints.TEMP_UNIT, true); } async sendMcuVersionRequest() { - try { - const tuyaCluster = this.zclNode?.endpoints?.[1]?.clusters?.tuya; - if (!tuyaCluster || typeof tuyaCluster.mcuVersionRequest !== 'function') { - this.log('Tuya mcuVersionRequest not available'); - return; - } + const tuyaCluster = this.zclNode?.endpoints?.[1]?.clusters?.tuya; + if (!tuyaCluster || typeof tuyaCluster.mcuVersionRequest !== 'function') { + this.log('Tuya mcuVersionRequest not available'); + return; + } - const payload = Buffer.from([0x00, this.transactionID & 0xff]); - this.transactionID += 1; + const payload = Buffer.from([0x00, this.transactionID & 0xff]); + this.transactionID += 1; - this.log('Sending Tuya mcuVersionRequest (0x10), payload=', payload); - await tuyaCluster.mcuVersionRequest({ payload }); - } catch (error) { - this.error('Failed to send Tuya mcuVersionRequest', error); - } + this.log('Sending Tuya mcuVersionRequest (0x10), payload=', payload); + await tuyaCluster.mcuVersionRequest({ payload }); } async queryAll() { - try { - const tuyaCluster = this.zclNode?.endpoints?.[1]?.clusters?.tuya; - if (!tuyaCluster || typeof tuyaCluster.dataQuery !== 'function') { - this.log('Tuya dataQuery not available'); - return; - } - - this.log('Sending Tuya dataQuery (0x03)'); - await tuyaCluster.dataQuery({}); - } catch (error) { - this.error('Failed to send Tuya dataQuery', error); + const tuyaCluster = this.zclNode?.endpoints?.[1]?.clusters?.tuya; + if (!tuyaCluster || typeof tuyaCluster.dataQuery !== 'function') { + this.log('Tuya dataQuery not available'); + return; } + + this.log('Sending Tuya dataQuery (0x03)'); + await tuyaCluster.dataQuery({}); } async onTuyaTimeSync(data) { diff --git a/drivers/smartPlug_DinRail/device.js b/drivers/smartPlug_DinRail/device.js index 72bacecc55..4b49c087e0 100644 --- a/drivers/smartPlug_DinRail/device.js +++ b/drivers/smartPlug_DinRail/device.js @@ -3,6 +3,7 @@ const { ZigBeeDevice } = require('homey-zigbeedriver'); const { CLUSTER, Cluster, ZCLDataTypes} = require('zigbee-clusters'); const TuyaOnOffCluster = require('../../lib/TuyaOnOffCluster'); +const { syncTuyaRelayStatus, writeTuyaRelayStatus } = require('../../lib/TuyaRelayStatus'); Cluster.addCluster(TuyaOnOffCluster); @@ -59,20 +60,23 @@ class smartplug extends ZigBeeDevice { // Changed Cluster.readAttributes signature, attributes must now be specified as an array of strings. // zclNode.endpoints[1].clusters.windowCovering.readAttributes(["motorReversal", "ANY OTHER IF NEEDED"]); - try { - const relayStatus = await this.zclNode.endpoints[1].clusters.onOff.readAttributes(['relayStatus']); - const childLock = await this.zclNode.endpoints[1].clusters.onOff.readAttributes(['childLock']); - const indicatorMode = await this.zclNode.endpoints[1].clusters.onOff.readAttributes(['indicatorMode']); - - this.log("Relay Status supported by device"); + const onOffCluster = this.zclNode.endpoints[1]?.clusters?.onOff; + await syncTuyaRelayStatus(this, onOffCluster); + // Optional settings must not suppress relayStatus when unsupported. + try { + const childLock = await onOffCluster.readAttributes(['childLock']); + await this.setSettings({ child_lock: childLock.childLock ? '1' : '0' }); + } catch (error) { + this.log('Tuya childLock not available:', error.message); + } + try { + const indicatorMode = await onOffCluster.readAttributes(['indicatorMode']); await this.setSettings({ - relay_status : ZCLDataTypes.enum8RelayStatus.args[0][relayStatus.relayStatus].toString(), indicator_mode: ZCLDataTypes.enum8IndicatorMode.args[0][indicatorMode.indicatorMode].toString(), - child_lock: childLock.childLock ? "1" : "0", }); } catch (error) { - this.log("This device does not support Relay Control", error); + this.log('Tuya indicatorMode not available:', error.message); } // meter_power @@ -135,8 +139,7 @@ class smartplug extends ZigBeeDevice { let parsedValue = 0; if (changedKeys.includes('relay_status')) { - parsedValue = parseInt(newSettings.relay_status); - await this.zclNode.endpoints[1].clusters.onOff.writeAttributes({ relayStatus: parsedValue }); + await writeTuyaRelayStatus(this.zclNode.endpoints[1]?.clusters?.onOff, newSettings.relay_status); } if (changedKeys.includes('indicator_mode')) { diff --git a/drivers/smart_knob_switch/device.js b/drivers/smart_knob_switch/device.js index dc98c925ff..03804baae3 100644 --- a/drivers/smart_knob_switch/device.js +++ b/drivers/smart_knob_switch/device.js @@ -16,7 +16,11 @@ class SmartKnobSwitch extends ZigBeeDevice { const triggerPress = source => this.triggerButton('press', source); const triggerRotation = (payload, source) => { - const mode = payload?.mode; + // zigbee-clusters 2.4.1 uses mode for step, moveMode for move. + const mode = (source === 'move' || source === 'moveWithOnOff') + ? payload?.moveMode : payload?.mode; + // Unknown/malformed frames must not be interpreted as clockwise. + if (mode !== 'up' && mode !== 'down') return Promise.resolve(); const button = mode === 'down' ? 'left' : 'right'; return this.triggerButton(button, source); }; @@ -46,13 +50,37 @@ class SmartKnobSwitch extends ZigBeeDevice { // We do not have enough physical frame evidence yet to replace the // hold-left/hold-right interpretation safely. const node = await this.homey.zigbee.getNode(this); - node.handleFrame = (endpointId, clusterId, frame) => { - if (clusterId !== CLUSTER.COLOR_CONTROL.ID) return; + const zclHandleFrame = node.handleFrame; + + // ZCLNode owns node.handleFrame. Preserve it for all normal cluster + // processing and intercept only the legacy raw Color Control path. + node.handleFrame = (endpointId, clusterId, frame, meta) => { + // This TS004F family can emit proprietary On/Off commands in Scene Mode: + // 0xFC = rotation (0 right, 1 left); 0xFD = click (0/1/2). + // Stock OnOffCluster does not define either command. Decode only these + // exact legacy four-byte frames; preserve ZCL dispatch for everything else. + if (clusterId === CLUSTER.ON_OFF.ID) { + const bytes = frame.toJSON()?.data; + if ((Array.isArray(bytes) || Buffer.isBuffer(bytes)) && bytes.length === 4) { + const command = bytes[2]; + const action = bytes[3]; + if (command === 0xFC && (action === 0 || action === 1)) { + return this.triggerButton(action === 1 ? 'left' : 'right', 'tuyaSceneRotation'); + } + if (command === 0xFD && (action === 0 || action === 1 || action === 2)) { + // Preserve the existing single press Flow contract for now. + return this.triggerButton('press', 'tuyaScenePress'); + } + } + } + if (clusterId !== CLUSTER.COLOR_CONTROL.ID) { + return zclHandleFrame(endpointId, clusterId, frame, meta); + } const parsedFrame = frame.toJSON(); const left = parsedFrame.data?.[3] === 3; const button = `hold-${left ? 'left' : 'right'}`; - this.triggerButton(button, 'colorControlLegacy'); + return this.triggerButton(button, 'colorControlLegacy'); }; } diff --git a/drivers/smartplug/device.js b/drivers/smartplug/device.js index 1e3ccc2944..042b61b35f 100644 --- a/drivers/smartplug/device.js +++ b/drivers/smartplug/device.js @@ -3,6 +3,7 @@ const { ZigBeeDevice } = require('homey-zigbeedriver'); const { CLUSTER, Cluster, ZCLDataTypes} = require('zigbee-clusters'); const TuyaOnOffCluster = require('../../lib/TuyaOnOffCluster'); +const { syncTuyaRelayStatus, writeTuyaRelayStatus } = require('../../lib/TuyaRelayStatus'); Cluster.addCluster(TuyaOnOffCluster); @@ -53,20 +54,23 @@ class smartplug extends ZigBeeDevice { this.log("Metering Factor: ", this.meteringFactor); } */ - try { - const relayStatus = await this.zclNode.endpoints[1].clusters.onOff.readAttributes(['relayStatus']); - const childLock = await this.zclNode.endpoints[1].clusters.onOff.readAttributes(['childLock']); - const indicatorMode = await this.zclNode.endpoints[1].clusters.onOff.readAttributes(['indicatorMode']); - - this.log("Relay Status supported by device"); + const onOffCluster = this.zclNode.endpoints[1]?.clusters?.onOff; + await syncTuyaRelayStatus(this, onOffCluster); + // Optional settings must not suppress relayStatus when unsupported. + try { + const childLock = await onOffCluster.readAttributes(['childLock']); + await this.setSettings({ child_lock: childLock.childLock ? '1' : '0' }); + } catch (error) { + this.log('Tuya childLock not available:', error.message); + } + try { + const indicatorMode = await onOffCluster.readAttributes(['indicatorMode']); await this.setSettings({ - relay_status : ZCLDataTypes.enum8RelayStatus.args[0][relayStatus.relayStatus].toString(), indicator_mode: ZCLDataTypes.enum8IndicatorMode.args[0][indicatorMode.indicatorMode].toString(), - child_lock: childLock.childLock ? "1" : "0", }); } catch (error) { - this.log("This device does not support Relay Control", error); + this.log('Tuya indicatorMode not available:', error.message); } // meter_power @@ -129,8 +133,7 @@ class smartplug extends ZigBeeDevice { let parsedValue = 0; if (changedKeys.includes('relay_status')) { - parsedValue = parseInt(newSettings.relay_status); - await this.zclNode.endpoints[1].clusters.onOff.writeAttributes({ relayStatus: parsedValue }); + await writeTuyaRelayStatus(this.zclNode.endpoints[1]?.clusters?.onOff, newSettings.relay_status); } if (changedKeys.includes('indicator_mode')) { diff --git a/drivers/smartplug_2_socket/device.js b/drivers/smartplug_2_socket/device.js index a554a0de07..d238b6aa48 100644 --- a/drivers/smartplug_2_socket/device.js +++ b/drivers/smartplug_2_socket/device.js @@ -3,6 +3,7 @@ const { ZigBeeDevice } = require('homey-zigbeedriver'); const { CLUSTER, Cluster, ZCLDataTypes} = require('zigbee-clusters'); const TuyaOnOffCluster = require('../../lib/TuyaOnOffCluster'); +const { syncTuyaRelayStatus, writeTuyaRelayStatus } = require('../../lib/TuyaRelayStatus'); Cluster.addCluster(TuyaOnOffCluster); @@ -29,20 +30,23 @@ class smartplug_2_socket extends ZigBeeDevice { this.minReportCurrent = this.getSetting('minReportCurrent') * 1000; this.minReportVoltage = this.getSetting('minReportVoltage') * 1000; - try { - const relayStatus = await this.zclNode.endpoints[1].clusters.onOff.readAttributes(['relayStatus']); - const childLock = await this.zclNode.endpoints[1].clusters.onOff.readAttributes(['childLock']); - const indicatorMode = await this.zclNode.endpoints[1].clusters.onOff.readAttributes(['indicatorMode']); - - this.log("Relay Status supported by device"); + const onOffCluster = this.zclNode.endpoints[1]?.clusters?.onOff; + await syncTuyaRelayStatus(this, onOffCluster); + // Optional settings must not suppress relayStatus when unsupported. + try { + const childLock = await onOffCluster.readAttributes(['childLock']); + await this.setSettings({ child_lock: childLock.childLock ? '1' : '0' }); + } catch (error) { + this.log('Tuya childLock not available:', error.message); + } + try { + const indicatorMode = await onOffCluster.readAttributes(['indicatorMode']); await this.setSettings({ - relay_status : ZCLDataTypes.enum8RelayStatus.args[0][relayStatus.relayStatus].toString(), indicator_mode: ZCLDataTypes.enum8IndicatorMode.args[0][indicatorMode.indicatorMode].toString(), - child_lock: childLock.childLock ? "1" : "0", }); } catch (error) { - this.log("This device does not support Relay Control", error); + this.log('Tuya indicatorMode not available:', error.message); } if (!this.hasCapability('measure_current')) { @@ -112,8 +116,7 @@ class smartplug_2_socket extends ZigBeeDevice { let parsedValue = 0; if (changedKeys.includes('relay_status')) { - parsedValue = parseInt(newSettings.relay_status); - await this.zclNode.endpoints[1].clusters.onOff.writeAttributes({ relayStatus: parsedValue }); + await writeTuyaRelayStatus(this.zclNode.endpoints[1]?.clusters?.onOff, newSettings.relay_status); } if (changedKeys.includes('indicator_mode')) { diff --git a/drivers/switch_1_gang_bseed_ts0001/assets/icon.svg b/drivers/switch_1_gang_bseed_ts0001/assets/icon.svg new file mode 100644 index 0000000000..f3bb1daaca --- /dev/null +++ b/drivers/switch_1_gang_bseed_ts0001/assets/icon.svg @@ -0,0 +1,211 @@ + +image/svg+xml + + + +1 Gang Zigbee Switch ModuleWith NeutralN L L1L1S1S1 diff --git a/drivers/switch_1_gang_bseed_ts0001/assets/images/large.png b/drivers/switch_1_gang_bseed_ts0001/assets/images/large.png new file mode 100644 index 0000000000..8fceb545d7 Binary files /dev/null and b/drivers/switch_1_gang_bseed_ts0001/assets/images/large.png differ diff --git a/drivers/switch_1_gang_bseed_ts0001/assets/images/small.png b/drivers/switch_1_gang_bseed_ts0001/assets/images/small.png new file mode 100644 index 0000000000..2a2a3beb98 Binary files /dev/null and b/drivers/switch_1_gang_bseed_ts0001/assets/images/small.png differ diff --git a/drivers/switch_1_gang_bseed_ts0001/device.js b/drivers/switch_1_gang_bseed_ts0001/device.js new file mode 100644 index 0000000000..b1079a5992 --- /dev/null +++ b/drivers/switch_1_gang_bseed_ts0001/device.js @@ -0,0 +1,14 @@ +'use strict'; + +const { ZigBeeDevice } = require('homey-zigbeedriver'); +const { CLUSTER } = require('zigbee-clusters'); + +// Exact physical interview #1339: one standard OnOff relay on EP1. +// No unverified E000/E001 commands or startup power-state writes. +class BseedTs0001Device extends ZigBeeDevice { + async onNodeInit() { + this.registerCapability('onoff', CLUSTER.ON_OFF, { endpoint: 1 }); + } +} + +module.exports = BseedTs0001Device; diff --git a/drivers/switch_1_gang_bseed_ts0001/driver.compose.json b/drivers/switch_1_gang_bseed_ts0001/driver.compose.json new file mode 100644 index 0000000000..cdd4761700 --- /dev/null +++ b/drivers/switch_1_gang_bseed_ts0001/driver.compose.json @@ -0,0 +1,53 @@ +{ + "id": "switch_1_gang_bseed_ts0001", + "name": { + "en": "BSEED TS0001 Single-Channel Wall Switch" + }, + "class": "socket", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "onoff" + ], + "images": { + "large": "{{driverAssetsPath}}/images/large.png", + "small": "{{driverAssetsPath}}/images/small.png" + }, + "energy": { + "approximation": { + "usageOn": 0, + "usageOff": 0 + } + }, + "zigbee": { + "manufacturerName": [ + "_TZ3000_blhvsaqf" + ], + "productId": [ + "TS0001" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 4, + 5, + 6 + ], + "bindings": [ + 6 + ] + } + }, + "learnmode": { + "image": "{{driverAssetsPath}}/icon.svg", + "instruction": { + "en": "One Homey tile will be created for this BSEED neutral wall switch. Follow the physical device's instructions to enter Zigbee pairing mode." + } + } + } +} diff --git a/drivers/switch_1_gang_bseed_ts0001/driver.js b/drivers/switch_1_gang_bseed_ts0001/driver.js new file mode 100644 index 0000000000..83a56574e7 --- /dev/null +++ b/drivers/switch_1_gang_bseed_ts0001/driver.js @@ -0,0 +1,7 @@ +'use strict'; + +const { ZigBeeDriver } = require('homey-zigbeedriver'); + +class BseedTs0001Driver extends ZigBeeDriver {} + +module.exports = BseedTs0001Driver; diff --git a/drivers/switch_1_gang_ts0001/assets/icon.svg b/drivers/switch_1_gang_ts0001/assets/icon.svg new file mode 100644 index 0000000000..f3bb1daaca --- /dev/null +++ b/drivers/switch_1_gang_ts0001/assets/icon.svg @@ -0,0 +1,211 @@ + +image/svg+xml + + + +1 Gang Zigbee Switch ModuleWith NeutralN L L1L1S1S1 diff --git a/drivers/switch_1_gang_ts0001/assets/images/large.png b/drivers/switch_1_gang_ts0001/assets/images/large.png new file mode 100644 index 0000000000..8fceb545d7 Binary files /dev/null and b/drivers/switch_1_gang_ts0001/assets/images/large.png differ diff --git a/drivers/switch_1_gang_ts0001/assets/images/small.png b/drivers/switch_1_gang_ts0001/assets/images/small.png new file mode 100644 index 0000000000..2a2a3beb98 Binary files /dev/null and b/drivers/switch_1_gang_ts0001/assets/images/small.png differ diff --git a/drivers/switch_1_gang_ts0001/device.js b/drivers/switch_1_gang_ts0001/device.js new file mode 100644 index 0000000000..35dcc7e9a9 --- /dev/null +++ b/drivers/switch_1_gang_ts0001/device.js @@ -0,0 +1,14 @@ +'use strict'; + +const { ZigBeeDevice } = require('homey-zigbeedriver'); +const { CLUSTER } = require('zigbee-clusters'); + +// Only the standard EP1 OnOff common to the actual interviews (#1366, #1172, +// #1395, #674). No unverified relay power-on, switch-mode or vendor writes. +class Ts0001SingleGangDevice extends ZigBeeDevice { + async onNodeInit() { + this.registerCapability('onoff', CLUSTER.ON_OFF, { endpoint: 1 }); + } +} + +module.exports = Ts0001SingleGangDevice; diff --git a/drivers/switch_1_gang_ts0001/driver.compose.json b/drivers/switch_1_gang_ts0001/driver.compose.json new file mode 100644 index 0000000000..10f999be81 --- /dev/null +++ b/drivers/switch_1_gang_ts0001/driver.compose.json @@ -0,0 +1,56 @@ +{ + "id": "switch_1_gang_ts0001", + "name": { + "en": "TS0001 Single-Channel On/Off Switch" + }, + "class": "socket", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "onoff" + ], + "images": { + "large": "{{driverAssetsPath}}/images/large.png", + "small": "{{driverAssetsPath}}/images/small.png" + }, + "energy": { + "approximation": { + "usageOn": 0, + "usageOff": 0 + } + }, + "zigbee": { + "manufacturerName": [ + "_TZ3000_0t4zjtia", + "_TZ3000_p26flek3", + "_TZ3000_hyarhbyx", + "_TZ3000_y4che4dc" + ], + "productId": [ + "TS0001" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 4, + 5, + 6 + ], + "bindings": [ + 6 + ] + } + }, + "learnmode": { + "image": "{{driverAssetsPath}}/icon.svg", + "instruction": { + "en": "One Homey tile will be created for this exact TS0001 one-channel switch. Follow the physical device's pairing instructions." + } + } + } +} diff --git a/drivers/switch_1_gang_ts0001/driver.js b/drivers/switch_1_gang_ts0001/driver.js new file mode 100644 index 0000000000..6b6a87468e --- /dev/null +++ b/drivers/switch_1_gang_ts0001/driver.js @@ -0,0 +1,8 @@ +'use strict'; + +const { ZigBeeDriver } = require('homey-zigbeedriver'); + +// Exact-identity pairing for independently interviewed TS0001 relays. +class Ts0001SingleGangDriver extends ZigBeeDriver {} + +module.exports = Ts0001SingleGangDriver; diff --git a/drivers/switch_2_gang_ts0002/assets/icon.svg b/drivers/switch_2_gang_ts0002/assets/icon.svg new file mode 100644 index 0000000000..28dda9934d --- /dev/null +++ b/drivers/switch_2_gang_ts0002/assets/icon.svg @@ -0,0 +1,211 @@ + +image/svg+xml + + + +2 Gang Zigbee Switch ModuleWith NeutralN L S1L1S2L2 diff --git a/drivers/switch_2_gang_ts0002/assets/images/large.png b/drivers/switch_2_gang_ts0002/assets/images/large.png new file mode 100644 index 0000000000..0236af8591 Binary files /dev/null and b/drivers/switch_2_gang_ts0002/assets/images/large.png differ diff --git a/drivers/switch_2_gang_ts0002/assets/images/small.png b/drivers/switch_2_gang_ts0002/assets/images/small.png new file mode 100644 index 0000000000..7916941d6b Binary files /dev/null and b/drivers/switch_2_gang_ts0002/assets/images/small.png differ diff --git a/drivers/switch_2_gang_ts0002/device.js b/drivers/switch_2_gang_ts0002/device.js new file mode 100644 index 0000000000..3e56398bde --- /dev/null +++ b/drivers/switch_2_gang_ts0002/device.js @@ -0,0 +1,5 @@ +'use strict'; + +// Six exact TS0002 identities share the existing dual-endpoint standard OnOff runtime. +// E000/E001 cluster layouts differ but need no manufacturer-specific writes for basic switching. +module.exports = require('../switch_2_gang/device'); diff --git a/drivers/switch_2_gang_ts0002/driver.compose.json b/drivers/switch_2_gang_ts0002/driver.compose.json new file mode 100644 index 0000000000..7b7b8cd355 --- /dev/null +++ b/drivers/switch_2_gang_ts0002/driver.compose.json @@ -0,0 +1,85 @@ +{ + "id": "switch_2_gang_ts0002", + "name": { + "en": "TS0002 Two-Channel On/Off Switch" + }, + "class": "socket", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "onoff" + ], + "images": { + "large": "{{driverAssetsPath}}/images/large.png", + "small": "{{driverAssetsPath}}/images/small.png" + }, + "energy": { + "approximation": { + "usageOn": 0, + "usageOff": 0 + } + }, + "zigbee": { + "manufacturerName": [ + "_TZ3000_lugaswf8", + "_TZ3000_zxrfobzw", + "_TZ3000_ptjcjise", + "_TZ3000_rmiew70n", + "_TZ3000_pgcclddi", + "_TZ3000_l9brjwau" + ], + "productId": [ + "TS0002" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 4, + 5, + 6 + ], + "bindings": [ + 6 + ] + }, + "2": { + "clusters": [ + 4, + 5, + 6 + ], + "bindings": [ + 6 + ] + } + }, + "devices": { + "secondSwitch": { + "class": "socket", + "capabilities": [ + "onoff" + ], + "name": { + "en": "TS0002 Switch - Channel 2" + }, + "energy": { + "approximation": { + "usageOn": 0, + "usageOff": 0 + } + } + } + }, + "learnmode": { + "image": "{{driverAssetsPath}}/icon.svg", + "instruction": { + "en": "Two tiles will be created, one for each channel. Follow the device's instructions to enter Zigbee pairing mode." + } + } + } +} diff --git a/drivers/switch_2_gang_ts0002/driver.js b/drivers/switch_2_gang_ts0002/driver.js new file mode 100644 index 0000000000..0477273138 --- /dev/null +++ b/drivers/switch_2_gang_ts0002/driver.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('../switch_2_gang/driver'); diff --git a/drivers/switch_3_gang_ts0003/assets/icon.svg b/drivers/switch_3_gang_ts0003/assets/icon.svg new file mode 100644 index 0000000000..0dd9a03f0c --- /dev/null +++ b/drivers/switch_3_gang_ts0003/assets/icon.svg @@ -0,0 +1,216 @@ + +image/svg+xml + + + +3 GangZigbee Switch ModuleS1S2S3L2 L1 L L3 N com diff --git a/drivers/switch_3_gang_ts0003/assets/images/large.png b/drivers/switch_3_gang_ts0003/assets/images/large.png new file mode 100644 index 0000000000..3869aceda1 Binary files /dev/null and b/drivers/switch_3_gang_ts0003/assets/images/large.png differ diff --git a/drivers/switch_3_gang_ts0003/assets/images/small.png b/drivers/switch_3_gang_ts0003/assets/images/small.png new file mode 100644 index 0000000000..4eb19a814a Binary files /dev/null and b/drivers/switch_3_gang_ts0003/assets/images/small.png differ diff --git a/drivers/switch_3_gang_ts0003/device.js b/drivers/switch_3_gang_ts0003/device.js new file mode 100644 index 0000000000..8d92e4f919 --- /dev/null +++ b/drivers/switch_3_gang_ts0003/device.js @@ -0,0 +1,5 @@ +'use strict'; + +// Four exact TS0003 identities (#795, #1353, #1338, #1500) share three standard OnOff endpoints. +// Reuse the existing three-gang implementation; do not add E000/E001 writes. +module.exports = require('../switch_3_gang/device'); diff --git a/drivers/switch_3_gang_ts0003/driver.compose.json b/drivers/switch_3_gang_ts0003/driver.compose.json new file mode 100644 index 0000000000..3451c505d8 --- /dev/null +++ b/drivers/switch_3_gang_ts0003/driver.compose.json @@ -0,0 +1,108 @@ +{ + "id": "switch_3_gang_ts0003", + "name": { + "en": "TS0003 Three-Channel Wall Switch" + }, + "class": "socket", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "onoff" + ], + "images": { + "large": "{{driverAssetsPath}}/images/large.png", + "small": "{{driverAssetsPath}}/images/small.png" + }, + "energy": { + "approximation": { + "usageOn": 0, + "usageOff": 0 + } + }, + "zigbee": { + "manufacturerName": [ + "_TZ3000_lmcp6b0a", + "_TZ3000_v4l4b0lp", + "_TZ3000_qkixdnon", + "_TZ3000_iol4bl2y" + ], + "productId": [ + "TS0003" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 4, + 5, + 6 + ], + "bindings": [ + 6 + ] + }, + "2": { + "clusters": [ + 4, + 5, + 6 + ], + "bindings": [ + 6 + ] + }, + "3": { + "clusters": [ + 4, + 5, + 6 + ], + "bindings": [ + 6 + ] + } + }, + "devices": { + "secondSwitch": { + "class": "socket", + "capabilities": [ + "onoff" + ], + "name": { + "en": "TS0003 Switch - Channel 2" + }, + "energy": { + "approximation": { + "usageOn": 0, + "usageOff": 0 + } + } + }, + "thirdSwitch": { + "class": "socket", + "capabilities": [ + "onoff" + ], + "name": { + "en": "TS0003 Switch - Channel 3" + }, + "energy": { + "approximation": { + "usageOn": 0, + "usageOff": 0 + } + } + } + }, + "learnmode": { + "image": "{{driverAssetsPath}}/icon.svg", + "instruction": { + "en": "Three separate Homey tiles will be created, one for each channel. Follow the physical switch's instructions to enable Zigbee pairing." + } + } + } +} diff --git a/drivers/switch_3_gang_ts0003/driver.js b/drivers/switch_3_gang_ts0003/driver.js new file mode 100644 index 0000000000..d29e86c243 --- /dev/null +++ b/drivers/switch_3_gang_ts0003/driver.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('../switch_3_gang/driver'); diff --git a/drivers/switch_4_gang_bseed_ts0726/assets/icon.svg b/drivers/switch_4_gang_bseed_ts0726/assets/icon.svg new file mode 100644 index 0000000000..ea09d92c45 --- /dev/null +++ b/drivers/switch_4_gang_bseed_ts0726/assets/icon.svg @@ -0,0 +1,777 @@ + +image/svg+xml + + + + diff --git a/drivers/switch_4_gang_bseed_ts0726/assets/images/large.png b/drivers/switch_4_gang_bseed_ts0726/assets/images/large.png new file mode 100644 index 0000000000..83d9bb8449 Binary files /dev/null and b/drivers/switch_4_gang_bseed_ts0726/assets/images/large.png differ diff --git a/drivers/switch_4_gang_bseed_ts0726/assets/images/small.png b/drivers/switch_4_gang_bseed_ts0726/assets/images/small.png new file mode 100644 index 0000000000..9d92ffb62c Binary files /dev/null and b/drivers/switch_4_gang_bseed_ts0726/assets/images/small.png differ diff --git a/drivers/switch_4_gang_bseed_ts0726/device.js b/drivers/switch_4_gang_bseed_ts0726/device.js new file mode 100644 index 0000000000..29a3eb2760 --- /dev/null +++ b/drivers/switch_4_gang_bseed_ts0726/device.js @@ -0,0 +1,28 @@ +'use strict'; + +const { ZigBeeDevice } = require('homey-zigbeedriver'); +const { CLUSTER } = require('zigbee-clusters'); + +// Exact physical interview #1401: TS0726, not TS0004. Four independent +// standard OnOff endpoints, without mandatory E000/E001 or startup writes. +const SUBDEVICE_ENDPOINTS = Object.freeze({ + secondSwitch: 2, + thirdSwitch: 3, + fourthSwitch: 4, +}); + +class BseedTs0726Device extends ZigBeeDevice { + async onNodeInit() { + const { subDeviceId } = this.getData() || {}; + let endpoint = 1; + if (subDeviceId !== undefined && subDeviceId !== null) { + if (!Object.prototype.hasOwnProperty.call(SUBDEVICE_ENDPOINTS, subDeviceId)) { + throw new Error('Unknown TS0726 subdevice: ' + subDeviceId); + } + endpoint = SUBDEVICE_ENDPOINTS[subDeviceId]; + } + this.registerCapability('onoff', CLUSTER.ON_OFF, { endpoint }); + } +} + +module.exports = BseedTs0726Device; diff --git a/drivers/switch_4_gang_bseed_ts0726/driver.compose.json b/drivers/switch_4_gang_bseed_ts0726/driver.compose.json new file mode 100644 index 0000000000..19093f7633 --- /dev/null +++ b/drivers/switch_4_gang_bseed_ts0726/driver.compose.json @@ -0,0 +1,130 @@ +{ + "id": "switch_4_gang_bseed_ts0726", + "name": { + "en": "BSEED TS0726 Four-Channel Wall Switch" + }, + "class": "socket", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "onoff" + ], + "images": { + "large": "{{driverAssetsPath}}/images/large.png", + "small": "{{driverAssetsPath}}/images/small.png" + }, + "energy": { + "approximation": { + "usageOn": 0, + "usageOff": 0 + } + }, + "zigbee": { + "manufacturerName": [ + "_TZ3002_pzao9ls1" + ], + "productId": [ + "TS0726" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 4, + 5, + 6 + ], + "bindings": [ + 6 + ] + }, + "2": { + "clusters": [ + 4, + 5, + 6 + ], + "bindings": [ + 6 + ] + }, + "3": { + "clusters": [ + 4, + 5, + 6 + ], + "bindings": [ + 6 + ] + }, + "4": { + "clusters": [ + 4, + 5, + 6 + ], + "bindings": [ + 6 + ] + } + }, + "devices": { + "secondSwitch": { + "class": "socket", + "capabilities": [ + "onoff" + ], + "name": { + "en": "BSEED TS0726 Switch - Channel 2" + }, + "energy": { + "approximation": { + "usageOn": 0, + "usageOff": 0 + } + } + }, + "thirdSwitch": { + "class": "socket", + "capabilities": [ + "onoff" + ], + "name": { + "en": "BSEED TS0726 Switch - Channel 3" + }, + "energy": { + "approximation": { + "usageOn": 0, + "usageOff": 0 + } + } + }, + "fourthSwitch": { + "class": "socket", + "capabilities": [ + "onoff" + ], + "name": { + "en": "BSEED TS0726 Switch - Channel 4" + }, + "energy": { + "approximation": { + "usageOn": 0, + "usageOff": 0 + } + } + } + }, + "learnmode": { + "image": "{{driverAssetsPath}}/icon.svg", + "instruction": { + "en": "Four independent Homey tiles will be created for this BSEED TS0726 neutral wall switch. Follow the physical device's instructions to enter Zigbee pairing mode." + } + } + } +} diff --git a/drivers/switch_4_gang_bseed_ts0726/driver.js b/drivers/switch_4_gang_bseed_ts0726/driver.js new file mode 100644 index 0000000000..b00b0e16f9 --- /dev/null +++ b/drivers/switch_4_gang_bseed_ts0726/driver.js @@ -0,0 +1,7 @@ +'use strict'; + +const { ZigBeeDriver } = require('homey-zigbeedriver'); + +class BseedTs0726Driver extends ZigBeeDriver {} + +module.exports = BseedTs0726Driver; diff --git a/drivers/switch_4_gang_ts0004/assets/icon.svg b/drivers/switch_4_gang_ts0004/assets/icon.svg new file mode 100644 index 0000000000..ea09d92c45 --- /dev/null +++ b/drivers/switch_4_gang_ts0004/assets/icon.svg @@ -0,0 +1,777 @@ + +image/svg+xml + + + + diff --git a/drivers/switch_4_gang_ts0004/assets/images/large.png b/drivers/switch_4_gang_ts0004/assets/images/large.png new file mode 100644 index 0000000000..83d9bb8449 Binary files /dev/null and b/drivers/switch_4_gang_ts0004/assets/images/large.png differ diff --git a/drivers/switch_4_gang_ts0004/assets/images/small.png b/drivers/switch_4_gang_ts0004/assets/images/small.png new file mode 100644 index 0000000000..9d92ffb62c Binary files /dev/null and b/drivers/switch_4_gang_ts0004/assets/images/small.png differ diff --git a/drivers/switch_4_gang_ts0004/device.js b/drivers/switch_4_gang_ts0004/device.js new file mode 100644 index 0000000000..2aed6ac80c --- /dev/null +++ b/drivers/switch_4_gang_ts0004/device.js @@ -0,0 +1,30 @@ +'use strict'; + +const { ZigBeeDevice } = require('homey-zigbeedriver'); +const { CLUSTER } = require('zigbee-clusters'); + +// An isolated four-channel implementation for two physically interviewed TS0004 +// identities (#1035/#1368). The older relay_board_4_channel reads the Basic +// cluster for every child; this new profile needs no extra Zigbee reads or +// E000/E001 vendor writes to register four independent standard OnOff endpoints. +const SUBDEVICE_ENDPOINTS = Object.freeze({ + secondSwitch: 2, + thirdSwitch: 3, + fourthSwitch: 4, +}); + +class Ts0004FourGangSwitch extends ZigBeeDevice { + async onNodeInit() { + const { subDeviceId } = this.getData() || {}; + let endpoint = 1; + if (subDeviceId !== undefined && subDeviceId !== null) { + if (!Object.prototype.hasOwnProperty.call(SUBDEVICE_ENDPOINTS, subDeviceId)) { + throw new Error('Unknown TS0004 subdevice: ' + subDeviceId); + } + endpoint = SUBDEVICE_ENDPOINTS[subDeviceId]; + } + this.registerCapability('onoff', CLUSTER.ON_OFF, { endpoint }); + } +} + +module.exports = Ts0004FourGangSwitch; diff --git a/drivers/switch_4_gang_ts0004/driver.compose.json b/drivers/switch_4_gang_ts0004/driver.compose.json new file mode 100644 index 0000000000..200d3f327c --- /dev/null +++ b/drivers/switch_4_gang_ts0004/driver.compose.json @@ -0,0 +1,131 @@ +{ + "id": "switch_4_gang_ts0004", + "name": { + "en": "TS0004 Four-Channel On/Off Switch" + }, + "class": "socket", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "onoff" + ], + "images": { + "large": "{{driverAssetsPath}}/images/large.png", + "small": "{{driverAssetsPath}}/images/small.png" + }, + "energy": { + "approximation": { + "usageOn": 0, + "usageOff": 0 + } + }, + "zigbee": { + "manufacturerName": [ + "_TZ3000_s6ma1nh4", + "_TZ3000_enmfaave" + ], + "productId": [ + "TS0004" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 4, + 5, + 6 + ], + "bindings": [ + 6 + ] + }, + "2": { + "clusters": [ + 4, + 5, + 6 + ], + "bindings": [ + 6 + ] + }, + "3": { + "clusters": [ + 4, + 5, + 6 + ], + "bindings": [ + 6 + ] + }, + "4": { + "clusters": [ + 4, + 5, + 6 + ], + "bindings": [ + 6 + ] + } + }, + "devices": { + "secondSwitch": { + "class": "socket", + "capabilities": [ + "onoff" + ], + "name": { + "en": "TS0004 Switch - Channel 2" + }, + "energy": { + "approximation": { + "usageOn": 0, + "usageOff": 0 + } + } + }, + "thirdSwitch": { + "class": "socket", + "capabilities": [ + "onoff" + ], + "name": { + "en": "TS0004 Switch - Channel 3" + }, + "energy": { + "approximation": { + "usageOn": 0, + "usageOff": 0 + } + } + }, + "fourthSwitch": { + "class": "socket", + "capabilities": [ + "onoff" + ], + "name": { + "en": "TS0004 Switch - Channel 4" + }, + "energy": { + "approximation": { + "usageOn": 0, + "usageOff": 0 + } + } + } + }, + "learnmode": { + "image": "{{driverAssetsPath}}/icon.svg", + "instruction": { + "en": "Four Homey tiles will be created, one for each relay channel. Follow the device's own instructions to enter Zigbee pairing mode." + } + } + } +} diff --git a/drivers/switch_4_gang_ts0004/driver.js b/drivers/switch_4_gang_ts0004/driver.js new file mode 100644 index 0000000000..32d8159db4 --- /dev/null +++ b/drivers/switch_4_gang_ts0004/driver.js @@ -0,0 +1,4 @@ +'use strict'; + +// Default ZigBeeDriver logic only; pairing identities are in this profile's Compose manifest. +module.exports = require('../relay_board_4_channel/driver'); diff --git a/drivers/temphumidsensor_aubess_qoy0ekbd/assets/icon.svg b/drivers/temphumidsensor_aubess_qoy0ekbd/assets/icon.svg new file mode 100644 index 0000000000..5a08388c32 --- /dev/null +++ b/drivers/temphumidsensor_aubess_qoy0ekbd/assets/icon.svg @@ -0,0 +1,181 @@ + + + + + + + + + diff --git a/drivers/temphumidsensor_aubess_qoy0ekbd/assets/images/large.png b/drivers/temphumidsensor_aubess_qoy0ekbd/assets/images/large.png new file mode 100644 index 0000000000..677a721209 Binary files /dev/null and b/drivers/temphumidsensor_aubess_qoy0ekbd/assets/images/large.png differ diff --git a/drivers/temphumidsensor_aubess_qoy0ekbd/assets/images/small.png b/drivers/temphumidsensor_aubess_qoy0ekbd/assets/images/small.png new file mode 100644 index 0000000000..d205fb8a99 Binary files /dev/null and b/drivers/temphumidsensor_aubess_qoy0ekbd/assets/images/small.png differ diff --git a/drivers/temphumidsensor_aubess_qoy0ekbd/assets/learn.svg b/drivers/temphumidsensor_aubess_qoy0ekbd/assets/learn.svg new file mode 100644 index 0000000000..9071eb6cdf --- /dev/null +++ b/drivers/temphumidsensor_aubess_qoy0ekbd/assets/learn.svg @@ -0,0 +1,245 @@ + + + +image/svg+xml + + + + \ No newline at end of file diff --git a/drivers/temphumidsensor_aubess_qoy0ekbd/device.js b/drivers/temphumidsensor_aubess_qoy0ekbd/device.js new file mode 100644 index 0000000000..1fa0ac134d --- /dev/null +++ b/drivers/temphumidsensor_aubess_qoy0ekbd/device.js @@ -0,0 +1,5 @@ +'use strict'; + +// Standard EP1 Power Configuration + Temperature + RH (#797 / #1246). +// No proprietary EF00 input was advertised in this exact physical interview. +module.exports = require('../temphumidsensor3/device'); diff --git a/drivers/temphumidsensor_aubess_qoy0ekbd/driver.compose.json b/drivers/temphumidsensor_aubess_qoy0ekbd/driver.compose.json new file mode 100644 index 0000000000..fca571f6d3 --- /dev/null +++ b/drivers/temphumidsensor_aubess_qoy0ekbd/driver.compose.json @@ -0,0 +1,57 @@ +{ + "id": "temphumidsensor_aubess_qoy0ekbd", + "name": { + "en": "Aubess Standard Zigbee Temperature & Humidity" + }, + "class": "sensor", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "measure_temperature", + "measure_humidity", + "measure_battery", + "alarm_battery" + ], + "images": { + "large": "{{driverAssetsPath}}/images/large.png", + "small": "{{driverAssetsPath}}/images/small.png" + }, + "zigbee": { + "manufacturerName": [ + "_TZE200_qoy0ekbd" + ], + "productId": [ + "TS0601" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 1, + 1026, + 1029 + ], + "bindings": [ + 1, + 1026, + 1029 + ] + } + }, + "learnmode": { + "image": "{{driverAssetsPath}}/learn.svg", + "instruction": { + "en": "Follow your sensor's instructions to put it into Zigbee pairing mode." + } + } + }, + "energy": { + "batteries": [ + "OTHER" + ] + } +} diff --git a/drivers/temphumidsensor_aubess_qoy0ekbd/driver.settings.compose.json b/drivers/temphumidsensor_aubess_qoy0ekbd/driver.settings.compose.json new file mode 100644 index 0000000000..e146918b34 --- /dev/null +++ b/drivers/temphumidsensor_aubess_qoy0ekbd/driver.settings.compose.json @@ -0,0 +1,85 @@ +[ + { + "id": "temperature_offset", + "type": "number", + "label": { + "en": "Temperature offset (°C)" + }, + "hint": { + "en": "Set a value to compensate a temperature offset.\nRange: -10 - 10, step size 0.1, \ndefault: 0 [°C]" + }, + "value": 0, + "attr": { + "min": -10, + "max": 10, + "step": 0.1 + } + }, + { + "id": "temperature_decimals", + "type": "radio", + "label": { + "en": "Temperature reporting decimals" + }, + "value": "1", + "values": [ + { + "id": "1", + "label": { + "en": "Report temperature value with 1 decimal (21.4 °C)" + } + }, + { + "id": "2", + "label": { + "en": "Report temperature value with 2 decimals (21.37 °C)" + } + } + ] + }, + { + "id": "humidity_offset", + "type": "number", + "label": { + "en": "Humidity offset (%)", + "nl": "Luchtvochtigheids compensatie (%)" + }, + "hint": { + "en": "Set a correction to compensate a humidity offset.\nRange: -10 - 10, step size 1, \ndefault: 0 [%]", + "nl": "Stel een correctiewaarde in om een Luchtvochtigheids verschil te compenseren.\nBereik: -10 - 10, stap grootte 1, \nstandaard: 0 [%]" + }, + "value": 0, + "attr": { + "min": -10, + "max": 10, + "step": 1 + }, + "units": { + "en": "%", + "nl": "%" + } + }, + { + "id": "humidity_decimals", + "type": "radio", + "label": { + "en": "Humidity reporting" + }, + "value": "1", + "values": [ + { + "id": "1", + "label": { + "en": "Report humidity value with 1 decimal (35.2 %)" + } + }, + { + "id": "2", + "label": { + "en": "Report humidity value with 2 decimals (35.19 %)" + } + } + ] + } + +] \ No newline at end of file diff --git a/drivers/temphumidsensor_ewelink/assets/icon.svg b/drivers/temphumidsensor_ewelink/assets/icon.svg new file mode 100644 index 0000000000..5a08388c32 --- /dev/null +++ b/drivers/temphumidsensor_ewelink/assets/icon.svg @@ -0,0 +1,181 @@ + + + + + + + + + diff --git a/drivers/temphumidsensor_ewelink/assets/images/large.png b/drivers/temphumidsensor_ewelink/assets/images/large.png new file mode 100644 index 0000000000..677a721209 Binary files /dev/null and b/drivers/temphumidsensor_ewelink/assets/images/large.png differ diff --git a/drivers/temphumidsensor_ewelink/assets/images/small.png b/drivers/temphumidsensor_ewelink/assets/images/small.png new file mode 100644 index 0000000000..d205fb8a99 Binary files /dev/null and b/drivers/temphumidsensor_ewelink/assets/images/small.png differ diff --git a/drivers/temphumidsensor_ewelink/assets/learn.svg b/drivers/temphumidsensor_ewelink/assets/learn.svg new file mode 100644 index 0000000000..9071eb6cdf --- /dev/null +++ b/drivers/temphumidsensor_ewelink/assets/learn.svg @@ -0,0 +1,245 @@ + + + +image/svg+xml + + + + \ No newline at end of file diff --git a/drivers/temphumidsensor_ewelink/device.js b/drivers/temphumidsensor_ewelink/device.js new file mode 100644 index 0000000000..a3880fb9a4 --- /dev/null +++ b/drivers/temphumidsensor_ewelink/device.js @@ -0,0 +1,4 @@ +'use strict'; + +// Exact eWeLink/7014 pairing profile; standard Zigbee temperature, RH and battery. +module.exports = require('../temphumidsensor2/device'); diff --git a/drivers/temphumidsensor_ewelink/driver.compose.json b/drivers/temphumidsensor_ewelink/driver.compose.json new file mode 100644 index 0000000000..93c40b6acf --- /dev/null +++ b/drivers/temphumidsensor_ewelink/driver.compose.json @@ -0,0 +1,58 @@ +{ + "id": "temphumidsensor_ewelink", + "name": { + "en": "eWeLink Temperature & Humidity Sensor" + }, + "class": "sensor", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "measure_temperature", + "measure_humidity", + "measure_battery", + "alarm_battery" + ], + "images": { + "large": "{{driverAssetsPath}}/images/large.png", + "small": "{{driverAssetsPath}}/images/small.png" + }, + "zigbee": { + "manufacturerName": [ + "eWeLink" + ], + "productId": [ + "CK-TLSR8656-SS5-01(7014)" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 1, + 1026, + 1029 + ], + "bindings": [ + 1, + 1026, + 1029 + ] + } + }, + "learnmode": { + "image": "{{driverAssetsPath}}/learn.svg", + "instruction": { + "en": "Follow the device's instructions to enable Zigbee pairing mode." + } + } + }, + "energy": { + "batteries": [ + "AAA", + "AAA" + ] + } +} diff --git a/drivers/temphumidsensor_ewelink/driver.settings.compose.json b/drivers/temphumidsensor_ewelink/driver.settings.compose.json new file mode 100644 index 0000000000..e146918b34 --- /dev/null +++ b/drivers/temphumidsensor_ewelink/driver.settings.compose.json @@ -0,0 +1,85 @@ +[ + { + "id": "temperature_offset", + "type": "number", + "label": { + "en": "Temperature offset (°C)" + }, + "hint": { + "en": "Set a value to compensate a temperature offset.\nRange: -10 - 10, step size 0.1, \ndefault: 0 [°C]" + }, + "value": 0, + "attr": { + "min": -10, + "max": 10, + "step": 0.1 + } + }, + { + "id": "temperature_decimals", + "type": "radio", + "label": { + "en": "Temperature reporting decimals" + }, + "value": "1", + "values": [ + { + "id": "1", + "label": { + "en": "Report temperature value with 1 decimal (21.4 °C)" + } + }, + { + "id": "2", + "label": { + "en": "Report temperature value with 2 decimals (21.37 °C)" + } + } + ] + }, + { + "id": "humidity_offset", + "type": "number", + "label": { + "en": "Humidity offset (%)", + "nl": "Luchtvochtigheids compensatie (%)" + }, + "hint": { + "en": "Set a correction to compensate a humidity offset.\nRange: -10 - 10, step size 1, \ndefault: 0 [%]", + "nl": "Stel een correctiewaarde in om een Luchtvochtigheids verschil te compenseren.\nBereik: -10 - 10, stap grootte 1, \nstandaard: 0 [%]" + }, + "value": 0, + "attr": { + "min": -10, + "max": 10, + "step": 1 + }, + "units": { + "en": "%", + "nl": "%" + } + }, + { + "id": "humidity_decimals", + "type": "radio", + "label": { + "en": "Humidity reporting" + }, + "value": "1", + "values": [ + { + "id": "1", + "label": { + "en": "Report humidity value with 1 decimal (35.2 %)" + } + }, + { + "id": "2", + "label": { + "en": "Report humidity value with 2 decimals (35.19 %)" + } + } + ] + } + +] \ No newline at end of file diff --git a/drivers/temphumidsensor_excellux/assets/icon.svg b/drivers/temphumidsensor_excellux/assets/icon.svg new file mode 100644 index 0000000000..5a08388c32 --- /dev/null +++ b/drivers/temphumidsensor_excellux/assets/icon.svg @@ -0,0 +1,181 @@ + + + + + + + + + diff --git a/drivers/temphumidsensor_excellux/assets/images/large.png b/drivers/temphumidsensor_excellux/assets/images/large.png new file mode 100644 index 0000000000..677a721209 Binary files /dev/null and b/drivers/temphumidsensor_excellux/assets/images/large.png differ diff --git a/drivers/temphumidsensor_excellux/assets/images/small.png b/drivers/temphumidsensor_excellux/assets/images/small.png new file mode 100644 index 0000000000..d205fb8a99 Binary files /dev/null and b/drivers/temphumidsensor_excellux/assets/images/small.png differ diff --git a/drivers/temphumidsensor_excellux/assets/learn.svg b/drivers/temphumidsensor_excellux/assets/learn.svg new file mode 100644 index 0000000000..9071eb6cdf --- /dev/null +++ b/drivers/temphumidsensor_excellux/assets/learn.svg @@ -0,0 +1,245 @@ + + + +image/svg+xml + + + + \ No newline at end of file diff --git a/drivers/temphumidsensor_excellux/device.js b/drivers/temphumidsensor_excellux/device.js new file mode 100644 index 0000000000..7f8db6848d --- /dev/null +++ b/drivers/temphumidsensor_excellux/device.js @@ -0,0 +1,5 @@ +'use strict'; + +// Physical probe reported over standard Zigbee temperature, RH and Power Configuration. +// The interview exposes EF00 as an output/client cluster only; no Tuya DP handler is needed. +module.exports = require('../temphumidsensor3/device'); diff --git a/drivers/temphumidsensor_excellux/driver.compose.json b/drivers/temphumidsensor_excellux/driver.compose.json new file mode 100644 index 0000000000..cd962afc13 --- /dev/null +++ b/drivers/temphumidsensor_excellux/driver.compose.json @@ -0,0 +1,57 @@ +{ + "id": "temphumidsensor_excellux", + "name": { + "en": "Excellux External Probe Temperature & Humidity Sensor" + }, + "class": "sensor", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "measure_temperature", + "measure_humidity", + "measure_battery", + "alarm_battery" + ], + "images": { + "large": "{{driverAssetsPath}}/images/large.png", + "small": "{{driverAssetsPath}}/images/small.png" + }, + "zigbee": { + "manufacturerName": [ + "NTCHT02" + ], + "productId": [ + "Excellux" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 1, + 1026, + 1029 + ], + "bindings": [ + 1, + 1026, + 1029 + ] + } + }, + "learnmode": { + "image": "{{driverAssetsPath}}/learn.svg", + "instruction": { + "en": "Put the sensor into Zigbee pairing mode according to the device instructions." + } + } + }, + "energy": { + "batteries": [ + "OTHER" + ] + } +} diff --git a/drivers/temphumidsensor_excellux/driver.settings.compose.json b/drivers/temphumidsensor_excellux/driver.settings.compose.json new file mode 100644 index 0000000000..e146918b34 --- /dev/null +++ b/drivers/temphumidsensor_excellux/driver.settings.compose.json @@ -0,0 +1,85 @@ +[ + { + "id": "temperature_offset", + "type": "number", + "label": { + "en": "Temperature offset (°C)" + }, + "hint": { + "en": "Set a value to compensate a temperature offset.\nRange: -10 - 10, step size 0.1, \ndefault: 0 [°C]" + }, + "value": 0, + "attr": { + "min": -10, + "max": 10, + "step": 0.1 + } + }, + { + "id": "temperature_decimals", + "type": "radio", + "label": { + "en": "Temperature reporting decimals" + }, + "value": "1", + "values": [ + { + "id": "1", + "label": { + "en": "Report temperature value with 1 decimal (21.4 °C)" + } + }, + { + "id": "2", + "label": { + "en": "Report temperature value with 2 decimals (21.37 °C)" + } + } + ] + }, + { + "id": "humidity_offset", + "type": "number", + "label": { + "en": "Humidity offset (%)", + "nl": "Luchtvochtigheids compensatie (%)" + }, + "hint": { + "en": "Set a correction to compensate a humidity offset.\nRange: -10 - 10, step size 1, \ndefault: 0 [%]", + "nl": "Stel een correctiewaarde in om een Luchtvochtigheids verschil te compenseren.\nBereik: -10 - 10, stap grootte 1, \nstandaard: 0 [%]" + }, + "value": 0, + "attr": { + "min": -10, + "max": 10, + "step": 1 + }, + "units": { + "en": "%", + "nl": "%" + } + }, + { + "id": "humidity_decimals", + "type": "radio", + "label": { + "en": "Humidity reporting" + }, + "value": "1", + "values": [ + { + "id": "1", + "label": { + "en": "Report humidity value with 1 decimal (35.2 %)" + } + }, + { + "id": "2", + "label": { + "en": "Report humidity value with 2 decimals (35.19 %)" + } + } + ] + } + +] \ No newline at end of file diff --git a/drivers/temphumidsensor_tsgqxdb4/assets/icon.svg b/drivers/temphumidsensor_tsgqxdb4/assets/icon.svg new file mode 100644 index 0000000000..5a08388c32 --- /dev/null +++ b/drivers/temphumidsensor_tsgqxdb4/assets/icon.svg @@ -0,0 +1,181 @@ + + + + + + + + + diff --git a/drivers/temphumidsensor_tsgqxdb4/assets/images/large.png b/drivers/temphumidsensor_tsgqxdb4/assets/images/large.png new file mode 100644 index 0000000000..677a721209 Binary files /dev/null and b/drivers/temphumidsensor_tsgqxdb4/assets/images/large.png differ diff --git a/drivers/temphumidsensor_tsgqxdb4/assets/images/small.png b/drivers/temphumidsensor_tsgqxdb4/assets/images/small.png new file mode 100644 index 0000000000..d205fb8a99 Binary files /dev/null and b/drivers/temphumidsensor_tsgqxdb4/assets/images/small.png differ diff --git a/drivers/temphumidsensor_tsgqxdb4/assets/learn.svg b/drivers/temphumidsensor_tsgqxdb4/assets/learn.svg new file mode 100644 index 0000000000..9071eb6cdf --- /dev/null +++ b/drivers/temphumidsensor_tsgqxdb4/assets/learn.svg @@ -0,0 +1,245 @@ + + + +image/svg+xml + + + + \ No newline at end of file diff --git a/drivers/temphumidsensor_tsgqxdb4/device.js b/drivers/temphumidsensor_tsgqxdb4/device.js new file mode 100644 index 0000000000..1fa0ac134d --- /dev/null +++ b/drivers/temphumidsensor_tsgqxdb4/device.js @@ -0,0 +1,5 @@ +'use strict'; + +// Standard EP1 Power Configuration + Temperature + RH (#797 / #1246). +// No proprietary EF00 input was advertised in this exact physical interview. +module.exports = require('../temphumidsensor3/device'); diff --git a/drivers/temphumidsensor_tsgqxdb4/driver.compose.json b/drivers/temphumidsensor_tsgqxdb4/driver.compose.json new file mode 100644 index 0000000000..3891be7b78 --- /dev/null +++ b/drivers/temphumidsensor_tsgqxdb4/driver.compose.json @@ -0,0 +1,57 @@ +{ + "id": "temphumidsensor_tsgqxdb4", + "name": { + "en": "TS0201 Standard Temperature & Humidity" + }, + "class": "sensor", + "platforms": [ + "local" + ], + "connectivity": [ + "zigbee" + ], + "capabilities": [ + "measure_temperature", + "measure_humidity", + "measure_battery", + "alarm_battery" + ], + "images": { + "large": "{{driverAssetsPath}}/images/large.png", + "small": "{{driverAssetsPath}}/images/small.png" + }, + "zigbee": { + "manufacturerName": [ + "_TZ3000_tsgqxdb4" + ], + "productId": [ + "TS0201" + ], + "endpoints": { + "1": { + "clusters": [ + 0, + 1, + 1026, + 1029 + ], + "bindings": [ + 1, + 1026, + 1029 + ] + } + }, + "learnmode": { + "image": "{{driverAssetsPath}}/learn.svg", + "instruction": { + "en": "Follow your sensor's instructions to put it into Zigbee pairing mode." + } + } + }, + "energy": { + "batteries": [ + "OTHER" + ] + } +} diff --git a/drivers/temphumidsensor_tsgqxdb4/driver.settings.compose.json b/drivers/temphumidsensor_tsgqxdb4/driver.settings.compose.json new file mode 100644 index 0000000000..e146918b34 --- /dev/null +++ b/drivers/temphumidsensor_tsgqxdb4/driver.settings.compose.json @@ -0,0 +1,85 @@ +[ + { + "id": "temperature_offset", + "type": "number", + "label": { + "en": "Temperature offset (°C)" + }, + "hint": { + "en": "Set a value to compensate a temperature offset.\nRange: -10 - 10, step size 0.1, \ndefault: 0 [°C]" + }, + "value": 0, + "attr": { + "min": -10, + "max": 10, + "step": 0.1 + } + }, + { + "id": "temperature_decimals", + "type": "radio", + "label": { + "en": "Temperature reporting decimals" + }, + "value": "1", + "values": [ + { + "id": "1", + "label": { + "en": "Report temperature value with 1 decimal (21.4 °C)" + } + }, + { + "id": "2", + "label": { + "en": "Report temperature value with 2 decimals (21.37 °C)" + } + } + ] + }, + { + "id": "humidity_offset", + "type": "number", + "label": { + "en": "Humidity offset (%)", + "nl": "Luchtvochtigheids compensatie (%)" + }, + "hint": { + "en": "Set a correction to compensate a humidity offset.\nRange: -10 - 10, step size 1, \ndefault: 0 [%]", + "nl": "Stel een correctiewaarde in om een Luchtvochtigheids verschil te compenseren.\nBereik: -10 - 10, stap grootte 1, \nstandaard: 0 [%]" + }, + "value": 0, + "attr": { + "min": -10, + "max": 10, + "step": 1 + }, + "units": { + "en": "%", + "nl": "%" + } + }, + { + "id": "humidity_decimals", + "type": "radio", + "label": { + "en": "Humidity reporting" + }, + "value": "1", + "values": [ + { + "id": "1", + "label": { + "en": "Report humidity value with 1 decimal (35.2 %)" + } + }, + { + "id": "2", + "label": { + "en": "Report humidity value with 2 decimals (35.19 %)" + } + } + ] + } + +] \ No newline at end of file diff --git a/drivers/wall_socket/device.js b/drivers/wall_socket/device.js index 6aa4c48204..30df950824 100644 --- a/drivers/wall_socket/device.js +++ b/drivers/wall_socket/device.js @@ -3,6 +3,7 @@ const { ZigBeeDevice } = require('homey-zigbeedriver'); const { CLUSTER, Cluster, ZCLDataTypes} = require('zigbee-clusters'); const TuyaOnOffCluster = require('../../lib/TuyaOnOffCluster'); +const { syncTuyaRelayStatus, writeTuyaRelayStatus } = require('../../lib/TuyaRelayStatus'); Cluster.addCluster(TuyaOnOffCluster); @@ -59,20 +60,23 @@ class wall_socket extends ZigBeeDevice { // Changed Cluster.readAttributes signature, attributes must now be specified as an array of strings. // zclNode.endpoints[1].clusters.windowCovering.readAttributes(["motorReversal", "ANY OTHER IF NEEDED"]); - try { - const relayStatus = await this.zclNode.endpoints[1].clusters.onOff.readAttributes(['relayStatus']); - const childLock = await this.zclNode.endpoints[1].clusters.onOff.readAttributes(['childLock']); - const indicatorMode = await this.zclNode.endpoints[1].clusters.onOff.readAttributes(['indicatorMode']); - - this.log("Relay Status supported by device"); + const onOffCluster = this.zclNode.endpoints[1]?.clusters?.onOff; + await syncTuyaRelayStatus(this, onOffCluster); + // Optional settings must not suppress relayStatus when unsupported. + try { + const childLock = await onOffCluster.readAttributes(['childLock']); + await this.setSettings({ child_lock: childLock.childLock ? '1' : '0' }); + } catch (error) { + this.log('Tuya childLock not available:', error.message); + } + try { + const indicatorMode = await onOffCluster.readAttributes(['indicatorMode']); await this.setSettings({ - relay_status : ZCLDataTypes.enum8RelayStatus.args[0][relayStatus.relayStatus].toString(), indicator_mode: ZCLDataTypes.enum8IndicatorMode.args[0][indicatorMode.indicatorMode].toString(), - child_lock: childLock.childLock ? "1" : "0", }); } catch (error) { - this.log("This device does not support Relay Control", error); + this.log('Tuya indicatorMode not available:', error.message); } // meter_power @@ -135,8 +139,7 @@ class wall_socket extends ZigBeeDevice { let parsedValue = 0; if (changedKeys.includes('relay_status')) { - parsedValue = parseInt(newSettings.relay_status); - await this.zclNode.endpoints[1].clusters.onOff.writeAttributes({ relayStatus: parsedValue }); + await writeTuyaRelayStatus(this.zclNode.endpoints[1]?.clusters?.onOff, newSettings.relay_status); } if (changedKeys.includes('indicator_mode')) { diff --git a/drivers/wall_thermostat/device.js b/drivers/wall_thermostat/device.js index a9d0cc74f9..b5915a4a92 100644 --- a/drivers/wall_thermostat/device.js +++ b/drivers/wall_thermostat/device.js @@ -4,6 +4,7 @@ const TuyaSpecificCluster = require("../../lib/TuyaSpecificCluster"); const TuyaOnOffCluster = require("../../lib/TuyaOnOffCluster"); const TuyaSpecificClusterDevice = require("../../lib/TuyaSpecificClusterDevice"); const {getDataValue} = require("./helpers"); +const UnmappedDpLogLimiter = require('./unmapped-dp-log'); const {Cluster} = require("zigbee-clusters"); Cluster.addCluster(TuyaOnOffCluster); @@ -39,6 +40,10 @@ class WallThermostatDevice extends TuyaSpecificClusterDevice { /* debug(true); this.enableDebug(); */ + // Preserve the first diagnostic for each unknown DP, but avoid flooding + // logs when a device repeats the same value at a high frequency. + this._unmappedDpLogLimiter = new UnmappedDpLogLimiter((...args) => this.log(...args)); + if (!this.hasCapability('thermostat_programming')) { await this.addCapability('thermostat_programming'); } @@ -152,7 +157,7 @@ class WallThermostatDevice extends TuyaSpecificClusterDevice { break; default: - this.log('processReporting', dp, parsedValue) + this._unmappedDpLogLimiter.record(dp, parsedValue); } } } diff --git a/drivers/wall_thermostat/unmapped-dp-log.js b/drivers/wall_thermostat/unmapped-dp-log.js new file mode 100644 index 0000000000..16412b9300 --- /dev/null +++ b/drivers/wall_thermostat/unmapped-dp-log.js @@ -0,0 +1,54 @@ +'use strict'; + +// Unmapped datapoints must not be assigned a generic meaning across different +// Tuya thermostat fingerprints. Log the first observation and each value change; +// summarize repeated identical reports rather than logging every Zigbee frame. +const REPEAT_LOG_INTERVAL_MS = 60 * 1000; + +class UnmappedDpLogLimiter { + constructor(log, now = () => Date.now()) { + this.log = log; + this.now = now; + this.recent = new Map(); + } + + record(dp, value) { + // Raw DP payloads may arrive as fresh Buffer objects containing the same + // bytes. Compare their contents instead of object identity. + const signature = Buffer.isBuffer(value) + ? `buffer:${value.toString('hex')}` + : `${typeof value}:${String(value)}`; + const timestamp = this.now(); + const previous = this.recent.get(dp); + + if ( + previous + && previous.signature === signature + && timestamp >= previous.lastLoggedAt + && timestamp - previous.lastLoggedAt < REPEAT_LOG_INTERVAL_MS + ) { + previous.suppressed += 1; + return; + } + + if (previous?.suppressed) { + this.log( + 'Suppressed repeated unmapped Tuya DP reports', + dp, + previous.suppressed, + 'previous value:', + previous.value + ); + } + + this.log('processReporting', dp, value); + this.recent.set(dp, { + signature, + value, + lastLoggedAt: timestamp, + suppressed: 0, + }); + } +} + +module.exports = UnmappedDpLogLimiter; diff --git a/lib/StandardCctRange.js b/lib/StandardCctRange.js new file mode 100644 index 0000000000..14712fddc3 --- /dev/null +++ b/lib/StandardCctRange.js @@ -0,0 +1,46 @@ +'use strict'; + +// Candidate-only helper for a future isolated STANDARD CCT driver. +// No existing or published driver imports this module. Never assume a generic +// physical temperature range: require actual, confirmed ZCL device metadata. +function requireVerifiedRange(metadata) { + if (!metadata || metadata.colorCapabilities?.colorTemperature !== true) { + throw new RangeError('CCT support is not confirmed by Color Control colorCapabilities'); + } + const min = metadata.colorTempPhysicalMinMireds; + const max = metadata.colorTempPhysicalMaxMireds; + if (!Number.isInteger(min) || !Number.isInteger(max) + || min < 1 || max > 0xfffe || min >= max) { + throw new RangeError('Usable physical CCT min/max mireds have not been verified'); + } + return Object.freeze({ min, max }); +} + +function checkRange(range) { + if (!range || !Number.isInteger(range.min) || !Number.isInteger(range.max) + || range.min < 1 || range.max > 0xfffe || range.min >= range.max) { + throw new RangeError('Verified CCT range is required'); + } + return range; +} + +// Pinned Athom ZigBeeLightDevice v2.1.4 orientation: +// Homey 0 -> minimum mireds (cool), Homey 1 -> maximum mireds (warm). +function homeyToMired(normalized, range) { + const { min, max } = checkRange(range); + if (!Number.isFinite(normalized) || normalized < 0 || normalized > 1) { + throw new RangeError('Homey light_temperature must be a finite 0–1 value'); + } + return Math.round(min + (max - min) * normalized); +} + +// Clamp valid outlying physical reports, reject missing/invalid ZCL sentinel. +function miredToHomey(value, range) { + const { min, max } = checkRange(range); + if (!Number.isInteger(value) || value < 1 || value > 0xfffe) { + throw new RangeError('Received colorTemperatureMireds is invalid'); + } + return Math.max(0, Math.min(1, (value - min) / (max - min))); +} + +module.exports = { requireVerifiedRange, homeyToMired, miredToHomey }; diff --git a/lib/TuyaRelayStatus.js b/lib/TuyaRelayStatus.js new file mode 100644 index 0000000000..353dfe424a --- /dev/null +++ b/lib/TuyaRelayStatus.js @@ -0,0 +1,70 @@ +'use strict'; + +// Tuya's manufacturer-specific OnOff relayStatus (0x8002). +// This is NOT the standard Zigbee StartUpOnOff (0x4003), whose previous-state +// wire value is 0xFF rather than Tuya's 0x02. Opt in per known driver only. +const VALUES = Object.freeze({ + '0': 0, off: 0, + '1': 1, on: 1, + '2': 2, remember: 2, previous: 2, recover: 2, + 'remember last state': 2, 'remember last status': 2, + 'off/on': 2, +}); + +function normalizeTuyaRelayStatus(value) { + if (typeof value !== 'string' && typeof value !== 'number') { + throw new RangeError('Unsupported Tuya relayStatus value'); + } + const key = String(value).trim().toLowerCase(); + if (!Object.prototype.hasOwnProperty.call(VALUES, key)) { + throw new RangeError('Unknown Tuya relayStatus value: ' + String(value)); + } + return VALUES[key]; +} + +// Read only on startup. A failed/unsupported read must not write a default to +// the hardware, overwrite an existing Homey preference or block OnOff setup. +async function syncTuyaRelayStatus(device, cluster) { + if (!cluster || typeof cluster.readAttributes !== 'function') { + device.log('Tuya relayStatus read skipped: OnOff cluster unavailable.'); + return false; + } + try { + const response = await cluster.readAttributes(['relayStatus']); + if (!response || response.relayStatus === undefined || response.relayStatus === null) { + device.log('Tuya relayStatus not returned; retaining Homey setting.'); + return false; + } + const setting = String(normalizeTuyaRelayStatus(response.relayStatus)); + await device.setSettings({ relay_status: setting }); + return true; + } catch (error) { + device.log('Tuya relayStatus could not be synchronized; retaining Homey setting:', error.message); + return false; + } +} + +// Homey setting IDs are numeric strings. Never accept partial numbers, +// unsupported enums or the standard ZCL 0xFF in a Tuya 0x8002 write. +function parseTuyaRelaySetting(value) { + if ((typeof value !== 'string' && typeof value !== 'number') + || !/^[012]$/.test(String(value))) { + throw new RangeError('Invalid relay_status; expected 0, 1 or 2'); + } + return Number(value); +} + +async function writeTuyaRelayStatus(cluster, settingValue) { + const code = parseTuyaRelaySetting(settingValue); + if (!cluster || typeof cluster.writeAttributes !== 'function') { + throw new Error('Tuya OnOff cluster unavailable for relay_status write'); + } + return cluster.writeAttributes({ relayStatus: code }); +} + +module.exports = { + normalizeTuyaRelayStatus, + parseTuyaRelaySetting, + syncTuyaRelayStatus, + writeTuyaRelayStatus, +}; diff --git a/lib/TuyaSpecificClusterDevice.js b/lib/TuyaSpecificClusterDevice.js index ef5ec1f409..c962e4a611 100644 --- a/lib/TuyaSpecificClusterDevice.js +++ b/lib/TuyaSpecificClusterDevice.js @@ -48,8 +48,7 @@ class TuyaSpecificClusterDevice extends ZigBeeDevice { data }); } catch (err) { - this.error(`Error writing boolean to dp ${dp}:`, err); - throw err; + throw err; } } @@ -73,8 +72,7 @@ class TuyaSpecificClusterDevice extends ZigBeeDevice { data }); } catch (err) { - this.error(`Error writing data32 to dp ${dp}:`, err); - throw err; + throw err; } } @@ -97,8 +95,7 @@ class TuyaSpecificClusterDevice extends ZigBeeDevice { data }); } catch (err) { - this.error(`Error writing string to dp ${dp}:`, err); - throw err; + throw err; } } @@ -122,8 +119,7 @@ class TuyaSpecificClusterDevice extends ZigBeeDevice { data }); } catch (err) { - this.error(`Error writing enum to dp ${dp}:`, err); - throw err; + throw err; } } @@ -145,8 +141,7 @@ class TuyaSpecificClusterDevice extends ZigBeeDevice { data }); } catch (err) { - this.error(`Error writing raw data to dp ${dp}:`, err); - throw err; + throw err; } } } diff --git a/lib/TuyaZigBeeLightDevice.js b/lib/TuyaZigBeeLightDevice.js index 693f70d9f3..adaad29c0b 100644 --- a/lib/TuyaZigBeeLightDevice.js +++ b/lib/TuyaZigBeeLightDevice.js @@ -11,7 +11,8 @@ const { calculateLevelControlTransitionTime, calculateColorControlTransitionTime, wrapAsyncWithRetry, - wait + wait, + isDeviceUnreachableError } = require('./util'); const MAX_HUE = 254; @@ -157,6 +158,9 @@ const lightModeCapabilityDefinition = { class TuyaZigBeeLightDevice extends ZigBeeDevice { async onNodeInit({ zclNode }) { + this._startupDeviceUnreachable = false; + this._startupDeviceUnreachableLogged = false; + await wrapAsyncWithRetry(this.readColorControlAttributes.bind(this)); // Register `onoff` and `dim` capabilities if device has both @@ -173,10 +177,16 @@ class TuyaZigBeeLightDevice extends ZigBeeDevice { await this.registerColorCapabilities({ zclNode }); } - await zclNode.endpoints[1].clusters.basic.readAttributes(['manufacturerName', 'zclVersion', 'appVersion', 'modelId', 'powerSource', 'attributeReportingStatus']) - .catch(err => { - this.error('Error when reading device attributes ', err); - }); + if (!this._startupDeviceUnreachable) { + await zclNode.endpoints[1].clusters.basic.readAttributes(['manufacturerName', 'zclVersion', 'appVersion', 'modelId', 'powerSource', 'attributeReportingStatus']) + .catch(err => { + if (isDeviceUnreachableError(err)) { + this._logStartupUnreachable(); + return; + } + this.error('Error when reading device attributes ', err); + }); + } this.log('TuyaZigBeeLightDevice is initialized'); } @@ -217,10 +227,21 @@ class TuyaZigBeeLightDevice extends ZigBeeDevice { }); }) .catch(err => { + if (isDeviceUnreachableError(err)) { + this._logStartupUnreachable(); + return; + } this.error('Error: could not read color control attributes', err); }); } + _logStartupUnreachable() { + this._startupDeviceUnreachable = true; + if (this._startupDeviceUnreachableLogged) return; + this._startupDeviceUnreachableLogged = true; + this.log('Device unreachable during startup; skipping remaining startup reads'); + } + registerOnOffAndDimCapabilities({ zclNode }) { // Register multiple capabilities, they will be debounced when one of them is called this.registerMultipleCapabilities( diff --git a/lib/util/index.js b/lib/util/index.js index 88abe4eb83..f742c22383 100644 --- a/lib/util/index.js +++ b/lib/util/index.js @@ -270,6 +270,20 @@ async function wait(timeout) { return new Promise(resolve => setTimeout(resolve, timeout)); } +/** + * Returns true only for Homey's expected Zigbee reachability error. + * Keep this deliberately narrow so programming/protocol errors still surface as errors. + * @param {Error} error + * @returns {boolean} + */ +function isDeviceUnreachableError(error) { + return Boolean( + error + && typeof error.message === 'string' + && error.message.includes('Could not reach device. Is it powered on?') + ); +} + /** * Method that applies a retry strategy to the provided async function. By default the async * function will be retried directly, override 'interval' for a different strategy. @@ -381,6 +395,7 @@ module.exports = { assertZCLNode, wrapAsyncWithRetry, wait, + isDeviceUnreachableError, debounce, throttle, debugZigbeeClusters, diff --git a/package-lock.json b/package-lock.json index 346a6bc5d5..78985f1154 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "com.tuya.zigbee", - "version": "0.3.1", + "version": "0.4.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "com.tuya.zigbee", - "version": "0.3.1", + "version": "0.4.0", "license": "MIT", "dependencies": { "homey-zigbeedriver": "2.1.4", diff --git a/package.json b/package.json index c8a24a9a0d..8ca3115980 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.tuya.zigbee", - "version": "0.3.1", + "version": "0.4.0", "description": "Adds support for Tuya Zigbee devices to Homey", "main": "app.js", "scripts": { diff --git a/test/0.4-legacy-manifest-contract.test.js b/test/0.4-legacy-manifest-contract.test.js new file mode 100644 index 0000000000..362bd8bd7b --- /dev/null +++ b/test/0.4-legacy-manifest-contract.test.js @@ -0,0 +1,87 @@ +'use strict'; + +// 0.4.0 RELEASE CONTRACT: pin actual 0.3.1 Test-generated manifest +// (source SHA 7583b4bb2fa91600c2301eb142335312a6a7cac4). +// Do not silently regenerate this baseline from the current development app. +// A deliberate exception should be documented separately with exact target +// manifest and GitHub issue; never rewrite history to make tests pass. +const test = require('node:test'); +const assert = require('node:assert/strict'); +const app = require('../app.json'); +const baseline = require('./fixtures/0.3.1-manifest-contract.json'); +const approved = require('./fixtures/0.4-approved-manifest-deltas.json'); + +function signature(value) { + // Stable, deterministic change detector over JS JSON serialization. + // The length is retained alongside a FNV-1a 64-bit UTF-16 checksum. + // This is NOT a security / authenticity signature. + const json = JSON.stringify(value); + let hash = 0xcbf29ce484222325n; + for (let i = 0; i < json.length; i++) { + hash ^= BigInt(json.charCodeAt(i)); + hash = (hash * 0x100000001b3n) & 0xffffffffffffffffn; + } + return json.length + ':' + hash.toString(16).padStart(16, '0'); +} + +function expectedSignature(kind, id, original) { + const exception = approved[kind]?.[id]; + if (!exception) return original; + assert.match(exception.reason || '', /#[0-9]+/, + 'approved change MUST cite an actual GitHub issue: ' + kind + '/' + id); + assert.match(exception.signature || '', /^[0-9]+:[a-f0-9]{16}$/, + 'approved change must pin its exact target contract: ' + kind + '/' + id); + assert.notEqual(exception.signature, original, + 'a baseline-identical item must not have a redundant exception: ' + kind + '/' + id); + return exception.signature; +} + +test('0.4 retains the full generated 0.3.1 manifest contract for all 135 existing drivers', () => { + assert.equal(baseline.version, '0.3.1'); + assert.equal(baseline.sourceSha, '7583b4bb2fa91600c2301eb142335312a6a7cac4'); + assert.equal(Object.keys(baseline.drivers).length, 135); + const seen = new Set(); + for (const d of app.drivers) { + assert.ok(!seen.has(d.id), 'duplicate driver ID: ' + d.id); + seen.add(d.id); + } + const actual = new Map(app.drivers.map(d => [d.id, d])); + for (const [id, original] of Object.entries(baseline.drivers)) { + assert.ok(actual.has(id), '0.3.1 driver REMOVED from 0.4: ' + id); + assert.equal(signature(actual.get(id)), expectedSignature('drivers', id, original), + '0.3.1 driver contract changed: ' + id + '; inspect EVERY manifest property before approval'); + } + for (const id of Object.keys(approved.drivers || {})) { + assert.ok(baseline.drivers[id], 'approved exception cannot target new/unknown driver: ' + id); + } +}); + +test('0.4 preserves existing Flow-card contracts and custom capability definitions', () => { + for (const [kind, historicCards] of Object.entries(baseline.flow)) { + const currentCards = app.flow?.[kind] || []; + const actual = new Map(currentCards.map(card => [card.id, card])); + assert.equal(actual.size, currentCards.length, 'duplicate Flow ID in ' + kind); + for (const [id, original] of Object.entries(historicCards)) { + assert.ok(actual.has(id), '0.3.1 Flow card REMOVED: ' + kind + '/' + id); + assert.equal(signature(actual.get(id)), + expectedSignature('flow', kind + '/' + id, original), + 'existing Flow contract changed without explicit exception: ' + kind + '/' + id); + } + } + for (const [id, original] of Object.entries(baseline.capabilities)) { + assert.ok(Object.prototype.hasOwnProperty.call(app.capabilities || {}, id), + '0.3.1 custom capability REMOVED: ' + id); + assert.equal(signature(app.capabilities[id]), + expectedSignature('capabilities', id, original), + '0.3.1 custom capability contract changed: ' + id); + } + for (const [kind, exceptions] of Object.entries(approved)) { + if (!['drivers', 'flow', 'capabilities'].includes(kind)) continue; // Metadata is not an exception collection. + for (const id of Object.keys(exceptions)) { + const exists = kind === 'drivers' ? baseline.drivers[id] + : kind === 'capabilities' ? baseline.capabilities[id] + : baseline.flow[id.split('/')[0]]?.[id.split('/').slice(1).join('/')]; + assert.ok(exists, 'exception must refer to baseline item: ' + kind + '/' + id); + } + } +}); diff --git a/test/0.4-physical-acceptance-inventory.test.js b/test/0.4-physical-acceptance-inventory.test.js new file mode 100644 index 0000000000..3e7aa40614 --- /dev/null +++ b/test/0.4-physical-acceptance-inventory.test.js @@ -0,0 +1,85 @@ +'use strict'; + +const test = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const path = require('node:path'); +const app = require('../app.json'); + +const driverIds = [ + 'temphumidsensor_ewelink', + 'temphumidsensor_excellux', + 'switch_1_gang_bseed_ts0001', + 'switch_1_gang_ts0001', + 'switch_2_gang_ts0002', + 'switch_3_gang_ts0003', + 'switch_4_gang_bseed_ts0726', + 'switch_4_gang_ts0004', + 'rain_sensor_mowe', + 'flood_sensor_unverified_battery', + 'contact_lux_hobeian', + 'contact_lux_pay2byax', + 'contact_sensor_elivco_x8q36xwf', + 'contact_sensor_ewelink_snzb04', + 'contact_sensor_n8dljorx', + 'motion_lux_hobeian_zg204zl', + 'motion_lux_kb5noeto', + 'temphumidsensor_aubess_qoy0ekbd', + 'temphumidsensor_tsgqxdb4', +]; + +const document = fs.readFileSync(path.resolve(__dirname, '..', 'docs', '0.4.0_PHYSICAL_ACCEPTANCE.md'), 'utf8'); +const begin = ''; +const end = ''; +const quote = String.fromCharCode(96); + +function inventory() { + const start = document.indexOf(begin), stop = document.indexOf(end); + assert.ok(start >= 0 && stop > start, 'Hardware acceptance markers missing'); + return document.slice(start + begin.length, stop).split('\n') + .filter(line => line.startsWith('| ' + quote)).map(line => { + const cells = line.split('|').slice(1, -1).map(c => c.trim().replaceAll(quote, '')); + assert.equal(cells.length, 6, 'Malformed acceptance row: ' + line); + const [manufacturer, product, driver, issue, tiles, status] = cells; + assert.match(issue, /^\[#[0-9]+\]\(https:\/\/github\.com\/JohanBendz\/com\.tuya\.zigbee\/issues\/[0-9]+\)$/); + assert.ok(status, 'Physical state may not be empty'); + return {manufacturer, product, driver, tiles: Number(tiles), status}; + }); +} + +test('the physical gate enumerates exactly all 33 pairing identities from nineteen new profiles', () => { + const rows = inventory(); + assert.equal(driverIds.length, 19); + assert.equal(rows.length, 33); + const seen = new Set(); + for (const row of rows) { + assert.ok(driverIds.includes(row.driver), 'Undeclared new profile ' + row.driver); + const key = row.manufacturer + '/' + row.product; + assert.ok(!seen.has(key), 'Duplicate physical identity: ' + key); + seen.add(key); + const matches = app.drivers.filter(d => [].concat(d.zigbee?.manufacturerName || []).includes(row.manufacturer) + && [].concat(d.zigbee?.productId || []).includes(row.product)); + assert.deepEqual(matches.map(d => d.id), [row.driver], 'Unique exact Homey matching: ' + key); + assert.equal(row.tiles, 1 + Object.keys(matches[0].zigbee.devices || {}).length, + 'Homey tile count must be correct for ' + key); + } + const generated = driverIds.flatMap(id => { + const d = app.drivers.find(x => x.id === id); + assert.ok(d, 'New driver must exist in generated Homey manifest: ' + id); + return d.zigbee.manufacturerName.flatMap(m => d.zigbee.productId.map(p => m + '/' + p)); + }); + assert.deepEqual([...seen].sort(), generated.sort(), + 'An addition or removal of a 0.4 manufacturer/model pairing REQUIRES acceptance inventory update'); +}); + +test('separate metering or un-interviewed TS000x variants must not be accidentally accepted here', () => { + const keys = new Set(inventory().map(x => x.manufacturer + '/' + x.product)); + for (const excluded of [ + '_TZ3000_fdxihpp7/TS0001', // metering #963 + '_TZ3000_ly9apzky/TS0003', // metering canonical #408 + '_TZ3000_e8cquwdk/TS0001', // no physical Homey interview #160 + ]) assert.ok(!keys.has(excluded), 'Wrong profile accidentally included: ' + excluded); + const four = inventory().find(x => x.manufacturer === '_TZ3002_pzao9ls1'); + assert.equal(four.product, 'TS0726'); + assert.equal(four.driver, 'switch_4_gang_bseed_ts0726'); +}); diff --git a/test/0.4-protected-runtime-contract.test.js b/test/0.4-protected-runtime-contract.test.js new file mode 100644 index 0000000000..f9afcf1bfb --- /dev/null +++ b/test/0.4-protected-runtime-contract.test.js @@ -0,0 +1,44 @@ +'use strict'; + +const test = require('node:test'); +const assert = require('node:assert/strict'); +const crypto = require('node:crypto'); +const fs = require('node:fs'); +const path = require('node:path'); + +const original = require('./fixtures/0.3.1-protected-runtime-blobs.json'); +const approved = require('./fixtures/0.4-approved-runtime-deltas.json'); + +// Node's standard Git blob SHA-1 identity (header + actual source file bytes). +// This is an accidental-change detector, not a security/authenticity system. +// Keep the immutable source values pinned to the actual 0.3.1 Test commit. +function gitBlobSha(file) { + const bytes = fs.readFileSync(path.resolve(__dirname, '..', file)); + return crypto.createHash('sha1') + .update('blob ' + bytes.length + '\0', 'utf8') + .update(bytes) + .digest('hex'); +} + +test('0.4 preserves all 15 sensitive legacy light runtimes and five shared Zigbee/Tuya sources', () => { + assert.equal(original.sourceSha, '7583b4bb2fa91600c2301eb142335312a6a7cac4'); + assert.equal(Object.keys(original.files).length, 20); + assert.deepEqual(Object.keys(original.files).filter(f => f.startsWith('lib/')).length, 5); + assert.deepEqual(Object.keys(original.files).filter(f => f.startsWith('drivers/')).length, 15); + for (const [file, historicSha] of Object.entries(original.files)) { + assert.match(historicSha, /^[a-f0-9]{40}$/, 'invalid historical Git blob identity: ' + file); + const exception = approved.files?.[file]; + if (exception) { + assert.match(exception.reason || '', /#[0-9]+/, + 'a protected source change must cite a GitHub issue: ' + file); + assert.match(exception.sha || '', /^[a-f0-9]{40}$/, + 'approved source must pin an exact revised Git blob SHA: ' + file); + assert.notEqual(exception.sha, historicSha, 'redundant source exception: ' + file); + } + assert.equal(gitBlobSha(file), exception ? exception.sha : historicSha, + 'PROTECTED 0.3.1 legacy light or shared Zigbee/Tuya runtime changed: ' + file); + } + for (const file of Object.keys(approved.files || {})) { + assert.ok(original.files[file], 'unknown protected runtime exception: ' + file); + } +}); diff --git a/test/0.4-test-release-preflight.test.js b/test/0.4-test-release-preflight.test.js new file mode 100644 index 0000000000..d22f2a4d8d --- /dev/null +++ b/test/0.4-test-release-preflight.test.js @@ -0,0 +1,71 @@ +'use strict'; + +const test = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const path = require('node:path'); +const pkg = require('../package.json'); +const lock = require('../package-lock.json'); +const compose = require('../.homeycompose/app.json'); +const app = require('../app.json'); +const changelog = require('../.homeychangelog.json'); +const historical = require('./fixtures/0.3.1-manifest-contract.json'); + +const read = file => fs.readFileSync(path.resolve(__dirname, '..', file), 'utf8'); +const matrixStart = ''; +const matrixEnd = ''; + +test('final 0.4 Test artifact version agrees across source, lockfile, generated manifest and changelog', () => { + for (const [source, value] of Object.entries({ + package: pkg.version, + lockfile: lock.version, + lockfileRoot: lock.packages[''].version, + compose: compose.version, + generatedManifest: app.version, + })) assert.equal(value, '0.4.0', source + ' drifted from release candidate'); + assert.match(changelog['0.4.0']?.en || '', /pairing profiles/i, + 'Homey App Store notes must describe the user-visible additions'); + assert.doesNotMatch(changelog['0.4.0']?.en || '', /\b(?:Test|Live|beta) (?:release|version|candidate)\b/i, + 'release-channel status belongs in maintainer documentation'); + assert.equal(app.compatibility, '>=5.0.0', + 'New devices must not silently increase the legacy Homey firmware floor'); + assert.equal(compose.compatibility, app.compatibility); +}); + +test('release instructions enumerate the actual 19 additions and 33 exact independently pending identities', () => { + const prev = new Set(Object.keys(historical.drivers)); + assert.equal(prev.size, 135); + const newer = app.drivers.filter(d => !prev.has(d.id)); + assert.equal(app.drivers.length, 154); + assert.equal(newer.length, 19); + + const acceptance = read('docs/0.4.0_PHYSICAL_ACCEPTANCE.md'); + const begin = acceptance.indexOf(matrixStart), end = acceptance.indexOf(matrixEnd); + assert.ok(begin >= 0 && end > begin, 'physical acceptance matrix must be present'); + const rows = acceptance.slice(begin + matrixStart.length, end).split('\n') + .filter(x => x.startsWith('| `')); + assert.equal(rows.length, 33); + assert.ok(rows.every(row => row.includes('Pending 0.4 physical')), + 'a new exact identity cannot be marked physically passed before public Test'); + + const guidance = read('docs/0.4.0_TEST_READINESS.md'); + const maintaining = read('MAINTAINING.md'); + const preflight = read('docs/0.4.0_RELEASE_PREFLIGHT.md'); + assert.match(guidance, /33 distinct Zigbee manufacturerName \+ modelId pairs/); + assert.match(guidance, /33 new identities/); + assert.match(maintaining, /33 individually testable/); + assert.match(preflight, /0\.4\.1/); + assert.match(preflight, /CONFIRMED: 0\.3\.2 Live BEFORE 0\.4\.0 Test/); + assert.match(guidance, /0\.3\.2 Live BEFORE 0\.4\.0 Test/); + assert.match(maintaining, /0\.3\.2 Live BEFORE 0\.4\.0 Test/); + assert.match(acceptance, /0\.3\.2 Live BEFORE 0\.4\.0 Test/); + assert.match(preflight, /`main` = 0\.3\.3 Live; `dev` = 0\.3\.4 Test/); + assert.match(preflight, /BRANCHES\.md/); + const branchPolicy = read('docs/BRANCHES.md'); + assert.match(branchPolicy, /130854f4c6d1b5a3537e956d941eb2e3caec9a9a/); + assert.match(branchPolicy, /21b60ce07d91421aeba08357960c8fc910d87593/); + assert.match(maintaining, /develop-0\.4\.1/); + assert.match(read('.github/workflows/validate.yml'), /develop-0\.4\.1/); + assert.match(preflight, /NOT SUBMITTED/); + assert.match(preflight, /public\s+0\.4 Test/i); +}); diff --git a/test/bseed-neutral-remaining-profiles.test.js b/test/bseed-neutral-remaining-profiles.test.js new file mode 100644 index 0000000000..24768d5b4a --- /dev/null +++ b/test/bseed-neutral-remaining-profiles.test.js @@ -0,0 +1,73 @@ +'use strict'; + +const test = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const path = require('node:path'); +const vm = require('node:vm'); +const app = require('../app.json'); + +// #1339 and #1401 were consolidated into #1338 as tracking duplicates only; +// these are two DIFFERENT physical identities, not a wildcard TS0001/TS0726. +const expected = [ + { id: 'switch_1_gang_bseed_ts0001', name: '_TZ3000_blhvsaqf', product: 'TS0001', gang: 1 }, + { id: 'switch_4_gang_bseed_ts0726', name: '_TZ3002_pzao9ls1', product: 'TS0726', gang: 4 }, +]; + +test('exact BSEED one and four gang pairings and independent OnOff endpoints', () => { + for (const row of expected) { + const profile = require('../drivers/' + row.id + '/driver.compose.json'); + const generated = app.drivers.find(d => d.id === row.id); + assert.ok(generated); + assert.deepEqual(profile.zigbee.manufacturerName, [row.name]); + assert.deepEqual(profile.zigbee.productId, [row.product]); + assert.deepEqual(generated.zigbee.manufacturerName, [row.name]); + assert.deepEqual(generated.zigbee.productId, [row.product]); + assert.equal(profile.settings, undefined); + assert.equal(generated.settings, undefined); + assert.deepEqual(profile.capabilities, ['onoff']); + assert.deepEqual(Object.keys(profile.zigbee.endpoints), Array.from({length:row.gang}, (_,i)=>String(i+1))); + assert.deepEqual(Object.keys(profile.zigbee.devices || {}).length, row.gang-1); + for (let i=1;i<=row.gang;i++) assert.deepEqual(profile.zigbee.endpoints[i], { + clusters: i === 1 ? [0, 4, 5, 6] : [4, 5, 6], bindings: [6], + }); + assert.doesNotMatch(JSON.stringify(profile), /57344|57345|1794|2820|meter_power|relay_status/); + const matched = app.drivers.filter(d => + [].concat(d.zigbee?.manufacturerName || []).includes(row.name) && + [].concat(d.zigbee?.productId || []).includes(row.product)); + assert.deepEqual(matched.map(d => d.id), [row.id]); + } + assert.ok(!app.drivers.find(d=>d.id==='switch_4_gang_ts0004').zigbee.manufacturerName.includes('_TZ3002_pzao9ls1'), + 'TS0726 cannot be merged into non-metering TS0004'); +}); + +test('runtime performs only exact independent standard OnOff registration, no startup writes', async () => { + for (const row of expected) { + const source=fs.readFileSync(path.join(__dirname,'..','drivers',row.id,'device.js'),'utf8'); + assert.doesNotMatch(source,/writeAttributes|readAttributes|relayStatus|TuyaOnOffCluster/); + const mod={exports:{}}; + const ON_OFF={NAME:'onOff'}; + class Stub { + constructor(subDeviceId){this.subDeviceId=subDeviceId;this.calls=[];} + getData(){return this.subDeviceId?{subDeviceId:this.subDeviceId}:{};} + registerCapability(capability,cluster,options){this.calls.push({capability,cluster,endpoint:options.endpoint});} + } + const fakeRequire=s=>{ + if(s==='homey-zigbeedriver')return {ZigBeeDevice:Stub}; + if(s==='zigbee-clusters')return {CLUSTER:{ON_OFF}}; + throw new Error('Unexpected dependency '+s); + }; + vm.runInNewContext('(function(require,module,exports){'+source+'\n})')(fakeRequire,mod,mod.exports); + const Device=mod.exports; + const channels=[undefined,'secondSwitch','thirdSwitch','fourthSwitch'].slice(0,row.gang); + for(let ep=1;ep<=row.gang;ep++){ + const instance=new Device(channels[ep-1]); + await instance.onNodeInit(); + assert.deepEqual(instance.calls.map(c=>[c.capability,c.endpoint]),[['onoff',ep]]); + assert.equal(instance.calls[0].cluster,ON_OFF); + } + if(row.gang===4){ + await assert.rejects(new Device('unexpectedChild').onNodeInit(),/Unknown TS0726 subdevice/); + } + } +}); diff --git a/test/bseed-neutral-two-three-profile.test.js b/test/bseed-neutral-two-three-profile.test.js new file mode 100644 index 0000000000..18e056b285 --- /dev/null +++ b/test/bseed-neutral-two-three-profile.test.js @@ -0,0 +1,52 @@ +'use strict'; + +const test = require('node:test'); +const assert = require('node:assert/strict'); +const app = require('../app.json'); +const dual = require('../drivers/switch_2_gang_ts0002/driver.compose.json'); +const triple = require('../drivers/switch_3_gang_ts0003/driver.compose.json'); + +// Full Homey interviews: #1337 contains TWO distinct devices; #1338/#1375 +// independently confirm the three-gang variant. Neither is a four-gang TS0726. +const bseed = [ + { manufacturer: '_TZ3000_l9brjwau', model: 'TS0002', driver: 'switch_2_gang_ts0002', profile: dual, ep: [1, 2] }, + { manufacturer: '_TZ3000_qkixdnon', model: 'TS0003', driver: 'switch_3_gang_ts0003', profile: triple, ep: [1, 2, 3] }, +]; + +test('two BSEED neutral switches add ONLY their interviewed exact identity, no wildcard', () => { + for (const row of bseed) { + assert.deepEqual(row.profile.zigbee.productId, [row.model]); + assert.ok(row.profile.zigbee.manufacturerName.includes(row.manufacturer)); + const matches = app.drivers.filter(d => + [].concat(d.zigbee?.manufacturerName || []).includes(row.manufacturer) + && [].concat(d.zigbee?.productId || []).includes(row.model) + ); + assert.deepEqual(matches.map(d => d.id), [row.driver]); + assert.equal(row.profile.settings, undefined, 'no guessed Tuya power-on/vendor setting'); + assert.equal(matches[0].settings, undefined); + } +}); + +test('interviewed two and three gang BSEED switches use standard OnOff on independent EPs', () => { + for (const row of bseed) { + assert.deepEqual(Object.keys(row.profile.zigbee.endpoints), row.ep.map(String)); + for (const ep of row.ep) { + assert.deepEqual(row.profile.zigbee.endpoints[ep], { + clusters: ep === 1 ? [0, 4, 5, 6] : [4, 5, 6], + bindings: [6], + }); + } + assert.equal(Object.keys(row.profile.zigbee.devices).length, row.ep.length - 1); + assert.deepEqual(row.profile.capabilities, ['onoff']); + assert.ok(!JSON.stringify(row.profile).includes('57344'), + '0xE000/E001 are optional in the physical interview, not required at pairing'); + assert.ok(!JSON.stringify(row.profile).includes('57345')); + assert.ok(!JSON.stringify(row.profile).includes('meter_power'), 'no invented metering'); + } + const bseedTripleMatches = app.drivers.filter(d => + [].concat(d.zigbee?.manufacturerName || []).includes('_TZ3000_qkixdnon')); + assert.deepEqual(bseedTripleMatches.map(d => d.id), ['switch_3_gang_ts0003'], + 'historic third-party switch_4gang mapping conflicts with this three-endpoint physical interview'); + assert.ok(!JSON.stringify(dual).includes('TS0726')); + assert.ok(!JSON.stringify(triple).includes('TS0726')); +}); diff --git a/test/contact-illuminance-1298.test.js b/test/contact-illuminance-1298.test.js new file mode 100644 index 0000000000..92c8a98d65 --- /dev/null +++ b/test/contact-illuminance-1298.test.js @@ -0,0 +1,144 @@ +'use strict'; + +const test = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const path = require('node:path'); +const vm = require('node:vm'); +const app = require('../app.json'); +const conversion = require('../drivers/illuminance_sensor/measurements'); + +const profiles = [ + {id:'contact_lux_hobeian',m:'HOBEIAN',p:'ZG-102ZL', + clusters:[0,1,3,1024,1280,61184]}, + {id:'contact_lux_pay2byax',m:'_TZE200_pay2byax',p:'TS0601', + clusters:[0,1,3,1024,1280]}, +]; + +test('#1298 and physical source #414 are independently exact contact+lux matchers',()=>{ + for(const p of profiles) { + const manifest=require('../drivers/'+p.id+'/driver.compose.json'); + assert.equal(manifest.id,p.id); + assert.deepEqual(manifest.zigbee.manufacturerName,[p.m]); + assert.deepEqual(manifest.zigbee.productId,[p.p]); + assert.deepEqual(manifest.zigbee.endpoints,{ + '1':{clusters:p.clusters,bindings:[1,1024,1280]}, + }); + assert.deepEqual(manifest.capabilities,[ + 'alarm_contact','measure_luminance','measure_battery','alarm_battery', + ]); + assert.deepEqual(manifest.energy.batteries,['OTHER']); + const matches=app.drivers.filter(d=>d.zigbee?.manufacturerName?.includes(p.m) + && d.zigbee?.productId?.includes(p.p)); + assert.deepEqual(matches.map(d=>d.id),[p.id]); + assert.deepEqual(matches[0].energy.batteries,['OTHER']); + assert.equal(matches[0].settings,undefined); + } + // Exact pairs, no modelID TS0601 added to other HOBEIAN profiles. + assert.deepEqual(app.drivers.filter(d=>d.zigbee?.manufacturerName?.includes('HOBEIAN') + && d.zigbee?.productId?.includes('TS0601')).map(d=>d.id),[]); + assert.deepEqual(app.drivers.filter(d=>d.zigbee?.manufacturerName?.includes('_TZE200_pay2byax') + && d.zigbee?.productId?.includes('ZG-102ZL')).map(d=>d.id),[]); + const h=profiles[0],t=profiles[1]; + assert.ok(h.clusters.includes(61184),'physical HOBEIAN EF00 announced and retained'); + assert.ok(!t.clusters.includes(61184),'later independent TS0601 interviews do not advertise EF00'); + const hsrc=fs.readFileSync(path.join(__dirname,'..','drivers',h.id,'device.js'),'utf8'); + const tsrc=fs.readFileSync(path.join(__dirname,'..','drivers',t.id,'device.js'),'utf8'); + assert.ok(tsrc.includes("module.exports = require('../contact_lux_hobeian/device')")); + for(const source of [hsrc,tsrc]) { + assert.doesNotMatch(source,/TuyaDataPoints|TuyaSpecificCluster|sendFrame|writeAttributes|Cluster\.addCluster/); + } +}); + +function initHarness(firstInit=true,reportingFailure=false) { + const source=fs.readFileSync(path.join(__dirname,'..','drivers','contact_lux_hobeian','device.js'),'utf8'); + const CLUSTER={ + IAS_ZONE:{NAME:'iasZone'}, + POWER_CONFIGURATION:{NAME:'powerConfiguration'}, + ILLUMINANCE_MEASUREMENT:{NAME:'illuminanceMeasurement'}, + }; + const out={exports:{}}; + class ZigBeeDevice { + constructor(){this.vals=[];this.config=[];this.messages=[];this.errors=[]; + this.error=(...args)=>this.errors.push(args);} + isFirstInit(){return firstInit;} + setCapabilityValue(id,value){this.vals.push([id,value]);return Promise.resolve();} + configureAttributeReporting(list) { + this.config.push(...list); + return reportingFailure?Promise.reject(new Error('sleepy device')):Promise.resolve(); + } + log(...args){this.messages.push(args);} + } + const requireFake=name=>{ + if(name==='homey-zigbeedriver')return {ZigBeeDevice}; + if(name==='zigbee-clusters')return {CLUSTER}; + if(name==='../illuminance_sensor/measurements')return conversion; + throw Error('unexpected dependency '+name); + }; + const factory=vm.runInNewContext('(function(require,module,exports){'+source+'\n})'); + factory(requireFake,out,out.exports); + const device=new out.exports(); + const events={}; + const register=name=>({on(event,listener){events[name+'.'+event]=listener;}}); + const ias=register('ias');ias.enrollments=[]; + ias.zoneEnrollResponse=payload=>{ias.enrollments.push(payload);return Promise.resolve();}; + const zclNode={endpoints:{1:{clusters:{ + iasZone:ias,illuminanceMeasurement:register('lux'), + powerConfiguration:register('power'), + }}}}; + return {device,events,ias,zclNode}; +} + +test('real shared runtime handles IAS contact, battery flags, lux ZCL units and invalid samples',async()=>{ + const {device,ias,events,zclNode}=initHarness(); + await device.onNodeInit({zclNode}); + assert.equal(device.config.length,2,'only optional lux and battery reporting, no extra EF00 setup'); + assert.deepEqual(device.config.map(x=>x.cluster.NAME),['illuminanceMeasurement','powerConfiguration']); + assert.deepEqual(ias.enrollments,[],'IAS enrollment is reactive, not unsolicited startup traffic'); + assert.equal(typeof ias.onZoneEnrollRequest,'function'); + ias.onZoneEnrollRequest(); + await Promise.resolve();await Promise.resolve(); + assert.equal(ias.enrollments.length,1); + assert.equal(ias.enrollments[0].enrollResponseCode,0); + assert.equal(ias.enrollments[0].zoneId,0); + ias.onZoneStatusChangeNotification({zoneStatus:{alarm1:true,battery:false}}); + ias.onZoneStatusChangeNotification({zoneStatus:{alarm1:false,battery:true}}); + events['ias.attr.zoneStatus']({alarm1:true}); + ias.onZoneStatusChangeNotification({zoneStatus:{}}); + ias.onZoneStatusChangeNotification({zoneStatus:null}); + assert.deepEqual(device.vals.slice(0,5),[ + ['alarm_contact',true],['alarm_battery',false], + ['alarm_contact',false],['alarm_battery',true],['alarm_contact',true], + ]); + events['lux.attr.measuredValue'](10001); + events['lux.attr.measuredValue'](0); + events['lux.attr.measuredValue'](0xffff); + events['lux.attr.measuredValue'](NaN); + assert.deepEqual(device.vals.slice(5),[ + ['measure_luminance',10],['measure_luminance',0], + ]); + events['power.attr.batteryPercentageRemaining'](200); + events['power.attr.batteryPercentageRemaining'](39); + events['power.attr.batteryPercentageRemaining'](255); + events['power.attr.batteryPercentageRemaining'](-1); + events['power.attr.batteryPercentageRemaining'](false); + assert.deepEqual(device.vals.slice(7),[ + ['measure_battery',100],['alarm_battery',false], + ['measure_battery',19.5],['alarm_battery',true], + ]); + assert.deepEqual(device.errors,[]); +}); + +test('sleepy init survives optional reporting failure, restart does not send reporting configuration',async()=>{ + const failed=initHarness(true,true); + await failed.device.onNodeInit({zclNode:failed.zclNode}); + assert.equal(failed.device.config.length,2); + assert.equal(failed.device.messages.length,2); + assert.deepEqual(failed.device.errors,[]); + const restored=initHarness(false,true); + await restored.device.onNodeInit({zclNode:restored.zclNode}); + assert.deepEqual(restored.device.config,[]); + assert.equal(typeof restored.ias.onZoneStatusChangeNotification,'function'); + assert.equal(typeof restored.events['lux.attr.measuredValue'],'function'); + assert.equal(typeof restored.events['power.attr.batteryPercentageRemaining'],'function'); +}); diff --git a/test/ewelink-7014.test.js b/test/ewelink-7014.test.js new file mode 100644 index 0000000000..6e9ca79139 --- /dev/null +++ b/test/ewelink-7014.test.js @@ -0,0 +1,110 @@ +'use strict'; + +const test = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const path = require('node:path'); +const vm = require('node:vm'); + +const root = path.resolve(__dirname, '..'); +const driverId = 'temphumidsensor_ewelink'; +const exactProduct = 'CK-TLSR8656-SS5-01(7014)'; +const compose = require('../drivers/temphumidsensor_ewelink/driver.compose.json'); +const generated = require('../app.json'); + +test('eWeLink (7014) exact physical Homey identity, endpoint and battery metadata', () => { + assert.equal(compose.id, driverId); + assert.deepEqual(compose.zigbee.manufacturerName, ['eWeLink']); + assert.deepEqual(compose.zigbee.productId, [exactProduct]); + assert.deepEqual(compose.energy.batteries, ['AAA', 'AAA']); + assert.deepEqual(compose.zigbee.endpoints['1'].clusters, [0, 1, 1026, 1029]); + assert.deepEqual(compose.zigbee.endpoints['1'].bindings, [1, 1026, 1029]); + assert.deepEqual(compose.capabilities, [ + 'measure_temperature', + 'measure_humidity', + 'measure_battery', + 'alarm_battery', + ]); + assert.ok(!JSON.stringify(compose.zigbee).includes('61184'), 'This is a standard-cluster device, not Tuya EF00'); + + const match = generated.drivers.find(item => item.id === driverId); + assert.ok(match); + assert.deepEqual(match.zigbee.manufacturerName, ['eWeLink']); + assert.deepEqual(match.zigbee.productId, [exactProduct]); + assert.deepEqual(match.energy.batteries, ['AAA', 'AAA']); + + const found = generated.drivers.filter(item => + (item.zigbee?.manufacturerName || []).includes('eWeLink') + && (item.zigbee?.productId || []).includes(exactProduct) + ); + assert.deepEqual(found.map(item => item.id), [driverId]); +}); + +test('eWeLink 7014 delegates to existing, standard-cluster runtime', () => { + const deviceSource = fs.readFileSync( + path.join(root, 'drivers', driverId, 'device.js'), + 'utf8' + ); + assert.match(deviceSource, /module.exports = require\('\.\.\/temphumidsensor2\/device'\)/); + assert.doesNotMatch(deviceSource, /TuyaSpecificCluster|DP[0-9]/); +}); + +test('standard runtime maps physical interview scaling (temperature /100, RH /100, battery /2)', async () => { + const source = fs.readFileSync( + path.join(root, 'drivers', 'temphumidsensor2', 'device.js'), + 'utf8' + ); + const mockModule = { exports: {} }; + const CLUSTER = { + TEMPERATURE_MEASUREMENT: { NAME: 'temperatureMeasurement' }, + RELATIVE_HUMIDITY_MEASUREMENT: { NAME: 'relativeHumidity' }, + POWER_CONFIGURATION: { NAME: 'powerConfiguration' }, + }; + class MockZigBeeDevice { + constructor() { + this.values = new Map(); + } + getSetting() { return undefined; } + log() {} + error() {} + setCapabilityValue(key, value) { + this.values.set(key, value); + return Promise.resolve(); + } + } + const fakeRequire = dependency => { + if (dependency === 'homey') return {}; + if (dependency === 'homey-zigbeedriver') return { ZigBeeDevice: MockZigBeeDevice }; + if (dependency === 'zigbee-clusters') return { debug() {}, CLUSTER }; + throw new Error('Unexpected dependency: ' + dependency); + }; + const load = vm.runInNewContext( + '(function(require,module,exports){' + source + '\n})' + ); + load(fakeRequire, mockModule, mockModule.exports); + + const sensor = new mockModule.exports(); + const events = {}; + const makeCluster = key => ({ + on(name, callback) { events[key + '.' + name] = callback; }, + }); + await sensor.onNodeInit({ + zclNode: { endpoints: { 1: { clusters: { + temperatureMeasurement: makeCluster('temperature'), + relativeHumidity: makeCluster('humidity'), + powerConfiguration: makeCluster('battery'), + } } } }, + }); + + events['temperature.attr.measuredValue'](2650); // #1284 full physical interview. + events['humidity.attr.measuredValue'](6230); + events['battery.attr.batteryPercentageRemaining'](166); // Standard half-percent. + assert.equal(sensor.values.get('measure_temperature'), 26.5); + assert.equal(sensor.values.get('measure_humidity'), 62.3); + assert.equal(sensor.values.get('measure_battery'), 83); + assert.equal(sensor.values.get('alarm_battery'), false); + + events['battery.attr.batteryPercentageRemaining'](18); + assert.equal(sensor.values.get('measure_battery'), 9); + assert.equal(sensor.values.get('alarm_battery'), true); +}); diff --git a/test/excellux-probe.test.js b/test/excellux-probe.test.js new file mode 100644 index 0000000000..0462692d42 --- /dev/null +++ b/test/excellux-probe.test.js @@ -0,0 +1,106 @@ +'use strict'; + +const test = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const path = require('node:path'); +const vm = require('node:vm'); + +const driverId = 'temphumidsensor_excellux'; +const compose = require('../drivers/temphumidsensor_excellux/driver.compose.json'); +const manifest = require('../app.json'); + +test('physical Excellux C3007 matches only its exact Homey Zigbee identity', () => { + assert.equal(compose.id, driverId); + assert.deepEqual(compose.zigbee.manufacturerName, ['NTCHT02']); + assert.deepEqual(compose.zigbee.productId, ['Excellux']); + assert.deepEqual(compose.zigbee.endpoints['1'].clusters, [0, 1, 1026, 1029]); + assert.deepEqual(compose.zigbee.endpoints['1'].bindings, [1, 1026, 1029]); + assert.deepEqual(compose.capabilities, [ + 'measure_temperature', 'measure_humidity', 'measure_battery', 'alarm_battery', + ]); + assert.equal(compose.capabilities.filter(name => name === 'measure_temperature').length, 1); + assert.deepEqual(compose.energy.batteries, ['OTHER'], 'Homey requires energy.batteries for measure_battery; physical AAA cell count awaits verification'); + assert.ok(!JSON.stringify(compose.zigbee).includes('61184'), 'EF00 is OUTPUT/client only in the interview, not an input cluster'); + + const found = manifest.drivers.filter(d => + d.zigbee?.manufacturerName?.includes('NTCHT02') + && d.zigbee?.productId?.includes('Excellux') + ); + assert.deepEqual(found.map(d => d.id), [driverId]); + assert.deepEqual(found[0].energy.batteries, ['OTHER']); +}); + +test('dedicated profile reuses the existing standard Zigbee sensor runtime only', () => { + const content = fs.readFileSync(path.resolve(__dirname, '..', 'drivers', driverId, 'device.js'), 'utf8'); + assert.match(content, /module\.exports = require\('\.\.\/temphumidsensor3\/device'\)/); + assert.doesNotMatch(content, /TuyaSpecificCluster|TuyaDataPoints/); +}); + +test('real standard-cluster runtime keeps probe scaling and battery/low-battery updates', async () => { + const src = fs.readFileSync(path.resolve(__dirname, '..', 'drivers', 'temphumidsensor3', 'device.js'), 'utf8'); + const CLUSTER = { + POWER_CONFIGURATION: { NAME: 'powerConfiguration' }, + TEMPERATURE_MEASUREMENT: { NAME: 'temperatureMeasurement' }, + RELATIVE_HUMIDITY_MEASUREMENT: { NAME: 'relativeHumidity' }, + }; + const out = { exports: {} }; + class MockZigBeeDevice { + constructor() { + this.reportConfigs = []; + this.values = new Map(); + this.settings = {}; + } + isFirstInit() { return true; } + configureAttributeReporting(configs) { + this.reportConfigs.push(...configs); + return Promise.resolve(); + } + getSetting(key) { return this.settings[key]; } + setCapabilityValue(key, value) { + this.values.set(key, value); + return Promise.resolve(); + } + log() {} + error(err) { throw err; } + } + const fakeRequire = dependency => { + if (dependency === 'homey') return {}; + if (dependency === 'homey-zigbeedriver') return { ZigBeeDevice: MockZigBeeDevice }; + if (dependency === 'zigbee-clusters') return { debug() {}, CLUSTER }; + throw new Error('Unexpected dependency: ' + dependency); + }; + const factory = vm.runInNewContext('(function(require,module,exports){' + src + '\n})'); + factory(fakeRequire, out, out.exports); + const device = new out.exports(); + const events = {}; + const cluster = id => ({ on(name, handler) { events[id + '.' + name] = handler; } }); + await device.onNodeInit({ zclNode: { endpoints: { 1: { clusters: { + temperatureMeasurement: cluster('temperature'), + relativeHumidity: cluster('humidity'), + powerConfiguration: cluster('battery'), + } } } } }); + assert.deepEqual(device.reportConfigs.map(c => [c.cluster.NAME, c.attributeName]), [ + ['temperatureMeasurement', 'measuredValue'], + ['relativeHumidity', 'measuredValue'], + ['powerConfiguration', 'batteryPercentageRemaining'], + ]); + + events['temperature.attr.measuredValue'](2340); // Reporter physical probe reading, 23.4 C. + events['humidity.attr.measuredValue'](4648); + events['battery.attr.batteryPercentageRemaining'](166); + assert.equal(device.values.get('measure_temperature'), 23.4); + assert.equal(device.values.get('measure_humidity'), 46.5); // Default 1-decimal setting. + assert.equal(device.values.get('measure_battery'), 83); // Zigbee reports half-percent units. + assert.equal(device.values.get('alarm_battery'), false); + device.settings.temperature_decimals = '2'; + device.settings.humidity_decimals = '2'; + events['temperature.attr.measuredValue'](2341); + events['humidity.attr.measuredValue'](4648); + assert.equal(device.values.get('measure_temperature'), 23.41); + assert.equal(device.values.get('measure_humidity'), 46.48); + events['battery.attr.batteryPercentageRemaining'](18); + assert.equal(device.values.get('measure_battery'), 9); + assert.equal(device.values.get('alarm_battery'), true); + assert.equal(device.values.has('measure_temperature.ambient'), false); +}); diff --git a/test/fixtures/0.3.1-manifest-contract.json b/test/fixtures/0.3.1-manifest-contract.json new file mode 100644 index 0000000000..b0b9c846e5 --- /dev/null +++ b/test/fixtures/0.3.1-manifest-contract.json @@ -0,0 +1,207 @@ +{ + "note": "Immutable generated Homey 0.3.1 Test manifest baseline for release-safety regression; source 7583b4b. Deterministic UTF-16 FNV-1a 64-bit plus JSON length, not a cryptographic security signature.", + "sourceRef": "modernize-2026-issues", + "sourceSha": "7583b4bb2fa91600c2301eb142335312a6a7cac4", + "version": "0.3.1", + "drivers": { + "christmas_lights": "739:2776fcf2a444fc57", + "curtain_module": "2893:4a24138de2f8d5cb", + "curtain_module_2_gang": "2956:b958626ac8178d0a", + "curtain_motor": "2019:7c2c232d88959201", + "curtain_motor_dooya": "1883:98717a11cedb85cf", + "dimmable_led_strip": "700:863b63e30a7259d9", + "dimmable_recessed_led": "714:a82c21082d12e36e", + "dimmer_1_gang": "1186:fb35f9fdca12735d", + "dimmer_1_gang_2": "765:edf27c45a684f229", + "dimmer_1_gang_tuya": "935:c516a83a1373b11c", + "dimmer_1_gang_tuya_avatto": "793:0f5d4eef29fe02c1", + "dimmer_2_gang": "1159:61b0a42ced13ec58", + "dimmer_2_gang_tuya": "1060:1fd4758ec6155979", + "dimmer_2_gang_tuya_fjjbhx9d": "1038:bb59359355ac77bf", + "doorbell_button": "705:25c6eabb380cff25", + "doorwindowsensor": "1499:31ee1389bd706ce7", + "doorwindowsensor_2": "864:1e0d92bfdb80eba5", + "doorwindowsensor_3": "799:1424c217f443c710", + "doorwindowsensor_4": "726:8ae4ff47729987de", + "double_power_point": "2112:d9a459458845ff2a", + "double_power_point_2": "874:8f3272e1df3c0feb", + "fantem_zb003x": "816:bf8cda23fe992482", + "fingerbot": "1848:5041b96c18a52272", + "flood_sensor": "797:ae964609e629f534", + "flood_sensor_2": "704:e74884f230735acf", + "handheld_remote_4_buttons": "768:6a9a077e8161995a", + "hobeian_water_leak": "689:49eb6660f5e03d51", + "illuminance_sensor": "703:0c981eb273c0b23f", + "lcdtemphumidluxsensor": "2047:38cb2f148e43cf63", + "lcdtemphumidsensor": "2116:d169e0d24ff17cf0", + "lcdtemphumidsensor_2": "1916:c4aac262541a6fc4", + "lcdtemphumidsensor_3": "1470:ce8bf3504f8db66e", + "motion_scene_switch": "723:3e20211e885a4250", + "motion_sensor": "792:3b27b16f760deb84", + "motion_sensor_2": "976:6ea2edaf662fd658", + "motion_sensor_3": "660:01e8919e183d631c", + "mtg075_radar_sensor": "3149:9d06120b57836b83", + "outdoor_2_socket": "1998:57a268c9a3ef46cf", + "outdoor_plug": "564:2674787d0a773b2b", + "pir_sensor_2": "975:b5eb912cb1a6cfc5", + "pir_sensor_3": "634:cb0446ce5086b638", + "pir_sensor_4": "636:7c699c08c1ea65df", + "pirsensor": "787:478f3fa91e6fab1c", + "plug": "652:104a8669578cea05", + "radar_sensor": "2016:dbb101f896ec8c13", + "radar_sensor_2": "1796:489ba11e787b4dcd", + "radar_sensor_7gclukjs": "1557:533b259db9d209cd", + "radar_sensor_ceiling": "1383:e3122158c7458bbb", + "radar_sensor_qasjif9e": "1836:d0c5f67d28e4904c", + "rain_sensor": "1417:74e495f4240c2f40", + "relay_board_1_channel": "690:65c35255b5f2abc4", + "relay_board_2_channel": "975:419903a892d5f0a7", + "relay_board_4_channel": "1432:872b4a538c9511d3", + "rgb_bulb_E14": "713:48099c171fd40d4f", + "rgb_bulb_E27": "858:39a7c56b6426ac21", + "rgb_ceiling_led_light": "761:d2318cc1c6b4ffed", + "rgb_floor_led_light": "772:d0a6eb9b1a5b2906", + "rgb_led_light_bar": "769:0ba4e3c7835d3369", + "rgb_led_strip": "718:228e1e57583bd856", + "rgb_led_strip_controller": "955:56b9058747e4b4c8", + "rgb_mood_light": "754:c42b329a74b1f1a0", + "rgb_spot_GU10": "718:372b95715fe880da", + "rgb_spot_GardenLight": "754:ca9e0a942856276e", + "rgb_wall_led_light": "779:2ea09a48c4790633", + "siren": "3987:d7e46d27233f9e4f", + "sirentemphumidsensor": "4385:cc7acd42f03bffa3", + "slim_motion_sensor": "655:ce88ce72dbb7d0e9", + "smartPlug_DinRail": "2701:59913a5efa5890c8", + "smart_air_detection_box": "860:673501dfd194728c", + "smart_button_switch": "659:f4f4b9899330b727", + "smart_door_window_sensor": "1177:29406ff88795602a", + "smart_garden_irrigation_control": "1567:ebfa15b142eea1dd", + "smart_knob_switch": "822:37f25af275d5fb1a", + "smart_motion_sensor": "1118:120befc7da5bf444", + "smart_remote_1_button": "720:0b8d7890be15bba1", + "smart_remote_1_button_2": "669:f9fc8b2cfb473352", + "smart_remote_4_buttons": "776:84720f7624b3e05d", + "smart_switch": "633:ddfb0d1d715d1f34", + "smartplug": "3682:ffc16d0d04b759dd", + "smartplug_2_socket": "2770:efeddfc4bc3eaf02", + "smoke_sensor": "590:2143d0a286fe517f", + "smoke_sensor2": "756:2f3e00391253aff6", + "smoke_sensor3": "660:4c1f9507aa541328", + "smoke_sensor_smoke_only": "658:5a9f0883c57dee03", + "socket_power_strip": "1052:4de640224455910c", + "socket_power_strip_four": "1414:60b23d777d9d5f58", + "socket_power_strip_four_three": "1194:ca6a0abe990cd1af", + "socket_power_strip_four_two": "1409:c55d937ec3f32f1f", + "soilsensor": "855:e3793c8fe90766c6", + "soilsensor_2": "787:ce4256c55462d894", + "switch_1_gang": "991:fba3f1fad8e4f687", + "switch_1_gang_metering": "2062:b3e57e7399bc461d", + "switch_1_gang_metering_gjrubzje": "2042:f22eca94f4b44bd8", + "switch_2_gang": "1257:4f75740788be1312", + "switch_2_gang_metering": "2272:d18fe49ed0f28ed3", + "switch_3_gang": "1202:84e0ac6318778e76", + "switch_4_gang_metering": "2594:772d74eebb7443a9", + "temphumidsensor": "2379:900a05ffac51e001", + "temphumidsensor2": "2060:3ffcb2f4b9829464", + "temphumidsensor3": "2888:6b53f400b7b7a5d2", + "temphumidsensor4": "2192:b8258a205a637aff", + "temphumidsensor5": "2056:806af6769eaa9a0f", + "temphumidsensor_hobeian": "2025:ff2ae453a5b25084", + "temphumidsensor_vvmbj46n": "2089:30892bd6db6c55a2", + "thermostatic_radiator_valve": "4643:70f69b0b02523b8f", + "tunable_bulb_E14": "689:0bb5988690083142", + "tunable_bulb_E27": "689:45306724f6854783", + "tunable_spot_GU10": "694:c1de560960fbf90f", + "tuya_dummy_device": "549:e70c5932d777e847", + "valvecontroller": "1066:b756d0d965f41f24", + "wall_curtain_switch": "2861:c8f833d526d2a8f6", + "wall_dimmer_tuya": "1009:8be68426bb01248c", + "wall_remote_1_gang": "806:ac254f04bbc493b6", + "wall_remote_2_gang": "850:42db49d64ed04d83", + "wall_remote_3_gang": "902:ed3073b815129ac0", + "wall_remote_4_gang": "792:a81679d4e098c578", + "wall_remote_4_gang_2": "755:b94f7894ecca7a5c", + "wall_remote_4_gang_3": "819:c703b3532c6adac1", + "wall_remote_6_gang": "765:86ee29a777994b27", + "wall_socket": "2616:74027026ddd3a5cf", + "wall_switch_1_gang": "1229:078e0e935acc13b5", + "wall_switch_1_gang_tuya": "748:0be611dc083c9412", + "wall_switch_2_gang": "1595:738800126dd08e77", + "wall_switch_2_gang_tuya": "895:01001850319b0da2", + "wall_switch_3_gang": "1645:e016e365ecfaa233", + "wall_switch_4_gang": "1623:4959d143764aa3a8", + "wall_switch_4_gang_tuya": "1392:681c88fc22bc959e", + "wall_switch_5_gang_tuya": "1436:1267a867294e8d17", + "wall_switch_6_gang_tuya": "1612:698845a3cff408a9", + "wall_thermostat": "678:bcb3bd893a5bce3c", + "water_detector": "976:257ba59c4a3fed25", + "water_detector_2aaa": "746:b5255b3d1c17883d", + "water_leak_sensor_jthf7vb6": "752:2738434805c15632", + "water_leak_sensor_tuya": "753:6827cc098fe03e14", + "zigbee_repeater": "663:d3bce584c2eb35ae" + }, + "flow": { + "triggers": { + "target_distance_changed": "276:5708c854fceae716", + "doorbell_button_pressed": "197:a073fc4bf6526638", + "fingerbot_button_pressed": "243:58556013f60a9761", + "fingerbot_battery_low": "236:3d20002aff892b1e", + "handheld_remote_4_buttons": "654:152129cac394446b", + "motion_scene_switch_button": "407:1c01bac860520093", + "siren_alarm": "646:7341b95430f62f81", + "alarm_siren": "455:6ca89f587960fabd", + "smart_button_switch_buttons": "365:d1ff634df9c0dc34", + "smart_knob_switch_button": "841:16aebf65a3e00045", + "smart_remote_1_button": "361:7c2bff01268310c6", + "smart_remote_1_button_2": "412:675f1161f0f8e91e", + "smart_remote_4_buttons": "512:65ed48ef70a4ff89", + "wall_remote_1_gang_buttons": "363:1e87fe75a51b3cee", + "wall_remote_2_gang_buttons": "737:665ec39686180cf7", + "wall_remote_3_gang_buttons": "652:a09cfb84dba563d4", + "wall_remote_4_gang_buttons": "844:61e78fe62e5794cd", + "wall_remote_4_gang_buttons_2": "510:f5823fca0c36ab5b", + "wall_remote_4_gang_buttons_3": "1236:8ba91972f1b98e31", + "wall_remote_6_gang_buttons": "1360:70114218e2f90972" + }, + "actions": { + "resetEnergyMeter": "132:6a89f2dc4fa1e60a", + "start_effect": "2003:c0abb44684ba2f09", + "move_open": "133:676fb4c1731cc6eb", + "move_close": "138:f1900b59d031720a", + "move_open_2gang": "146:06a2e95c7d79d2b8", + "move_close_2gang": "151:332c6a9baba4383f", + "fingerbot_push": "202:25dd1c7b9270a6d2", + "siren_alarm_state": "1207:ae536e30c3daee82", + "siren_alarm_duration": "931:280bde3c606afadf", + "siren_volume_setting": "1084:e33e06046c9f4d4f", + "siren_alarm_tune": "3410:8e00772cabfc37f4", + "alarm_state": "824:b29e902bdf950fe6", + "alarm_duration": "671:81d96a5ef3370c86", + "siren_volume": "799:60674e0b9de93c29", + "alarm_tune": "1971:28e8b55f30a7b562", + "window_open_status_set": "308:532637816d30a9bd", + "wall_move_open": "143:0ae945b3707c7145", + "wall_move_close": "148:da1d1114be7da650" + }, + "conditions": { + "window_open_status_get": "167:408a2028b402eb04" + } + }, + "capabilities": { + "alarm_cleaning": "166:ddc881637b0da3b9", + "alarm_siren": "145:0ff7daab2eb2af00", + "away_mode": "98:8f6221de11fec81a", + "child_lock": "99:312d5a45d177a3a2", + "lidl_xmas_mode": "255:9d7b0ec5a0bcb9b5", + "light_status": "253:d32026bc8077f77e", + "measure_formaldehyde": "1081:efe1bcb9d276f7e3", + "measure_voc": "679:05b1a3a2a64043f5", + "soil_moisture": "280:133c6decf990042e", + "target_distance": "174:64845446fc60f6a7", + "temp_calibration": "161:bfc3bad7c514b802", + "temperature_unit": "249:c36588b4ac81869c", + "thermostat_preset": "260:2da95f23010c802b", + "thermostat_programming": "226:83824baafe0429ec", + "window_open": "129:31460bcb8cf814f2" + } +} diff --git a/test/fixtures/0.3.1-protected-runtime-blobs.json b/test/fixtures/0.3.1-protected-runtime-blobs.json new file mode 100644 index 0000000000..b46a46edb1 --- /dev/null +++ b/test/fixtures/0.3.1-protected-runtime-blobs.json @@ -0,0 +1,26 @@ +{ + "note": "Immutable actual Git blob SHA-1 identities from frozen published Test 0.3.1; Git blobs are content change sentinels, not a security signature. Keep source snapshot unchanged even when a future specific change is approved.", + "sourceSha": "7583b4bb2fa91600c2301eb142335312a6a7cac4", + "files": { + "lib/TuyaZigBeeLightDevice.js": "693f70d9f3332f296a906e633ae3ac5542b12576", + "lib/TuyaColorControlCluster.js": "bee8a075b6c2e18b96aea9c38cf9bd13b2c0d706", + "lib/TuyaOnOffCluster.js": "8e8d57de27d7b4c0e43afe26cab122f837d09e5b", + "lib/TuyaSpecificCluster.js": "d42a03512f379f436ac1ddbbbc082bf8eab81923", + "lib/TuyaDataPoints.js": "3fc8f97ae93b6199a4977b01cd82dbe973969c44", + "drivers/dimmable_led_strip/device.js": "a7eb1554ffdac8d3a7c57ff97d4897875a219c41", + "drivers/dimmable_recessed_led/device.js": "86cdb45087a72d3449cbbb2e443bb3900bd0c7c9", + "drivers/rgb_bulb_E14/device.js": "22350be7a8c82dc9da066716165a9a49bfe1bfa2", + "drivers/rgb_bulb_E27/device.js": "34f188ad353281c496579e5aa4a1f4357054afea", + "drivers/rgb_ceiling_led_light/device.js": "a5ae03f9dee293e3518d857114484ede9b76b763", + "drivers/rgb_floor_led_light/device.js": "3fa998d44ad4f66f8c7e4c1e9d72260318532505", + "drivers/rgb_led_light_bar/device.js": "8f020b30733df0a5ac4e04564282d4145b25f450", + "drivers/rgb_led_strip/device.js": "cc3ec96f8de3c08557efdad8ca57a23860488d70", + "drivers/rgb_mood_light/device.js": "46c173c9dae10aee2323be094d8e08cbd2ec05ac", + "drivers/rgb_spot_GU10/device.js": "c355791b105b3f83162dba3f9fb3e2b5d655e7cb", + "drivers/rgb_spot_GardenLight/device.js": "ccb134b4d43dccc824f6b853cd1343a20d0adc57", + "drivers/rgb_wall_led_light/device.js": "4e373fc559c31ef76b280e9bb32e8d0a83b66ff1", + "drivers/tunable_bulb_E14/device.js": "6b297c710b38d5bc82e09ef4822341c6acecfc63", + "drivers/tunable_bulb_E27/device.js": "89708ca896847f854930cdb74df2d92b79f6625b", + "drivers/tunable_spot_GU10/device.js": "bbec19087e81c359085911d40bd070f97faf56e3" + } +} diff --git a/test/fixtures/0.4-approved-manifest-deltas.json b/test/fixtures/0.4-approved-manifest-deltas.json new file mode 100644 index 0000000000..fd9688f036 --- /dev/null +++ b/test/fixtures/0.4-approved-manifest-deltas.json @@ -0,0 +1,6 @@ +{ + "note": "Intentional differences from the immutable 0.3.1 baseline must pin the exact changed release-manifest contract and reference a GitHub issue. Empty by default.", + "drivers": {}, + "flow": {}, + "capabilities": {} +} diff --git a/test/fixtures/0.4-approved-runtime-deltas.json b/test/fixtures/0.4-approved-runtime-deltas.json new file mode 100644 index 0000000000..d34a14db82 --- /dev/null +++ b/test/fixtures/0.4-approved-runtime-deltas.json @@ -0,0 +1,9 @@ +{ + "note": "If a protected runtime must change, preserve the historical source snapshot. Add an exact new Git blob SHA and a referenced GitHub issue after explicit targeted review and physical regression planning.", + "files": { + "lib/TuyaZigBeeLightDevice.js": { + "sha": "adaad29c0b13de8d7f8e605517d9f24d0b41d971", + "reason": "#1520: startup reachability logging only; no light protocol, capability mapping or cluster behavior changes. Physical regression planned in 0.4 Test." + } + } +} diff --git a/test/light-temperature-audit.test.js b/test/light-temperature-audit.test.js new file mode 100644 index 0000000000..e68640f9b6 --- /dev/null +++ b/test/light-temperature-audit.test.js @@ -0,0 +1,174 @@ +'use strict'; + +// CHARACTERIZATION ONLY (issue #1502): +// These assertions record current legacy behavior, including known defects. +// They MUST be deliberately replaced with expected behavior when implementing +// an isolated standard-CCT runtime. They are not correctness endorsements. +const test = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const path = require('node:path'); +const vm = require('node:vm'); + +const root = path.resolve(__dirname, '..'); +const legacySource = fs.readFileSync(path.join(root, 'lib', 'TuyaZigBeeLightDevice.js'), 'utf8'); + +function makeHarness({ withMode = false, rejectVendor = false, reportMired = 255 } = {}) { + const calls = []; + const registrations = new Map(); + const reportedCapabilities = new Map(); + const capabilities = new Set(['light_temperature', ...(withMode ? ['light_mode'] : [])]); + const CLUSTER = { + ON_OFF: { NAME: 'onOff' }, + LEVEL_CONTROL: { NAME: 'levelControl' }, + COLOR_CONTROL: { NAME: 'colorControl' }, + }; + + const colorControl = { + async tuyaRgbMode(payload) { + calls.push({ command: 'tuyaRgbMode', payload }); + if (rejectVendor) throw new Error('UNSUPPORTED_COMMAND: tuyaRgbMode'); + return true; + }, + async moveToColorTemperature(payload) { + calls.push({ command: 'moveToColorTemperature', payload }); + return true; + }, + async readAttributes() { + return { + colorTemperatureMireds: reportMired, + colorMode: 'colorTemperatureMireds', + }; + }, + }; + class StubZigBeeDevice { + constructor() { + this.zclNode = { endpoints: { 1: { clusters: { colorControl } } } }; + this.values = { light_temperature: 0.25 }; + } + hasCapability(id) { return capabilities.has(id); } + getCapabilityValue(id) { return this.values[id]; } + setCapabilityValue(id, value) { + reportedCapabilities.set(id, value); + this.values[id] = value; + return Promise.resolve(); + } + registerMultipleCapabilities(definitions) { + definitions.forEach(definition => registrations.set(definition.capabilityId, definition)); + } + getClusterEndpoint(cluster) { + return cluster === CLUSTER.COLOR_CONTROL ? 1 : null; + } + debug() {} + log() {} + error() {} + } + + const fakeRequire = moduleName => { + if (moduleName === 'homey-zigbeedriver') return { ZigBeeDevice: StubZigBeeDevice }; + if (moduleName === 'zigbee-clusters') return { CLUSTER, Cluster: { addCluster() {} } }; + if (moduleName === './TuyaColorControlCluster') return class MockColorControlCluster {}; + if (moduleName === './util') return { + limitValue: x => x, + calculateLevelControlTransitionTime: () => 0, + calculateColorControlTransitionTime: () => 0, + wrapAsyncWithRetry: action => action(), + wait: () => Promise.resolve(), + }; + throw new Error('Unexpected dependency in audit harness: ' + moduleName); + }; + const stubModule = { exports: {} }; + const factory = vm.runInNewContext( + '(function(require,module,exports){' + legacySource + '\n})' + ); + factory(fakeRequire, stubModule, stubModule.exports); + return { + instance: new stubModule.exports(), + calls, + registrations, + reportedCapabilities, + }; +} + +test('audit: exact existing shared-runtime blast radius is 15 light-temperature driver IDs', () => { + const expected = [ + 'dimmable_led_strip', + 'dimmable_recessed_led', + 'rgb_bulb_E14', + 'rgb_bulb_E27', + 'rgb_ceiling_led_light', + 'rgb_floor_led_light', + 'rgb_led_light_bar', + 'rgb_led_strip', + 'rgb_mood_light', + 'rgb_spot_GU10', + 'rgb_spot_GardenLight', + 'rgb_wall_led_light', + 'tunable_bulb_E14', + 'tunable_bulb_E27', + 'tunable_spot_GU10', + ]; + const manifest = JSON.parse(fs.readFileSync(path.join(root, 'app.json'), 'utf8')); + for (const id of expected) { + const profile = manifest.drivers.find(driver => driver.id === id); + assert.ok(profile, 'existing paired-driver identity must not disappear: ' + id); + assert.ok(profile.capabilities.includes('light_temperature'), 'existing temp capability: ' + id); + const device = fs.readFileSync(path.join(root, 'drivers', id, 'device.js'), 'utf8'); + assert.match(device, /require\('\.\.\/\.\.\/lib\/TuyaZigBeeLightDevice'\)/); + assert.match(device, /extends TuyaZigBeeLightDevice/); + } + assert.equal(expected.length, 15); +}); + +test('audit: actual registered legacy parser has 254 scale and returns invalid negative reports at 255/500 mired', async () => { + const h = makeHarness(); + await h.instance.registerColorCapabilities({ zclNode: h.instance.zclNode }); + const options = h.registrations.get('light_temperature').userOpts; + assert.equal(options.setParser(0).colorTemperature, 0); + assert.equal(options.setParser(1).colorTemperature, 254); + assert.equal(options.reportParser(153), 1 - 153 / 254); + assert.ok(options.reportParser(255) < 0, '#113 observed physical mired 255 maps below Homey 0'); + assert.ok(options.reportParser(500) < 0, 'reported 500 mired maps below Homey 0'); + assert.equal(options.set, 'moveToColorTemperature'); +}); + +test('audit: actual command path inverts the registered setParser endpoints', async () => { + const h = makeHarness(); + await h.instance.registerColorCapabilities({ zclNode: h.instance.zclNode }); + const options = h.registrations.get('light_temperature').userOpts; + await h.instance.changeColorTemperature(0); + await h.instance.changeColorTemperature(1); + const requested = h.calls + .filter(call => call.command === 'moveToColorTemperature') + .map(call => call.payload.colorTemperature); + assert.equal(options.setParser(0).colorTemperature, 0); + assert.equal(options.setParser(1).colorTemperature, 254); + assert.equal(requested[0], 254, 'changeColorTemperature(0) is opposite to setParser(0)'); + assert.equal(requested[1], 0, 'changeColorTemperature(1) is opposite to setParser(1)'); + assert.deepEqual(h.calls.map(call => call.command), [ + 'tuyaRgbMode', 'moveToColorTemperature', + 'tuyaRgbMode', 'moveToColorTemperature', + ]); +}); + +test('audit: rejected proprietary Tuya mode command prevents standard CCT command in current implementation', async () => { + const h = makeHarness({ rejectVendor: true }); + await assert.rejects(h.instance.changeColorTemperature(0.5), /UNSUPPORTED_COMMAND/); + assert.deepEqual(h.calls.map(call => call.command), ['tuyaRgbMode']); + // This is only a code-path proof: no claim is made that #113/#271 hardware rejects F0. +}); + +test('audit: light_mode and announce paths also use legacy inverted scale', async () => { + const h = makeHarness({ withMode: true, reportMired: 255 }); + await h.instance.registerColorCapabilities({ zclNode: h.instance.zclNode }); + const modeOptions = h.registrations.get('light_mode').userOpts; + await modeOptions.setParser.call(h.instance, 'temperature', {}); + assert.equal(h.calls.at(-1).command, 'moveToColorTemperature'); + assert.equal(h.calls.at(-1).payload.colorTemperature, Math.round(254 - 0.25 * 254)); + await h.instance.onEndDeviceAnnounce(); + assert.ok(h.reportedCapabilities.get('light_temperature') < 0); +}); + +test.todo('acceptance: all direct, grouped, light_mode and announce conversions agree in both directions'); +test.todo('acceptance: all emitted and reported mireds honor separately established physical min/max bounds'); +test.todo('acceptance: standard CCT profiles do not require vendor F0 commands; legacy RGB behavior stays unchanged'); diff --git a/test/rain-sensor-mowe-profile.test.js b/test/rain-sensor-mowe-profile.test.js new file mode 100644 index 0000000000..2ec97fd645 --- /dev/null +++ b/test/rain-sensor-mowe-profile.test.js @@ -0,0 +1,120 @@ +'use strict'; + +const test = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const path = require('node:path'); +const vm = require('node:vm'); +const id = 'rain_sensor_mowe'; +const profile = require('../drivers/' + id + '/driver.compose.json'); +const app = require('../app.json'); + +test('#1288/#473 MOWE uses only its physically interviewed standard IAS identity', () => { + assert.equal(profile.id, id); + assert.deepEqual(profile.zigbee.manufacturerName, ['_TZ3000_o9f2zqln']); + assert.deepEqual(profile.zigbee.productId, ['TS0207']); + assert.deepEqual(profile.zigbee.endpoints, { + '1': { clusters: [0, 1, 3, 1280], bindings: [1, 1280] }, + }); + assert.deepEqual(profile.capabilities, ['alarm_water', 'measure_battery', 'alarm_battery']); + assert.deepEqual(profile.energy.batteries, ['OTHER'], 'actual physical battery type/count is still unknown'); + const matches = app.drivers.filter(d => + d.zigbee?.manufacturerName?.includes('_TZ3000_o9f2zqln') && + d.zigbee?.productId?.includes('TS0207')); + assert.deepEqual(matches.map(d => d.id), [id]); + assert.deepEqual(matches[0].capabilities, profile.capabilities); + assert.deepEqual(matches[0].energy, profile.energy); + assert.equal(matches[0].settings, undefined); + const solar = app.drivers.find(d => d.id === 'rain_sensor'); + assert.deepEqual(solar.zigbee.manufacturerName, ['_TZ3210_tgvtvdoc']); + assert.ok(!JSON.stringify(profile).includes('61184'), 'MW815R does not announce Tuya EF00'); + for (const unused of ['measure_luminance', 'measure_voltage.rain', 'alarm_cleaning']) { + assert.ok(!profile.capabilities.includes(unused), 'no unsupported solar/DP105 capability: ' + unused); + } +}); + +function loadRuntime() { + const source = fs.readFileSync(path.join(__dirname, '..', 'drivers', id, 'device.js'), 'utf8'); + const fakeModule = { exports: {} }; + class MockZigBeeDevice { + constructor() { + this.values = []; + this.errors = []; + this.error = (...args) => this.errors.push(args); + } + setCapabilityValue(capability, value) { + this.values.push([capability, value]); + return Promise.resolve(); + } + } + const loader = vm.runInNewContext('(function(require,module,exports){' + source + '\n})'); + loader(name => { + if (name === 'homey-zigbeedriver') return { ZigBeeDevice: MockZigBeeDevice }; + if (name === 'zigbee-clusters') return { CLUSTER: { + IAS_ZONE: { NAME: 'iasZone' }, + POWER_CONFIGURATION: { NAME: 'powerConfiguration' }, + } }; + throw new Error('Unexpected dependency: ' + name); + }, fakeModule, fakeModule.exports); + return { Device: fakeModule.exports, source }; +} + +test('isolated MW815R runtime registers IAS enrollment, wet/dry and normal battery listeners without startup traffic', async () => { + const { Device, source } = loadRuntime(); + const events = {}; + const enrollments = []; + const iasZone = { + zoneEnrollResponse(payload) { enrollments.push(payload); return Promise.resolve(); }, + }; + const powerConfiguration = { + on(name, callback) { events[name] = callback; }, + }; + const device = new Device(); + await device.onNodeInit({ zclNode: { endpoints: { 1: { + clusters: { iasZone, powerConfiguration }, + } } } }); + assert.equal(typeof iasZone.onZoneEnrollRequest, 'function'); + assert.equal(typeof iasZone.onZoneStatusChangeNotification, 'function'); + assert.equal(typeof events['attr.batteryPercentageRemaining'], 'function'); + assert.deepEqual(enrollments, [], 'no unsolicited Zigbee commands during startup'); + + iasZone.onZoneEnrollRequest(); + assert.equal(enrollments.length, 1); + assert.equal(enrollments[0].enrollResponseCode, 0); + assert.equal(enrollments[0].zoneId, 0); + + iasZone.onZoneStatusChangeNotification({ + zoneStatus: { alarm1: true, battery: false }, + }); + iasZone.onZoneStatusChangeNotification({ + zoneStatus: { alarm1: false, battery: true }, + }); + assert.deepEqual(device.values.slice(0, 4), [ + ['alarm_water', true], ['alarm_battery', false], + ['alarm_water', false], ['alarm_battery', true], + ]); + events['attr.batteryPercentageRemaining'](200); + events['attr.batteryPercentageRemaining'](105); + events['attr.batteryPercentageRemaining'](0); + events['attr.batteryPercentageRemaining'](255); + events['attr.batteryPercentageRemaining'](-1); + events['attr.batteryPercentageRemaining'](false); + assert.deepEqual(device.values.slice(4), [ + ['measure_battery', 100], ['measure_battery', 52.5], ['measure_battery', 0], + ]); + assert.equal(device.errors.length, 0); + assert.doesNotMatch(source, /TuyaSpecific|sendFrame|readAttributes|writeAttributes|\\bcase\\s+105\\b|Cluster\\.addCluster/); +}); + +test('missing IAS flags do not turn a previously active rain alarm off', async () => { + const { Device } = loadRuntime(); + const iasZone = {}; + const powerConfiguration = { on() {} }; + const device = new Device(); + await device.onNodeInit({ zclNode: { endpoints: { 1: { + clusters: { iasZone, powerConfiguration }, + } } } }); + iasZone.onZoneStatusChangeNotification({ zoneStatus: {} }); + iasZone.onZoneStatusChangeNotification({ zoneStatus: null }); + assert.deepEqual(device.values, []); +}); diff --git a/test/repository.test.js b/test/repository.test.js index eafa28f4c0..49bed08d58 100644 --- a/test/repository.test.js +++ b/test/repository.test.js @@ -579,6 +579,7 @@ test('shared Tuya write helpers propagate Zigbee failures', () => { ); assert.ok(match, method); assert.match(match[1], /catch \(err\)[\s\S]*throw err;/, method); + assert.doesNotMatch(match[1], /this\.error\(/, method); } }); @@ -1780,8 +1781,12 @@ test('Smart Knob uses bound clusters for press and rotation', () => { assert.match(source, /onMove: payload => triggerRotation\(payload, 'move'\)/); assert.match(source, /const button = mode === 'down' \? 'left' : 'right'/); - // Raw frames are retained only for the unverified Color Control hold path. - assert.match(source, /if \(clusterId !== CLUSTER\.COLOR_CONTROL\.ID\) return/); + // Raw Color Control handling must wrap, never replace, ZCLNode's frame handler. + assert.match(source, /const zclHandleFrame = node\.handleFrame/); + assert.match( + source, + /if \(clusterId !== CLUSTER\.COLOR_CONTROL\.ID\) \{[\s\S]*return zclHandleFrame\(endpointId, clusterId, frame, meta\)/ + ); assert.doesNotMatch(source, /\[8, 6, 768\]\.includes\(clusterId\)/); assert.doesNotMatch(source, /case 8:/); @@ -1793,3 +1798,45 @@ test('Smart Knob uses bound clusters for press and rotation', () => { assert.match(levelSource, /step\(payload\)/); assert.match(levelSource, /move\(payload\)/); }); + + +test('2-gang curtain subdevice requires ZigBeeDriver', () => { + const manifest = require('../drivers/curtain_module_2_gang/driver.compose.json'); + const source = fs.readFileSync( + path.join(root, 'drivers', 'curtain_module_2_gang', 'driver.js'), + 'utf8' + ); + + assert.ok(manifest.zigbee?.devices?.secondModule); + assert.match(source, /require\(['"]homey-zigbeedriver['"]\)/); + assert.match(source, /class\s+\w+\s+extends\s+ZigBeeDriver/); +}); + + +test('expected Zigbee reachability errors stay compact during startup', () => { + const { isDeviceUnreachableError } = require('../lib/util'); + const unreachable = new Error('Could not reach device. Is it powered on?'); + + assert.equal(isDeviceUnreachableError(unreachable), true); + assert.equal(isDeviceUnreachableError(new Error('FAILURE')), false); + assert.equal(isDeviceUnreachableError(new Error('Could not reach device for another reason')), false); + + const light = fs.readFileSync( + path.join(root, 'lib', 'TuyaZigBeeLightDevice.js'), + 'utf8' + ); + const siren = fs.readFileSync( + path.join(root, 'drivers', 'sirentemphumidsensor', 'device.js'), + 'utf8' + ); + + assert.match(light, /_logStartupUnreachable\(\)/); + assert.match(light, /skipping remaining startup reads/); + assert.match(light, /if \(!this\._startupDeviceUnreachable\)/); + assert.doesNotMatch(light, /setUnavailable\(|setAvailable\(/); + + assert.match(siren, /for \(const \[label, run\] of steps\)/); + assert.match(siren, /isDeviceUnreachableError\(error\)/); + assert.match(siren, /skipping remaining bootstrap commands/); + assert.doesNotMatch(siren, /setUnavailable\(|setAvailable\(/); +}); diff --git a/test/smart-knob-scene-regression.test.js b/test/smart-knob-scene-regression.test.js new file mode 100644 index 0000000000..b23b304b7f --- /dev/null +++ b/test/smart-knob-scene-regression.test.js @@ -0,0 +1,151 @@ +'use strict'; + +// Behavioural regression coverage of the actual driver source in an isolated +// Homey/Zigbee stub. Hardware acceptance remains tracked separately in #1389. +const test = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const path = require('node:path'); +const vm = require('node:vm'); + +const driverPath = path.resolve(__dirname, '../drivers/smart_knob_switch/device.js'); + +async function createKnob() { + const events = []; + const forwarded = []; + const bindings = new Map(); + const node = { + handleFrame(...args) { + forwarded.push(args); + return 'original-zcl-handler'; + }, + }; + + class ZigBeeDevice { + hasCapability() { return true; } + log() {} + error(err) { throw err; } + } + + class OnOffBound { + constructor(callbacks) { this.callbacks = callbacks; } + } + + class LevelBound { + constructor(callbacks) { this.callbacks = callbacks; } + } + + const required = { + 'homey-zigbeedriver': { ZigBeeDevice }, + 'zigbee-clusters': { + CLUSTER: { + ON_OFF: { NAME: 'onOff', ID: 6 }, + LEVEL_CONTROL: { NAME: 'levelControl', ID: 8 }, + COLOR_CONTROL: { NAME: 'colorControl', ID: 768 }, + }, + }, + '../../lib/TuyaRemoteOnOffBoundCluster': OnOffBound, + '../../lib/LevelControlBoundCluster': LevelBound, + }; + const module = { exports: {} }; + vm.runInNewContext(fs.readFileSync(driverPath, 'utf8'), { + module, + Buffer, + Promise, + Date, + require(name) { + assert.ok(Object.hasOwn(required, name), `Unexpected import: ${name}`); + return required[name]; + }, + }, { filename: driverPath }); + + const device = new module.exports(); + device.homey = { zigbee: { getNode: async () => node } }; + device.driver = { + buttonTrigger: { + trigger(_device, _tokens, state) { + events.push(state.button); + return Promise.resolve(); + }, + }, + }; + await device.onNodeInit({ + zclNode: { + endpoints: { + 1: { bind(name, handler) { bindings.set(name, handler); } }, + }, + }, + }); + + const frame = data => ({ toJSON: () => ({ data }) }); + return { events, forwarded, bindings, node, frame, device }; +} + +test('TS004F Dimmer Mode step/move directions use correct ZCL enum fields', async () => { + const { events, bindings } = await createKnob(); + const level = bindings.get('levelControl').callbacks; + assert.ok(level, 'level control must be bound'); + + await level.onStep({ mode: 'up' }); + await level.onStep({ mode: 'down' }); + await level.onStepWithOnOff({ mode: 'down' }); + await level.onMove({ moveMode: 'up' }); + await level.onMove({ moveMode: 'down' }); + await level.onMoveWithOnOff({ moveMode: 'down' }); + assert.deepEqual(events, ['right', 'left', 'left', 'right', 'left', 'left']); + + await level.onMove({ mode: 'up' }); // malformed Move: no moveMode + await level.onStep({ mode: 'sideways' }); + assert.equal(events.length, 6, 'invalid move payloads must not become clockwise turns'); +}); + +test('TS004F Scene Mode proprietary FC/FD frames produce actions without swallowing normal ZCL', async () => { + const { events, node, forwarded, frame } = await createKnob(); + + await node.handleFrame(1, 6, frame([0x11, 0x71, 0xFC, 0]), {}); + await node.handleFrame(1, 6, frame([0x11, 0x72, 0xFC, 1]), {}); + assert.deepEqual(events, ['right', 'left']); + + await node.handleFrame(1, 6, frame([0x11, 0x73, 0xFD, 0]), {}); + assert.deepEqual(events, ['right', 'left', 'press']); + + // Unknown values/lengths, standard OnOff commands, and other clusters + // are forwarded to the original ZCL handler, not invented as actions. + const malformed = [ + [0x11, 0x74, 0xFC, 2], + [0x11, 0x75, 0xFD, 99], + [0x11, 0x76, 0xFC], + [0x11, 0x77, 0x02], + ]; + for (const data of malformed) { + assert.equal(node.handleFrame(1, 6, frame(data), {}), 'original-zcl-handler'); + } + assert.equal(node.handleFrame(1, 8, frame([0x11, 0x78, 0x02, 0]), {}), 'original-zcl-handler'); + assert.equal(forwarded.length, 5); + assert.equal(events.length, 3); +}); + +test('TS004F repeated press bursts remain debounced, but rotation never is', async () => { + const { events, bindings, node, frame, device } = await createKnob(); + const onOff = bindings.get('onOff').callbacks; + + await onOff.onSingle('toggle'); + await node.handleFrame(1, 6, frame([0x11, 0x10, 0xFD, 0]), {}); + assert.deepEqual(events, ['press']); + + await node.handleFrame(1, 6, frame([0x11, 0x11, 0xFC, 0]), {}); + await node.handleFrame(1, 6, frame([0x11, 0x12, 0xFC, 0]), {}); + assert.deepEqual(events, ['press', 'right', 'right']); + + device._lastPressAt = Date.now() - 300; + await node.handleFrame(1, 6, frame([0x11, 0x13, 0xFD, 1]), {}); + assert.deepEqual(events, ['press', 'right', 'right', 'press']); +}); + +test('legacy Color Control hold actions still work on the raw path', async () => { + const { events, node, forwarded, frame } = await createKnob(); + await node.handleFrame(1, 768, frame([0x11, 0x15, 0x4C, 3]), {}); + await node.handleFrame(1, 768, frame([0x11, 0x16, 0x4C, 1]), {}); + assert.deepEqual(events, ['hold-left', 'hold-right']); + assert.equal(forwarded.length, 0); +}); diff --git a/test/standard-cct-preflight.test.js b/test/standard-cct-preflight.test.js new file mode 100644 index 0000000000..4aa411c039 --- /dev/null +++ b/test/standard-cct-preflight.test.js @@ -0,0 +1,138 @@ +'use strict'; + +const test = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const path = require('node:path'); +const { Cluster, CLUSTER, ColorControlCluster } = require('zigbee-clusters'); +const TuyaColorControlCluster = require('../lib/TuyaColorControlCluster'); +const { + requireVerifiedRange, homeyToMired, miredToHomey, +} = require('../lib/StandardCctRange'); + +const physicalAttributes = [ + ['colorCapabilities', 0x400a], + ['colorTempPhysicalMinMireds', 0x400b], + ['colorTempPhysicalMaxMireds', 0x400c], +]; + +test('installed zigbee-clusters 2.4.1 exposes required standard CCT metadata', () => { + const app = require('../package.json'); + assert.equal(app.dependencies['zigbee-clusters'], '2.4.1'); + for (const [name, id] of physicalAttributes) { + assert.equal(ColorControlCluster.ATTRIBUTES[name].id, id); + } +}); + +test('current Tuya Color Control override removes standard CCT metadata, not merely extends it', () => { + for (const [name] of physicalAttributes) { + assert.equal(TuyaColorControlCluster.ATTRIBUTES[name], undefined, name); + } + const source = fs.readFileSync( + path.resolve(__dirname, '..', 'lib', 'TuyaZigBeeLightDevice.js'), 'utf8' + ); + assert.match(source, /Cluster\.addCluster\(TuyaColorControlCluster\)/); +}); + +test('actual 2.4.1 cluster rejects unavailable physical attributes before any Zigbee traffic', async () => { + const previouslyRegistered = Cluster.getCluster(CLUSTER.COLOR_CONTROL.ID); + assert.ok(previouslyRegistered); + let sent = 0; + try { + Cluster.addCluster(TuyaColorControlCluster); + assert.equal(Cluster.getCluster(CLUSTER.COLOR_CONTROL.ID), TuyaColorControlCluster); + const color = new TuyaColorControlCluster({ + sendFrame() { + sent += 1; + throw new Error('Unexpected outbound Zigbee frame'); + }, + }); + for (const [name] of physicalAttributes) { + await assert.rejects( + color.readAttributes([name]), + new RegExp(name + ' is not a valid attribute') + ); + } + assert.equal(sent, 0); + } finally { + // Node's test-file process is isolated; restore anyway. + Cluster.addCluster(previouslyRegistered); + } +}); + +test('isolated mapper fails closed without confirmed per-device physical CCT metadata', () => { + assert.throws(() => requireVerifiedRange(undefined), /not confirmed/); + assert.throws(() => requireVerifiedRange({ colorCapabilities: { colorTemperature: false } }), /not confirmed/); + assert.throws(() => requireVerifiedRange({ colorCapabilities: { colorTemperature: true } }), /not been verified/); + for (const [min, max] of [[0,500], [153,153], [500,153], [153,0xffff], [-1,500], [153.5,500]]) { + assert.throws( + () => requireVerifiedRange({ + colorCapabilities: { colorTemperature: true }, + colorTempPhysicalMinMireds: min, + colorTempPhysicalMaxMireds: max, + }), /not been verified/, + 'rejected invalid physical range: ' + min + '/' + max + ); + } + assert.throws(() => homeyToMired(0.5, undefined), /Verified CCT range/); + assert.throws(() => miredToHomey(200, undefined), /Verified CCT range/); +}); + +test('isolated mapper matches Homey 2.1.4 orientation and round trips verified 153–500 EXAMPLE bounds', () => { + // #178 observed this range, but is a DIFFERENT family: never default #113 or #271 to it. + const range = requireVerifiedRange({ + colorCapabilities: { colorTemperature: true }, + colorTempPhysicalMinMireds: 153, + colorTempPhysicalMaxMireds: 500, + }); + assert.deepEqual(range, { min: 153, max: 500 }); + assert.ok(Object.isFrozen(range)); + assert.equal(homeyToMired(0, range), 153); + assert.equal(homeyToMired(1, range), 500); + assert.equal(miredToHomey(153, range), 0); + assert.equal(miredToHomey(500, range), 1); + for (const requested of [0, .1, .25, .5, .75, .9, 1]) { + const mired = homeyToMired(requested, range); + assert.ok(mired >= range.min && mired <= range.max); + assert.ok( + Math.abs(miredToHomey(mired, range) - requested) <= 0.5 / (range.max - range.min) + Number.EPSILON, + 'round trip bounded by half one mired' + ); + } + assert.equal(miredToHomey(1, range), 0); + assert.equal(miredToHomey(1000, range), 1); +}); + +test('isolated mapper rejects invalid writes and Zigbee sentinel reports without issuing commands', () => { + const range = Object.freeze({ min: 200, max: 400 }); + for (const value of [-.1, 1.1, NaN, Infinity, -Infinity, undefined]) { + assert.throws(() => homeyToMired(value, range), /0–1/); + } + for (const value of [0, 0xffff, -1, NaN, 153.5, null, undefined]) { + assert.throws(() => miredToHomey(value, range), /invalid/); + } + assert.equal(homeyToMired(.5, range), 300); + assert.equal(miredToHomey(300, range), .5); +}); + +test('new standalone mapper is NOT imported by existing lights or the Homey app', () => { + const app = require('../app.json'); + const oldIds = [ + 'dimmable_led_strip', 'dimmable_recessed_led', 'rgb_bulb_E14', + 'rgb_bulb_E27', 'rgb_ceiling_led_light', 'rgb_floor_led_light', + 'rgb_led_light_bar', 'rgb_led_strip', 'rgb_mood_light', + 'rgb_spot_GU10', 'rgb_spot_GardenLight', 'rgb_wall_led_light', + 'tunable_bulb_E14', 'tunable_bulb_E27', 'tunable_spot_GU10', + ]; + const actual = app.drivers.filter(d => + d.class === 'light' && d.capabilities?.includes('light_temperature') + ).map(d => d.id); + assert.deepEqual([...actual].sort(), [...oldIds].sort()); + assert.ok(!app.drivers.some(d => /standard_cct|ts0501a_new|ts0502a_new/i.test(d.id))); + const common = fs.readFileSync(path.resolve(__dirname, '..', 'lib', 'TuyaZigBeeLightDevice.js'), 'utf8'); + assert.ok(!common.includes("require('./StandardCctRange')")); + for (const id of oldIds) { + const src = fs.readFileSync(path.resolve(__dirname, '..', 'drivers', id, 'device.js'), 'utf8'); + assert.ok(!src.includes('StandardCctRange')); + } +}); diff --git a/test/standard-ias-contact-1013.test.js b/test/standard-ias-contact-1013.test.js new file mode 100644 index 0000000000..04c16e5baf --- /dev/null +++ b/test/standard-ias-contact-1013.test.js @@ -0,0 +1,112 @@ +'use strict'; + +const test = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const path = require('node:path'); +const vm = require('node:vm'); +const app = require('../app.json'); +const root='contact_sensor_elivco_x8q36xwf'; +const profiles=[ + {id:root,m:'_TZ3000_x8q36xwf',p:'TS0203',poll:true,cells:['OTHER']}, + {id:'contact_sensor_ewelink_snzb04',m:'eWeLink',p:'SNZB-04',poll:true,cells:['OTHER']}, + {id:'contact_sensor_n8dljorx',m:'_TZE200_n8dljorx',p:'TS0601',poll:false,cells:['CR2032']}, +]; + +test('three physical #1013 standard IAS contacts have three independent exact matcher contracts',()=>{ + for(const x of profiles){ + const c=require('../drivers/'+x.id+'/driver.compose.json'); + assert.equal(c.id,x.id); + assert.deepEqual(c.zigbee.manufacturerName,[x.m]); + assert.deepEqual(c.zigbee.productId,[x.p]); + assert.deepEqual(c.zigbee.endpoints,{ + '1':{clusters:x.poll?[0,1,3,32,1280]:[0,1,3,1280],bindings:[1,1280]}, + }); + assert.deepEqual(c.capabilities,['alarm_contact','measure_battery','alarm_battery']); + assert.deepEqual(c.energy.batteries,x.cells); + assert.ok(!c.zigbee.endpoints['1'].clusters.includes(61184),'no EF00 merely due to TS0601'); + assert.ok(!c.capabilities.includes('measure_luminance'),'plain contact, not #1298 contact+lux'); + const matches=app.drivers.filter(d=>d.zigbee?.manufacturerName?.includes(x.m) + && d.zigbee?.productId?.includes(x.p)); + assert.deepEqual(matches.map(d=>d.id),[x.id]); + assert.deepEqual(matches[0].energy.batteries,x.cells); + assert.equal(matches[0].settings,undefined); + } + const existing=app.drivers.filter(d=>d.zigbee?.manufacturerName?.includes('zbeacon') + && d.zigbee?.productId?.includes('DS01')); + assert.deepEqual(existing.map(d=>d.id),['doorwindowsensor_4'],'#832 already supported, no cloned driver'); + const old=app.drivers.find(d=>d.id==='doorwindowsensor'); + assert.ok(old.zigbee.productId.includes('SNZB-04'),'shared legacy driver remains intact'); + assert.equal(old.zigbee.manufacturerName.includes('eWeLink'),false, + 'do not extend old Cartesian matcher with unrelated eWeLink product IDs'); + for(const a of profiles)for(const b of profiles)if(a!==b) { + const cross=app.drivers.filter(d=>d.zigbee?.manufacturerName?.includes(a.m) + && d.zigbee?.productId?.includes(b.p)); + assert.deepEqual(cross.map(d=>d.id),[],'no accidental cross pairing'); + } + for(const x of profiles.slice(1)){ + const code=fs.readFileSync(path.join(__dirname,'..','drivers',x.id,'device.js'),'utf8'); + assert.ok(code.includes("module.exports = require('../"+root+"/device')")); + } + const own=fs.readFileSync(path.join(__dirname,'..','drivers',root,'device.js'),'utf8'); + assert.doesNotMatch(own,/TuyaDataPoints|TuyaSpecificCluster|sendFrame|readAttributes|writeAttributes|Cluster\.addCluster/); +}); + +function harness(){ + const code=fs.readFileSync(path.join(__dirname,'..','drivers',root,'device.js'),'utf8'); + const mod={exports:{}},errors=[]; + class ZigBeeDevice { + constructor(){this.values=[];this.error=e=>errors.push(e);} + setCapabilityValue(cap,value){this.values.push([cap,value]);return Promise.resolve();} + } + const cluster={IAS_ZONE:{NAME:'iasZone'},POWER_CONFIGURATION:{NAME:'powerConfiguration'}}; + const factory=vm.runInNewContext('(function(require,module,exports){'+code+'\n})'); + factory(name=>{ + if(name==='homey-zigbeedriver')return {ZigBeeDevice}; + if(name==='zigbee-clusters')return {CLUSTER:cluster}; + throw Error('Unexpected dependency '+name); + },mod,mod.exports); + const device=new mod.exports(); + const subscriptions={}; + const ias={ + response:[], + zoneEnrollResponse(payload){this.response.push(payload);return Promise.resolve();}, + }; + const battery={on(event,callback){subscriptions[event]=callback;}}; + return {device,ias,subscriptions,errors,zclNode:{endpoints:{1:{clusters:{iasZone:ias,powerConfiguration:battery}}}}}; +} + +test('isolated standard IAS contact runtime supports open/closed and low-battery without startup reads',async()=>{ + const {device,ias,subscriptions,errors,zclNode}=harness(); + await device.onNodeInit({zclNode}); + assert.equal(typeof ias.onZoneStatusChangeNotification,'function'); + assert.equal(typeof ias.onZoneEnrollRequest,'function'); + assert.equal(typeof subscriptions['attr.batteryPercentageRemaining'],'function'); + assert.deepEqual(device.values,[]); + assert.deepEqual(ias.response,[]); + ias.onZoneEnrollRequest(); + await Promise.resolve();await Promise.resolve(); + assert.equal(ias.response.length,1); + assert.equal(ias.response[0].enrollResponseCode,0); + assert.equal(ias.response[0].zoneId,0); + ias.onZoneStatusChangeNotification({zoneStatus:{alarm1:true,battery:false}}); + ias.onZoneStatusChangeNotification({zoneStatus:{alarm1:false,battery:true}}); + ias.onZoneStatusChangeNotification({zoneStatus:{alarm1:true}}); + ias.onZoneStatusChangeNotification({zoneStatus:{}}); + ias.onZoneStatusChangeNotification({zoneStatus:null}); + ias.onZoneStatusChangeNotification({}); + assert.deepEqual(device.values,[ + ['alarm_contact',true],['alarm_battery',false], + ['alarm_contact',false],['alarm_battery',true], + ['alarm_contact',true], + ],'a partial IAS report cannot false-close an existing contact'); + subscriptions['attr.batteryPercentageRemaining'](200); + subscriptions['attr.batteryPercentageRemaining'](101); + subscriptions['attr.batteryPercentageRemaining'](0); + for(const invalid of [255,-1,NaN,null,false,'200',201,21.5]) + subscriptions['attr.batteryPercentageRemaining'](invalid); + assert.deepEqual(device.values.slice(5),[ + ['measure_battery',100],['measure_battery',50.5],['measure_battery',0], + ]); + assert.deepEqual(errors,[]); +}); diff --git a/test/standard-ias-leak-1041.test.js b/test/standard-ias-leak-1041.test.js new file mode 100644 index 0000000000..ff55a808ba --- /dev/null +++ b/test/standard-ias-leak-1041.test.js @@ -0,0 +1,75 @@ +'use strict'; + +const test = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const path = require('node:path'); +const vm = require('node:vm'); +const app = require('../app.json'); +const id = 'flood_sensor_unverified_battery'; +const compose = require('../drivers/' + id + '/driver.compose.json'); +const names = [ + { manufacturer: '_TZ3000_bzt33cyu', original: 1041 }, + { manufacturer: '_TZ3000_4qaowtdo', original: 1032 }, + { manufacturer: '_TZ3000_qhozxs2b', original: 952 }, +]; + +test('#1041 exact physically interviewed TS0207 standard-IAS family retains separate battery metadata', () => { + assert.equal(compose.id, id); + assert.deepEqual(compose.zigbee.manufacturerName, names.map(x=>x.manufacturer)); + assert.deepEqual(compose.zigbee.productId, ['TS0207']); + assert.deepEqual(compose.zigbee.endpoints, {'1': { + clusters: [0,1,3,1280], bindings: [1,1280], + }}); + assert.deepEqual(compose.capabilities, ['alarm_water','alarm_battery']); + assert.deepEqual(compose.energy.batteries, ['OTHER']); + assert.ok(!JSON.stringify(compose).includes('61184'), 'no Tuya EF00/DP parsing'); + for (const {manufacturer} of names) { + const matches=app.drivers.filter(d=>d.zigbee?.manufacturerName?.includes(manufacturer) + && d.zigbee?.productId?.includes('TS0207')); + assert.deepEqual(matches.map(d=>d.id),[id]); + assert.deepEqual(matches[0].energy.batteries,['OTHER']); + } + assert.deepEqual(app.drivers.filter(d=>d.id===id).length,1); + const legacy=app.drivers.find(d=>d.id==='flood_sensor'); + const legacy2=app.drivers.find(d=>d.id==='flood_sensor_2'); + assert.ok(legacy.zigbee.manufacturerName.includes('_TZ3000_bfopm9ga')); + assert.deepEqual(legacy.energy.batteries,['CR2032']); + assert.deepEqual(legacy2.zigbee.manufacturerName,['_TZ3000_baeiitad']); + assert.deepEqual(legacy2.energy.batteries,['AAA','AAA']); + const rain=app.drivers.find(d=>d.id==='rain_sensor_mowe'); + assert.deepEqual(rain.zigbee.manufacturerName,['_TZ3000_o9f2zqln']); + const src=fs.readFileSync(path.join(__dirname,'..','drivers',id,'device.js'),'utf8'); + assert.match(src,/module\.exports = require\('\.\.\/flood_sensor\/device'\)/); + assert.doesNotMatch(src,/TuyaSpecificCluster|TuyaDataPoints|readAttributes|writeAttributes/); +}); + +test('inherited IAS water runtime registers reports and maps wet/dry + low battery without startup commands',async()=>{ + const src=fs.readFileSync(path.join(__dirname,'..','drivers','flood_sensor','device.js'),'utf8'); + const out={exports:{}}; + class ZigBeeDevice{ + constructor(){this.values=[];this.error=e=>{throw e};this.log=()=>{};} + setCapabilityValue(id,value){this.values.push([id,value]);return Promise.resolve();} + } + const f=vm.runInNewContext('(function(require,module,exports){'+src+'\n})'); + f(name=>{ + if(name==='homey-zigbeedriver')return {ZigBeeDevice}; + if(name==='zigbee-clusters')return {CLUSTER:{IAS_ZONE:{NAME:'iasZone'}}}; + throw Error('Unexpected dependency: '+name); + },out,out.exports); + const d=new out.exports(); + const iasZone={}; + await d.onNodeInit({zclNode:{endpoints:{1:{clusters:{iasZone}}}}}); + assert.equal(typeof iasZone.onZoneStatusChangeNotification,'function'); + assert.deepEqual(d.values,[],'no unsolicited startup read/write'); + iasZone.onZoneStatusChangeNotification({zoneStatus:{alarm1:false,battery:false}}); + iasZone.onZoneStatusChangeNotification({zoneStatus:{alarm1:true,battery:true}}); + iasZone.onZoneStatusChangeNotification({zoneStatus:{alarm1:false,battery:false}}); + assert.deepEqual(d.values,[ + ['alarm_water',false],['alarm_battery',false], + ['alarm_water',true],['alarm_battery',true], + ['alarm_water',false],['alarm_battery',false], + ]); + assert.equal(d.values.some(([name])=>name==='measure_battery'),false, + 'existing legacy runtime has no battery percentage listener: no phantom capability'); +}); diff --git a/test/standard-ias-motion-lux-1481.test.js b/test/standard-ias-motion-lux-1481.test.js new file mode 100644 index 0000000000..e9f4d5a25d --- /dev/null +++ b/test/standard-ias-motion-lux-1481.test.js @@ -0,0 +1,133 @@ +'use strict'; + +const test = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const path = require('node:path'); +const vm = require('node:vm'); +const app = require('../app.json'); +const luxConverter = require('../drivers/illuminance_sensor/measurements'); +const root='motion_lux_hobeian_zg204zl'; +const profiles=[ + {id:root,m:'HOBEIAN',p:'ZG-204ZL'}, + {id:'motion_lux_kb5noeto',m:'_TZE200_kb5noeto',p:'TS0601'}, +]; + +test('#1481: exact IAS motion/lux profiles have no EF00 or Cartesian manufacturer/product collisions',()=>{ + for(const x of profiles){ + const c=require('../drivers/'+x.id+'/driver.compose.json'); + assert.equal(c.id,x.id); + assert.deepEqual(c.zigbee.manufacturerName,[x.m]); + assert.deepEqual(c.zigbee.productId,[x.p]); + assert.deepEqual(c.zigbee.endpoints,{ + '1':{clusters:[0,1,3,1024,1280],bindings:[1,1024,1280]}, + }); + assert.deepEqual(c.capabilities,['alarm_motion','measure_luminance','measure_battery','alarm_battery']); + assert.deepEqual(c.energy.batteries,['OTHER']); + const matches=app.drivers.filter(d=>d.zigbee?.manufacturerName?.includes(x.m) + && d.zigbee?.productId?.includes(x.p)); + assert.deepEqual(matches.map(d=>d.id),[x.id]); + assert.deepEqual(matches[0].energy.batteries,['OTHER']); + assert.equal(matches[0].settings,undefined); + } + assert.deepEqual(app.drivers.filter(d=>d.zigbee?.manufacturerName?.includes('HOBEIAN') + && d.zigbee?.productId?.includes('TS0601')).map(d=>d.id),[]); + assert.deepEqual(app.drivers.filter(d=>d.zigbee?.manufacturerName?.includes('_TZE200_kb5noeto') + && d.zigbee?.productId?.includes('ZG-204ZL')).map(d=>d.id),[]); + assert.deepEqual(app.drivers.filter(d=>d.zigbee?.manufacturerName?.includes('eWeLink') + && d.zigbee?.productId?.includes('SNZB-03')).map(d=>d.id),[], + 'physical PIR/water shared SNZB-03 fingerprint (#1113/#1475) is NOT safe for naive matcher'); + assert.ok(!app.drivers.find(d=>d.id==='motion_sensor_2').zigbee.manufacturerName.includes('_TZE200_kb5noeto'), + 'do not put standard-only profile into frozen EF00 runtime'); + const own=fs.readFileSync(path.join(__dirname,'..','drivers',root,'device.js'),'utf8'); + const alias=fs.readFileSync(path.join(__dirname,'..','drivers','motion_lux_kb5noeto','device.js'),'utf8'); + assert.ok(alias.includes("module.exports = require('../"+root+"/device')")); + assert.doesNotMatch(own,/TuyaDataPoints|TuyaSpecificCluster|sendFrame|writeAttributes|Cluster\.addCluster/); +}); + +function harness(firstInit=true,failReport=false){ + const code=fs.readFileSync(path.join(__dirname,'..','drivers',root,'device.js'),'utf8'); + const mod={exports:{}},cluster={ + IAS_ZONE:{NAME:'iasZone'},POWER_CONFIGURATION:{NAME:'powerConfiguration'}, + ILLUMINANCE_MEASUREMENT:{NAME:'illuminanceMeasurement'}, + }; + class MockZigBeeDevice{ + constructor(){this.values=[];this.reporting=[];this.logs=[];this.errors=[]; + this.error=(...args)=>this.errors.push(args);} + setCapabilityValue(name,value){this.values.push([name,value]);return Promise.resolve();} + isFirstInit(){return firstInit;} + configureAttributeReporting(config){ + this.reporting.push(...config); + return failReport?Promise.reject(new Error('sleepy device')):Promise.resolve(); + } + log(...args){this.logs.push(args);} + } + const f=vm.runInNewContext('(function(require,module,exports){'+code+'\n})'); + f(name=>{ + if(name==='homey-zigbeedriver')return {ZigBeeDevice:MockZigBeeDevice}; + if(name==='zigbee-clusters')return {CLUSTER:cluster}; + if(name==='../illuminance_sensor/measurements')return luxConverter; + throw Error('Unexpected runtime dependency '+name); + },mod,mod.exports); + const device=new mod.exports(),listeners={}; + function reg(type){return {on(name,callback){listeners[type+'.'+name]=callback;}};} + const ias=reg('ias');ias.enrollments=[]; + ias.zoneEnrollResponse=value=>{ias.enrollments.push(value);return Promise.resolve();}; + const endpoint={clusters:{ + iasZone:ias,illuminanceMeasurement:reg('lux'),powerConfiguration:reg('power'), + }}; + return {device,ias,listeners,zclNode:{endpoints:{1:endpoint}}}; +} + +test('IAS motion uses ONLY explicit status bits, reacts to enrollment and retains alarm on partial frame',async()=>{ + const {device,ias,listeners,zclNode}=harness(); + await device.onNodeInit({zclNode}); + assert.equal(device.reporting.length,2); + assert.deepEqual(device.reporting.map(x=>x.cluster.NAME),['illuminanceMeasurement','powerConfiguration']); + assert.deepEqual(ias.enrollments,[],'do not send unsolicited ZCL startup commands'); + ias.onZoneEnrollRequest(); + await Promise.resolve();await Promise.resolve(); + assert.equal(ias.enrollments.length,1); + assert.equal(ias.enrollments[0].enrollResponseCode,0); + assert.equal(ias.enrollments[0].zoneId,0); + ias.onZoneStatusChangeNotification({zoneStatus:{alarm1:true,battery:false}}); + ias.onZoneStatusChangeNotification({zoneStatus:{}}); + ias.onZoneStatusChangeNotification({zoneStatus:null}); + listeners['ias.attr.zoneStatus']({alarm1:false,battery:true}); + ias.onZoneStatusChangeNotification({zoneStatus:{alarm1:true}}); + assert.deepEqual(device.values,[ + ['alarm_motion',true],['alarm_battery',false], + ['alarm_motion',false],['alarm_battery',true], + ['alarm_motion',true], + ]); + assert.deepEqual(device.errors,[]); +}); + +test('standard lux and battery reports filter unknown and out-of-range samples',async()=>{ + const {device,listeners,zclNode}=harness(); + await device.onNodeInit({zclNode}); + for(const v of [10001,20001,0,0xffff,-1,NaN,null,'10001',65536]) + listeners['lux.attr.measuredValue'](v); + for(const v of [200,39,0,255,-1,NaN,null,'200',false,201]) + listeners['power.attr.batteryPercentageRemaining'](v); + assert.deepEqual(device.values,[ + ['measure_luminance',10],['measure_luminance',100],['measure_luminance',0], + ['measure_battery',100],['alarm_battery',false], + ['measure_battery',19.5],['alarm_battery',true], + ['measure_battery',0],['alarm_battery',true], + ]); + assert.deepEqual(device.errors,[]); +}); + +test('both optional sleepy reporting setups are nonfatal and not repeated after restart',async()=>{ + const a=harness(true,true); + await a.device.onNodeInit({zclNode:a.zclNode}); + assert.equal(a.device.reporting.length,2); + assert.equal(a.device.logs.length,2); + assert.deepEqual(a.device.errors,[]); + const restarted=harness(false,true); + await restarted.device.onNodeInit({zclNode:restarted.zclNode}); + assert.deepEqual(restarted.device.reporting,[]); + assert.equal(typeof restarted.ias.onZoneStatusChangeNotification,'function'); + assert.equal(typeof restarted.listeners['power.attr.batteryPercentageRemaining'],'function'); +}); diff --git a/test/standard-zcl-temperature-humidity-797.test.js b/test/standard-zcl-temperature-humidity-797.test.js new file mode 100644 index 0000000000..25f0c658ea --- /dev/null +++ b/test/standard-zcl-temperature-humidity-797.test.js @@ -0,0 +1,109 @@ +'use strict'; +const test = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const path = require('node:path'); +const vm = require('node:vm'); +const manifest = require('../app.json'); +const profiles = [ + { id: 'temphumidsensor_aubess_qoy0ekbd', m: '_TZE200_qoy0ekbd', p: 'TS0601' }, + { id: 'temphumidsensor_tsgqxdb4', m: '_TZ3000_tsgqxdb4', p: 'TS0201' }, +]; + +test('#797 / #1246 are two separate exact standard-cluster temp/RH profiles, never a manufacturer/model cross product', () => { + for (const s of profiles) { + const c = require('../drivers/' + s.id + '/driver.compose.json'); + assert.equal(c.id, s.id); + assert.deepEqual(c.zigbee.manufacturerName, [s.m]); + assert.deepEqual(c.zigbee.productId, [s.p]); + assert.deepEqual(c.zigbee.endpoints, { + '1': { clusters: [0,1,1026,1029], bindings: [1,1026,1029] }, + }); + assert.deepEqual(c.energy.batteries, ['OTHER']); + assert.deepEqual(c.capabilities, [ + 'measure_temperature', 'measure_humidity', 'measure_battery', 'alarm_battery', + ]); + assert.equal(c.zigbee.endpoints['1'].clusters.includes(61184), false, 'no EF00 input'); + assert.equal(c.capabilities.some(x => x.includes('soil') || x.includes('moisture')), false); + const matches=manifest.drivers.filter(d => d.zigbee?.manufacturerName?.includes(s.m) + && d.zigbee?.productId?.includes(s.p)); + assert.deepEqual(matches.map(d=>d.id), [s.id]); + assert.deepEqual(matches[0].settings, require('../drivers/' + s.id + '/driver.settings.compose.json')); + const source=fs.readFileSync(path.join(__dirname,'..','drivers',s.id,'device.js'),'utf8'); + assert.match(source, /module\.exports = require\('\.\.\/temphumidsensor3\/device'\)/); + assert.doesNotMatch(source, /TuyaSpecificCluster|TuyaDataPoints|Cluster\.addCluster/); + } + for (const s of profiles) for (const other of profiles) { + if (s===other) continue; + assert.deepEqual(manifest.drivers.filter(d => d.zigbee?.manufacturerName?.includes(s.m) + && d.zigbee?.productId?.includes(other.p)).map(d=>d.id), []); + } +}); + +function runtime(firstInit) { + const src=fs.readFileSync(path.join(__dirname,'..','drivers','temphumidsensor3','device.js'),'utf8'); + const names={POWER_CONFIGURATION:{NAME:'powerConfiguration'}, + TEMPERATURE_MEASUREMENT:{NAME:'temperatureMeasurement'}, + RELATIVE_HUMIDITY_MEASUREMENT:{NAME:'relativeHumidity'}}; + const out={exports:{}}; + class MockZigBeeDevice { + constructor(){this.events={};this.configs=[];this.values={};this.settings={};this.errors=[];} + isFirstInit(){return firstInit;} + configureAttributeReporting(arr){this.configs.push(...arr);return Promise.resolve();} + getSetting(name){return this.settings[name];} + setCapabilityValue(name,value){this.values[name]=value;return Promise.resolve();} + log(){} + error(...args){this.errors.push(args);} + } + const factory=vm.runInNewContext('(function(require,module,exports){'+src+'\n})'); + factory(name=>{ + if(name==='homey')return {}; + if(name==='homey-zigbeedriver')return {ZigBeeDevice:MockZigBeeDevice}; + if(name==='zigbee-clusters')return {debug(){},CLUSTER:names}; + throw Error('Unrecognized module '+name); + },out,out.exports); + const d=new out.exports(); + const cluster=(name)=>({on(event,fn){d.events[name+'.'+event]=fn;}}); + return {device:d,zclNode:{endpoints:{1:{clusters:{ + powerConfiguration:cluster('battery'), + temperatureMeasurement:cluster('temperature'), + relativeHumidity:cluster('humidity'), + }}}}}; +} + +test('actual inherited standard runtime gives physical source #1246 centidegree and centipercent values', async()=>{ + const {device,zclNode}=runtime(true); + await device.onNodeInit({zclNode}); + assert.deepEqual(device.configs.map(x=>[x.cluster.NAME,x.attributeName]),[ + ['temperatureMeasurement','measuredValue'], + ['relativeHumidity','measuredValue'], + ['powerConfiguration','batteryPercentageRemaining'], + ]); + device.events['temperature.attr.measuredValue'](2271); + device.events['humidity.attr.measuredValue'](7003); + device.events['battery.attr.batteryPercentageRemaining'](200); + assert.equal(device.values.measure_temperature,22.7); + assert.equal(device.values.measure_humidity,70); + assert.equal(device.values.measure_battery,100); + assert.equal(device.values.alarm_battery,false); + device.settings.temperature_decimals='2';device.settings.humidity_decimals='2'; + device.events['temperature.attr.measuredValue'](2271); + device.events['humidity.attr.measuredValue'](7003); + assert.equal(device.values.measure_temperature,22.71); + assert.equal(device.values.measure_humidity,70.03); + device.events['battery.attr.batteryPercentageRemaining'](18); + assert.equal(device.values.measure_battery,9); + assert.equal(device.values.alarm_battery,true); + assert.equal(device.errors.length,0); +}); + +test('restart attaches standard reports without reconfiguring sleeping devices',async()=>{ + const {device,zclNode}=runtime(false); + await device.onNodeInit({zclNode}); + assert.deepEqual(device.configs,[]); + assert.deepEqual(Object.keys(device.events).sort(),[ + 'battery.attr.batteryPercentageRemaining', + 'humidity.attr.measuredValue', + 'temperature.attr.measuredValue', + ]); +}); diff --git a/test/ts0001-single-output-profile.test.js b/test/ts0001-single-output-profile.test.js new file mode 100644 index 0000000000..b4a04785a6 --- /dev/null +++ b/test/ts0001-single-output-profile.test.js @@ -0,0 +1,71 @@ +'use strict'; + +const test = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const vm = require('node:vm'); +const path = require('node:path'); +const app = require('../app.json'); +const profile = require('../drivers/switch_1_gang_ts0001/driver.compose.json'); + +const id = 'switch_1_gang_ts0001'; +const physical = [ + ['_TZ3000_0t4zjtia', 1366], + ['_TZ3000_p26flek3', 1172], + ['_TZ3000_hyarhbyx', 1395], + ['_TZ3000_y4che4dc', 674], +]; + +test('four physically interviewed single-output TS0001 identifiers have unique exact pairing', () => { + assert.equal(profile.id, id); + assert.deepEqual(profile.zigbee.manufacturerName, physical.map(x => x[0])); + assert.deepEqual(profile.zigbee.productId, ['TS0001']); + assert.deepEqual(profile.capabilities, ['onoff']); + assert.deepEqual(profile.zigbee.endpoints, { + '1': { clusters: [0, 4, 5, 6], bindings: [6] }, + }); + assert.equal(profile.zigbee.devices, undefined); + assert.equal(profile.settings, undefined); + const generated = app.drivers.find(d => d.id === id); + assert.ok(generated); + assert.deepEqual(generated.zigbee.manufacturerName, profile.zigbee.manufacturerName); + assert.deepEqual(generated.zigbee.productId, ['TS0001']); + assert.equal(generated.settings, undefined, 'No unverified momentary/power-on settings'); + for (const [manufacturer, issue] of physical) { + const matching = app.drivers.filter(d => + [].concat(d.zigbee?.manufacturerName || []).includes(manufacturer) + && [].concat(d.zigbee?.productId || []).includes('TS0001')); + assert.deepEqual(matching.map(d=>d.id), [id], 'Issue #' + issue + ' must have exactly one match'); + } +}); + +test('metered, un-interviewed and separate BSEED TS0001 identities are excluded', () => { + for (const excluded of [ + '_TZ3000_fdxihpp7', // #963: EP1 includes 0x0702/0x0B04 + '_TZ3000_e8cquwdk', // #160: no Homey Zigbee interview yet + '_TZ3000_blhvsaqf', // #1339: own isolated BSEED profile + ]) assert.ok(!profile.zigbee.manufacturerName.includes(excluded), excluded); + assert.deepEqual(app.drivers.find(d=>d.id==='switch_1_gang_bseed_ts0001').zigbee.manufacturerName, + ['_TZ3000_blhvsaqf'], 'Do not widen the BSEED-only profile'); + assert.doesNotMatch(JSON.stringify(profile), /1794|2820|57344|57345|meter_power|relay_status/); +}); + +test('new TS0001 runtime binds only one standard onoff capability on EP1', async () => { + const src=fs.readFileSync(path.join(__dirname,'..','drivers',id,'device.js'),'utf8'); + assert.doesNotMatch(src,/readAttributes|writeAttributes|TuyaOnOffCluster|TuyaRelayStatus/); + const moduleStub={exports:{}}, ON_OFF={NAME:'onOff'}; + class MockDevice { + constructor(){this.registered=[];} + registerCapability(capability,cluster,options){this.registered.push({capability,cluster,endpoint:options.endpoint});} + } + const resolver=dependency=>{ + if(dependency==='homey-zigbeedriver')return {ZigBeeDevice:MockDevice}; + if(dependency==='zigbee-clusters')return {CLUSTER:{ON_OFF}}; + throw new Error('Unexpected dependency: '+dependency); + }; + vm.runInNewContext('(function(require,module,exports){'+src+'\n})')(resolver,moduleStub,moduleStub.exports); + const unit=new moduleStub.exports(); + await unit.onNodeInit(); + assert.deepEqual(unit.registered.map(x=>[x.capability,x.endpoint]),[['onoff',1]]); + assert.equal(unit.registered[0].cluster,ON_OFF); +}); diff --git a/test/ts0002-two-output-profile.test.js b/test/ts0002-two-output-profile.test.js new file mode 100644 index 0000000000..6740d6a6be --- /dev/null +++ b/test/ts0002-two-output-profile.test.js @@ -0,0 +1,110 @@ +'use strict'; + +const test = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const path = require('node:path'); +const vm = require('node:vm'); + +const dId = 'switch_2_gang_ts0002'; +const expectedManufacturers = [ + '_TZ3000_lugaswf8', + '_TZ3000_zxrfobzw', + '_TZ3000_ptjcjise', + '_TZ3000_rmiew70n', + '_TZ3000_pgcclddi', + '_TZ3000_l9brjwau', +]; +const profile = require('../drivers/switch_2_gang_ts0002/driver.compose.json'); +const manifest = require('../app.json'); + +test('exact TS0002-only family, with two non-metering standard-Zigbee endpoints', () => { + assert.equal(profile.id, dId); + assert.deepEqual(profile.zigbee.manufacturerName, expectedManufacturers); + assert.deepEqual(profile.zigbee.productId, ['TS0002']); + assert.deepEqual(profile.capabilities, ['onoff']); + assert.deepEqual(profile.zigbee.devices.secondSwitch.capabilities, ['onoff']); + assert.deepEqual(profile.zigbee.endpoints['1'], { clusters: [0, 4, 5, 6], bindings: [6] }); + assert.deepEqual(profile.zigbee.endpoints['2'], { clusters: [4, 5, 6], bindings: [6] }); + for (const dp of ['measure_power','meter_power','measure_current','measure_voltage']) { + assert.ok(!profile.capabilities.includes(dp), 'no phantom metering: ' + dp); + assert.ok(!profile.zigbee.devices.secondSwitch.capabilities.includes(dp)); + } + const clusters = JSON.stringify(profile.zigbee.endpoints); + for (const optional of ['57344', '57345', '61184', '1794', '2820']) { + assert.ok(!clusters.includes(optional), 'must not require proprietary or metering cluster ' + optional); + } + const generated = manifest.drivers.find(d => d.id === dId); + assert.ok(generated); + assert.deepEqual(generated.zigbee.manufacturerName, expectedManufacturers); + assert.deepEqual(generated.zigbee.productId, ['TS0002']); + assert.deepEqual(Object.keys(generated.zigbee.devices), ['secondSwitch']); + for (const manufacturer of expectedManufacturers) { + const matching = manifest.drivers.filter(d => + (d.zigbee?.manufacturerName || []).includes(manufacturer) + && (d.zigbee?.productId || []).includes('TS0002') + ); + assert.deepEqual(matching.map(d => d.id), [dId], manufacturer + ' has exactly one pairing profile'); + } +}); + +test('TS0002 profile reuses existing two-gang driver and device, without vendor writes', () => { + const device = fs.readFileSync(path.resolve(__dirname,'..','drivers',dId,'device.js'),'utf8'); + const driver = fs.readFileSync(path.resolve(__dirname,'..','drivers',dId,'driver.js'),'utf8'); + assert.match(device, /module\.exports = require\('\.\.\/switch_2_gang\/device'\)/); + assert.match(driver, /module\.exports = require\('\.\.\/switch_2_gang\/driver'\)/); + assert.doesNotMatch(device + driver, /TuyaSpecificCluster|writeAttributes|DP[0-9]/); +}); + +test('actual existing runtime registers independent OnOff on EP1 and EP2, tolerates optional Basic read failure', async () => { + const source = fs.readFileSync(path.resolve(__dirname,'..','drivers','switch_2_gang','device.js'),'utf8'); + const moduleStub = { exports: {} }; + const onOff = { NAME: 'onOff' }; + class MockZigBeeDevice { + constructor(subDeviceId, failRead = false) { + this.subDeviceId = subDeviceId; + this.failRead = failRead; + this.bound = []; + this.reads = 0; + } + isSubDevice() { return this.subDeviceId === 'secondSwitch'; } + getData() { return this.subDeviceId ? { subDeviceId: this.subDeviceId } : {}; } + log() {} + error() {} + registerCapability(name, cluster, options) { this.bound.push({ name, cluster, endpoint: options.endpoint }); } + } + const fakeRequire = name => { + if (name === 'homey') return {}; + if (name === 'homey-zigbeedriver') return { ZigBeeDevice: MockZigBeeDevice }; + if (name === 'zigbee-clusters') return { debug() {}, CLUSTER: { ON_OFF: onOff } }; + throw new Error('Unexpected dependency: ' + name); + }; + const factory = vm.runInNewContext('(function(require,module,exports){' + source + '\n})'); + factory(fakeRequire, moduleStub, moduleStub.exports); + const DriverDevice = moduleStub.exports; + const makeNode = (device) => ({ endpoints: { 1: { clusters: { + basic: { readAttributes() { + device.reads += 1; + return device.failRead ? Promise.reject(new Error('non-responsive Basic cluster')) : Promise.resolve({ manufacturerName: '_TZ3000_lugaswf8' }); + } }, + } } } }); + + const parent = new DriverDevice(); + await parent.onNodeInit({ zclNode: makeNode(parent) }); + assert.equal(parent.reads, 1); + assert.equal(parent.bound.length, 1); + assert.equal(parent.bound[0].name, 'onoff'); + assert.equal(parent.bound[0].cluster, onOff); + assert.equal(parent.bound[0].endpoint, 1); + + const child = new DriverDevice('secondSwitch'); + await child.onNodeInit({ zclNode: makeNode(child) }); + assert.equal(child.reads, 0, 'child should not duplicate the basic read'); + assert.equal(child.bound.length, 1); + assert.equal(child.bound[0].endpoint, 2); + + const flakyParent = new DriverDevice(undefined, true); + await flakyParent.onNodeInit({ zclNode: makeNode(flakyParent) }); + assert.equal(flakyParent.bound.length, 1); + assert.equal(flakyParent.bound[0].endpoint, 1, 'optional Basic failure must not block switching'); +}); diff --git a/test/ts0003-comment-1500-profile.test.js b/test/ts0003-comment-1500-profile.test.js new file mode 100644 index 0000000000..bce7b6bdc0 --- /dev/null +++ b/test/ts0003-comment-1500-profile.test.js @@ -0,0 +1,34 @@ +'use strict'; + +const test = require('node:test'); +const assert = require('node:assert/strict'); +const profile = require('../drivers/switch_3_gang_ts0003/driver.compose.json'); +const manifest = require('../app.json'); + +// #1500: physical Homey interview in the FIRST comment of #1152, +// independently extracted because #1152's BODY is a different metering TS0003. +test('issue #1500 exact non-metering TS0003 has independent EP1/EP2/EP3', () => { + const m = '_TZ3000_iol4bl2y'; + const matches = manifest.drivers.filter(d => + [].concat(d.zigbee?.manufacturerName || []).includes(m) && + [].concat(d.zigbee?.productId || []).includes('TS0003')); + assert.deepEqual(matches.map(d => d.id), ['switch_3_gang_ts0003']); + assert.ok(profile.zigbee.manufacturerName.includes(m)); + assert.deepEqual(profile.zigbee.productId, ['TS0003']); + assert.deepEqual(profile.zigbee.endpoints, { + '1': { clusters: [0, 4, 5, 6], bindings: [6] }, + '2': { clusters: [4, 5, 6], bindings: [6] }, + '3': { clusters: [4, 5, 6], bindings: [6] }, + }); + assert.deepEqual(Object.keys(profile.zigbee.devices).sort(), ['secondSwitch', 'thirdSwitch']); + assert.deepEqual(profile.capabilities, ['onoff']); + assert.equal(profile.settings, undefined); + for (const child of Object.values(profile.zigbee.devices)) assert.deepEqual(child.capabilities, ['onoff']); + assert.doesNotMatch(JSON.stringify(profile), /1794|2820|57344|57345|meter_power|measure_power|relay_status/); +}); + +test('the separate metering fingerprint from #1152/#408 is NOT accidentally included', () => { + assert.ok(!profile.zigbee.manufacturerName.includes('_TZ3000_ly9apzky')); + assert.ok(!manifest.drivers.find(d => d.id === profile.id).zigbee.manufacturerName.includes('_TZ3000_ly9apzky')); + assert.deepEqual(profile.zigbee.productId, ['TS0003']); +}); diff --git a/test/ts0003-three-output-profile.test.js b/test/ts0003-three-output-profile.test.js new file mode 100644 index 0000000000..32cb8479d7 --- /dev/null +++ b/test/ts0003-three-output-profile.test.js @@ -0,0 +1,116 @@ +'use strict'; + +const test = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const path = require('node:path'); +const vm = require('node:vm'); + +const id = 'switch_3_gang_ts0003'; +const manufacturers = ['_TZ3000_lmcp6b0a', '_TZ3000_v4l4b0lp', '_TZ3000_qkixdnon', '_TZ3000_iol4bl2y']; +const manifest = require('../app.json'); +const profile = require('../drivers/switch_3_gang_ts0003/driver.compose.json'); + +test('exact #795/#1353 non-metering three-gang TS0003 pairing without cross-product manufacturer matches', () => { + assert.equal(profile.id, id); + assert.deepEqual(profile.zigbee.manufacturerName, manufacturers); + assert.deepEqual(profile.zigbee.productId, ['TS0003']); + assert.deepEqual(profile.capabilities, ['onoff']); + assert.deepEqual(profile.zigbee.devices.secondSwitch.capabilities, ['onoff']); + assert.deepEqual(profile.zigbee.devices.thirdSwitch.capabilities, ['onoff']); + assert.deepEqual(Object.keys(profile.zigbee.devices).sort(), ['secondSwitch', 'thirdSwitch']); + assert.deepEqual(profile.zigbee.endpoints, { + '1': { clusters: [0, 4, 5, 6], bindings: [6] }, + '2': { clusters: [4, 5, 6], bindings: [6] }, + '3': { clusters: [4, 5, 6], bindings: [6] }, + }); + // Physical interviews show optional Identify3 and E000/E001 variants; + // proprietary clusters are not required for the standard OnOff subset. + const declared = JSON.stringify(profile.zigbee.endpoints); + for (const forbidden of [1794, 2820, 61184, 57344, 57345]) { + assert.ok(!declared.includes(String(forbidden)), 'no invented mandatory vendor/metering cluster: ' + forbidden); + } + for (const cap of ['measure_power', 'meter_power', 'measure_current', 'measure_voltage']) { + assert.ok(!JSON.stringify(profile.capabilities).includes(cap), 'no metering capability ' + cap); + assert.ok(!JSON.stringify(profile.zigbee.devices).includes(cap), 'no child metering ' + cap); + } + + const generated = manifest.drivers.find(d => d.id === id); + assert.ok(generated, 'Compose output must include the new driver'); + assert.deepEqual(generated.zigbee.manufacturerName, manufacturers); + assert.deepEqual(generated.zigbee.productId, ['TS0003']); + assert.deepEqual(generated.capabilities, ['onoff']); + assert.equal(generated.settings, undefined, 'Do not inherit phantom settings from another driver'); + for (const m of manufacturers) { + const match = manifest.drivers.filter(d => + d.zigbee?.manufacturerName?.includes(m) && d.zigbee?.productId?.includes('TS0003') + ); + assert.deepEqual(match.map(d => d.id), [id], 'single exact pairing profile: ' + m); + } +}); + +test('new profile reuses existing validated standard three-channel runtime, never vendor writes', () => { + const dir = path.join(__dirname, '..', 'drivers', id); + const device = fs.readFileSync(path.join(dir, 'device.js'), 'utf8'); + const driver = fs.readFileSync(path.join(dir, 'driver.js'), 'utf8'); + assert.match(device, /module\.exports = require\('\.\.\/switch_3_gang\/device'\)/); + assert.match(driver, /module\.exports = require\('\.\.\/switch_3_gang\/driver'\)/); + assert.doesNotMatch(device + driver, /writeAttributes|TuyaSpecificCluster|TuyaColorControlCluster/); +}); + +test('actual inherited three-channel implementation binds OnOff once per physical endpoint, even if optional Basic fails', async () => { + const code = fs.readFileSync(path.join(__dirname, '..', 'drivers', 'switch_3_gang', 'device.js'), 'utf8'); + const exported = { exports: {} }; + const ON_OFF = { NAME: 'onOff' }; + class MockZigBeeDevice { + constructor(subDeviceId, rejectBasic = false) { + this._subDeviceId = subDeviceId; + this.rejectBasic = rejectBasic; + this.bindings = []; + this.basicReads = 0; + } + getData() { return this._subDeviceId ? { subDeviceId: this._subDeviceId } : {}; } + isSubDevice() { return !!this._subDeviceId; } + log() {} + error() {} + registerCapability(capability, cluster, options) { + this.bindings.push({ capability, cluster, endpoint: options.endpoint }); + } + } + const requires = dependency => { + if (dependency === 'homey') return {}; + if (dependency === 'homey-zigbeedriver') return { ZigBeeDevice: MockZigBeeDevice }; + if (dependency === 'zigbee-clusters') return { debug() {}, CLUSTER: { ON_OFF } }; + throw new Error('Unexpected runtime dependency: ' + dependency); + }; + const create = vm.runInNewContext('(function(require,module,exports){' + code + '\n})'); + create(requires, exported, exported.exports); + const Device = exported.exports; + const makeNode = d => ({ + endpoints: { 1: { clusters: { basic: { + readAttributes() { + d.basicReads++; + return d.rejectBasic + ? Promise.reject(new Error('Basic timeout on physical wall switch')) + : Promise.resolve({ manufacturerName: '_TZ3000_lmcp6b0a' }); + }, + } } } }, + }); + const rows = [ + { sub: undefined, ep: 1, reads: 1 }, + { sub: 'secondSwitch', ep: 2, reads: 0 }, + { sub: 'thirdSwitch', ep: 3, reads: 0 }, + ]; + for (const row of rows) { + const device = new Device(row.sub); + await device.onNodeInit({ zclNode: makeNode(device) }); + assert.equal(device.basicReads, row.reads); + assert.equal(device.bindings.length, 1); + assert.equal(device.bindings[0].capability, 'onoff'); + assert.equal(device.bindings[0].cluster, ON_OFF); + assert.equal(device.bindings[0].endpoint, row.ep); + } + const timeout = new Device(undefined, true); + await timeout.onNodeInit({ zclNode: makeNode(timeout) }); + assert.equal(timeout.bindings[0].endpoint, 1, 'optional Basic timeout must not block EP1'); +}); diff --git a/test/ts0004-four-output-profile.test.js b/test/ts0004-four-output-profile.test.js new file mode 100644 index 0000000000..6ef59bfd01 --- /dev/null +++ b/test/ts0004-four-output-profile.test.js @@ -0,0 +1,103 @@ +'use strict'; + +const test = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const path = require('node:path'); +const vm = require('node:vm'); + +const id = 'switch_4_gang_ts0004'; +const manufacturers = ['_TZ3000_s6ma1nh4', '_TZ3000_enmfaave']; +const profile = require('../drivers/switch_4_gang_ts0004/driver.compose.json'); +const manifest = require('../app.json'); + +test('TS0004 exact non-metering family has four independent Homey tiles and no vendor writes', () => { + assert.equal(profile.id, id); + assert.deepEqual(profile.zigbee.manufacturerName, manufacturers); + assert.deepEqual(profile.zigbee.productId, ['TS0004']); + assert.deepEqual(profile.capabilities, ['onoff']); + assert.deepEqual(Object.keys(profile.zigbee.devices).sort(), [ + 'fourthSwitch', 'secondSwitch', 'thirdSwitch', + ]); + for (const gang of Object.values(profile.zigbee.devices)) assert.deepEqual(gang.capabilities, ['onoff']); + assert.deepEqual(profile.zigbee.endpoints, { + '1': { clusters: [0, 4, 5, 6], bindings: [6] }, + '2': { clusters: [4, 5, 6], bindings: [6] }, + '3': { clusters: [4, 5, 6], bindings: [6] }, + '4': { clusters: [4, 5, 6], bindings: [6] }, + }); + // EP1 physical interview: 0/3/4/5/6/E000/E001; EP2–4: 4/5/6/E001. + // Identify and vendor clusters are observable, but not required for basic OnOff. + const requirements = JSON.stringify(profile.zigbee.endpoints); + for (const forbidden of [1794, 2820, 57344, 57345, 61184]) { + assert.ok(!requirements.includes(String(forbidden)), 'do not mandate metering/vendor cluster ' + forbidden); + } + for (const power of ['measure_power', 'meter_power', 'measure_voltage', 'measure_current']) { + assert.ok(!JSON.stringify(profile.capabilities).includes(power)); + assert.ok(!JSON.stringify(profile.zigbee.devices).includes(power)); + } +}); + +test('generated manifest matches only two physical TS0004 identities, not TS0726 or metering #722', () => { + const found = manifest.drivers.find(d => d.id === id); + assert.ok(found); + assert.deepEqual(found.zigbee.manufacturerName, manufacturers); + assert.deepEqual(found.zigbee.productId, ['TS0004']); + assert.equal(found.settings, undefined); + assert.deepEqual(Object.keys(found.zigbee.devices).sort(), ['fourthSwitch', 'secondSwitch', 'thirdSwitch']); + for (const manufacturer of manufacturers) { + assert.deepEqual(manifest.drivers.filter(d => + d.zigbee?.manufacturerName?.includes(manufacturer) + && d.zigbee?.productId?.includes('TS0004') + ).map(d=>d.id), [id]); + } + assert.ok(!found.zigbee.manufacturerName.includes('_TZ3000_ltt60asa'), 'metering variant #722 is separate'); + assert.ok(!found.zigbee.productId.includes('TS0726'), 'other BSEED family is separate'); + assert.ok(!manifest.drivers.find(d=>d.id==='relay_board_4_channel').zigbee.manufacturerName.some(m=>manufacturers.includes(m)), 'legacy profile unchanged'); +}); + +function makeDeviceRuntime() { + const code = fs.readFileSync(path.join(__dirname, '..', 'drivers', id, 'device.js'), 'utf8'); + const exported = { exports: {} }; + const ON_OFF = { NAME: 'onOff' }; + class MockZigBeeDevice { + constructor(subDeviceId) { + this.subDeviceId = subDeviceId; + this.registered = []; + } + getData() { + return this.subDeviceId === undefined ? {} : { subDeviceId: this.subDeviceId }; + } + registerCapability(name, cluster, options) { + this.registered.push({ name, cluster, endpoint: options.endpoint }); + } + } + const fakeRequire = dependency => { + if (dependency === 'homey-zigbeedriver') return { ZigBeeDevice: MockZigBeeDevice }; + if (dependency === 'zigbee-clusters') return { CLUSTER: { ON_OFF } }; + throw new Error('Unexpected module: ' + dependency); + }; + const loader = vm.runInNewContext('(function(require,module,exports){' + code + '\n})'); + loader(fakeRequire, exported, exported.exports); + return { Device: exported.exports, ON_OFF, code }; +} + +test('real isolated runtime maps main/second/third/fourth OnOff to EP1/EP2/EP3/EP4', async () => { + const { Device, ON_OFF } = makeDeviceRuntime(); + for (const [subDeviceId, endpoint] of [[undefined,1],['secondSwitch',2],['thirdSwitch',3],['fourthSwitch',4]]) { + const device = new Device(subDeviceId); + await device.onNodeInit(); + assert.equal(device.registered.length, 1); + assert.equal(device.registered[0].name, 'onoff'); + assert.equal(device.registered[0].cluster, ON_OFF); + assert.equal(device.registered[0].endpoint, endpoint); + } +}); + +test('isolated runtime fails closed on unknown subdevice, never probes Basic or sends vendor traffic', async () => { + const { Device, code } = makeDeviceRuntime(); + await assert.rejects(new Device('fifthSwitch').onNodeInit(), /Unknown TS0004 subdevice/); + assert.doesNotMatch(code, /readAttributes|writeAttributes|tuyaRgbMode|TuyaSpecificCluster|sendFrame/); + const driver = fs.readFileSync(path.join(__dirname, '..', 'drivers', id, 'driver.js'),'utf8'); + assert.match(driver, /module\.exports = require\('\.\.\/relay_board_4_channel\/driver'\)/); +}); diff --git a/test/tuya-relay-status.test.js b/test/tuya-relay-status.test.js new file mode 100644 index 0000000000..6c87863edf --- /dev/null +++ b/test/tuya-relay-status.test.js @@ -0,0 +1,91 @@ +'use strict'; + +const test = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const path = require('node:path'); + +const { + normalizeTuyaRelayStatus, + parseTuyaRelaySetting, + syncTuyaRelayStatus, + writeTuyaRelayStatus, +} = require('../lib/TuyaRelayStatus'); + +test('Tuya 0x8002 normalization accepts only explicit numeric and enum variants', () => { + for (const [value, expected] of [ + [0, 0], ['0', 0], ['Off', 0], [' OFF ', 0], + [1, 1], ['1', 1], ['On', 1], + [2, 2], ['2', 2], ['Remember', 2], ['PREVIOUS', 2], + ['Recover', 2], ['remember last state', 2], ['off/on', 2], + ]) assert.equal(normalizeTuyaRelayStatus(value), expected, String(value)); + for (const unknown of [undefined, null, {}, -1, 3, 255, '255', 'toggle', '2x', '', '0x02']) { + assert.throws(() => normalizeTuyaRelayStatus(unknown), RangeError, String(unknown)); + } +}); + +test('Homey setting parses strict 0/1/2, never integer prefixes or standard ZCL previous=0xFF', () => { + for (const v of [0, 1, 2, '0', '1', '2']) assert.equal(parseTuyaRelaySetting(v), Number(v)); + for (const v of [undefined, null, '', '2x', ' 2', '3', 3, -1, 255, '255', 'previous', '0x02']) { + assert.throws(() => parseTuyaRelaySetting(v), RangeError, String(v)); + } +}); + +test('read on startup only updates Homey setting, NEVER writes to hardware', async () => { + const reads = [], writes = [], saved = []; + const device = { log() {}, async setSettings(settings) { saved.push(settings); } }; + const cluster = { + async readAttributes(attributes) { reads.push(attributes); return { relayStatus: 'Remember' }; }, + async writeAttributes(payload) { writes.push(payload); }, + }; + assert.equal(await syncTuyaRelayStatus(device, cluster), true); + assert.deepEqual(reads, [['relayStatus']]); + assert.deepEqual(saved, [{ relay_status: '2' }]); + assert.deepEqual(writes, []); +}); + +test('unknown, missing, failed or unavailable reads retain existing setting and do not block startup', async () => { + const saved = []; + const device = { log() {}, async setSettings(s) { saved.push(s); } }; + const values = [undefined, null, 0xFF, 'Toggle']; + for (const value of values) { + const cluster = { async readAttributes() { return { relayStatus: value }; } }; + assert.equal(await syncTuyaRelayStatus(device, cluster), false); + } + assert.equal(await syncTuyaRelayStatus(device, { async readAttributes() { throw new Error('unsupported attribute'); } }), false); + assert.equal(await syncTuyaRelayStatus(device, undefined), false); + assert.deepEqual(saved, []); +}); + +test('Homey setting changes write numeric Tuya enum only, and propagate device errors', async () => { + const writes = []; + const cluster = { async writeAttributes(payload) { writes.push(payload); } }; + for (const selected of ['0', '1', '2']) await writeTuyaRelayStatus(cluster, selected); + assert.deepEqual(writes, [{ relayStatus: 0 }, { relayStatus: 1 }, { relayStatus: 2 }]); + await assert.rejects(writeTuyaRelayStatus(cluster, '2notvalid'), RangeError); + await assert.rejects(writeTuyaRelayStatus(cluster, '255'), RangeError); + await assert.rejects(writeTuyaRelayStatus(undefined, '2'), /unavailable/); + assert.deepEqual(writes.length, 3); + await assert.rejects(writeTuyaRelayStatus({ async writeAttributes() { throw new Error('radio failure'); } }, '1'), /radio failure/); +}); + +test('four existing opted-in plug drivers keep their UI and isolate optional reads', () => { + const manifest = require('../app.json'); + for (const id of ['smartplug', 'smartplug_2_socket', 'wall_socket', 'smartPlug_DinRail']) { + const src = fs.readFileSync(path.join(__dirname, '..', 'drivers', id, 'device.js'), 'utf8'); + const driver = manifest.drivers.find(d => d.id === id); + assert.ok(driver, id); + const setting = driver.settings.find(s => s.id === 'relay_status'); + assert.equal(setting.value, '2', id); + assert.deepEqual(setting.values.map(v => v.id), ['0', '1', '2'], id); + assert.match(src, /Cluster\.addCluster\(TuyaOnOffCluster\)/); + assert.match(src, /await syncTuyaRelayStatus\(this, onOffCluster\)/); + assert.match(src, /await writeTuyaRelayStatus\(this\.zclNode\.endpoints\[1\]\?\.clusters\?\.onOff, newSettings\.relay_status\)/); + assert.doesNotMatch(src, /parseInt\(newSettings\.relay_status\)/); + assert.equal((src.match(/readAttributes\(\['relayStatus'\]\)/g) || []).length, 0, + 'relayStatus reading must be delegated to isolated helper: ' + id); + // Child lock or indicator failure cannot suppress independent relay read. + assert.match(src, /await syncTuyaRelayStatus\(this, onOffCluster\);[\s\S]*?readAttributes\(\['childLock'\]\)/); + assert.match(src, /readAttributes\(\['indicatorMode'\]\)/); + } +}); diff --git a/test/wall-thermostat-unmapped-dp.test.js b/test/wall-thermostat-unmapped-dp.test.js new file mode 100644 index 0000000000..cecc544c6e --- /dev/null +++ b/test/wall-thermostat-unmapped-dp.test.js @@ -0,0 +1,125 @@ +'use strict'; + +const test = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const path = require('node:path'); +const vm = require('node:vm'); + +const UnmappedDpLogLimiter = require('../drivers/wall_thermostat/unmapped-dp-log'); + +test('repeated unknown DP36 reports are summarized instead of flooding logs', () => { + let timestamp = 1000; + const messages = []; + const limiter = new UnmappedDpLogLimiter( + (...args) => messages.push(args), + () => timestamp + ); + + limiter.record(36, 1); + for (let i = 0; i < 1200; i += 1) limiter.record(36, 1); + + assert.deepEqual(messages, [['processReporting', 36, 1]]); + + timestamp += 60000; + limiter.record(36, 1); + + assert.deepEqual(messages, [ + ['processReporting', 36, 1], + ['Suppressed repeated unmapped Tuya DP reports', 36, 1200, 'previous value:', 1], + ['processReporting', 36, 1], + ]); +}); + +test('changed and distinct unmapped datapoint values remain visible', () => { + let timestamp = 100; + const messages = []; + const limiter = new UnmappedDpLogLimiter( + (...args) => messages.push(args), + () => timestamp + ); + + limiter.record(36, 1); + limiter.record(36, 1); // Duplicate: suppressed. + limiter.record(36, 2); // New value: log immediately, including suppressed count. + limiter.record(37, 1); // Distinct DP: first occurrence is always visible. + timestamp += 10; + limiter.record(36, 2); // Repeated again: suppressed. + + assert.deepEqual(messages, [ + ['processReporting', 36, 1], + ['Suppressed repeated unmapped Tuya DP reports', 36, 1, 'previous value:', 1], + ['processReporting', 36, 2], + ['processReporting', 37, 1], + ]); +}); + +test('identical Buffer payloads use content equality rather than object identity', () => { + const messages = []; + const limiter = new UnmappedDpLogLimiter((...args) => messages.push(args), () => 0); + + limiter.record(36, Buffer.from([0, 1])); + limiter.record(36, Buffer.from([0, 1])); + limiter.record(36, Buffer.from([0, 2])); + + assert.equal(messages.length, 3); + assert.equal(messages[0][0], 'processReporting'); + assert.equal(messages[1][0], 'Suppressed repeated unmapped Tuya DP reports'); + assert.equal(messages[2][0], 'processReporting'); +}); + +test('actual wall thermostat routes unknown DPs through limiter without changing mapped capabilities', async () => { + const source = fs.readFileSync( + path.join(__dirname, '..', 'drivers', 'wall_thermostat', 'device.js'), + 'utf8' + ); + const moduleStub = { exports: {} }; + class BaseDevice { + constructor() { + this.messages = []; + this.values = new Map(); + } + log(...args) { this.messages.push(args); } + hasCapability() { return true; } + setCapabilityValue(key, value) { + this.values.set(key, value); + return Promise.resolve(); + } + registerCapabilityListener() {} + } + const fakeRequire = name => { + if (name === '../../lib/TuyaSpecificCluster') return class TuyaSpecificCluster {}; + if (name === '../../lib/TuyaOnOffCluster') return class TuyaOnOffCluster {}; + if (name === '../../lib/TuyaSpecificClusterDevice') return BaseDevice; + if (name === './helpers') return { getDataValue: data => data.data }; + if (name === './unmapped-dp-log') return UnmappedDpLogLimiter; + if (name === 'zigbee-clusters') return { Cluster: { addCluster() {} } }; + throw new Error('Unexpected import: ' + name); + }; + const factory = vm.runInNewContext( + '(function(require,module,exports){' + source + '\n})' + ); + factory(fakeRequire, moduleStub, moduleStub.exports); + + const Device = moduleStub.exports; + const device = new Device(); + const listeners = {}; + await device.onNodeInit({ + zclNode: { endpoints: { 1: { clusters: { + tuya: { on(name, handler) { listeners[name] = handler; } }, + } } } }, + }); + assert.equal(typeof listeners.reporting, 'function'); + assert.equal(typeof listeners.response, 'function'); + + await listeners.reporting({ dp: 36, data: 1 }); + await listeners.response({ dp: 36, data: 1 }); + await listeners.reporting({ dp: 36, data: 1 }); + const unknownMessages = device.messages.filter(([name]) => name === 'processReporting'); + assert.deepEqual(unknownMessages, [['processReporting', 36, 1]]); + + await listeners.reporting({ dp: 24, data: 235 }); + assert.equal(device.values.get('measure_temperature'), 23.5); + await listeners.reporting({ dp: 36, data: 2 }); + assert.deepEqual(device.messages.at(-1), ['processReporting', 36, 2]); +});