SONOFF/SWV1C - #3157
Conversation
| @@ -0,0 +1,14 @@ | |||
| name: sonoff-irrigation | |||
There was a problem hiding this comment.
Please rename this profile to valve-battery
| --[[ | ||
| Description: SONOFF Water Valve sub-driver for zigbee-valve | ||
| Version: 1.2 | ||
| Author: guoxin.yang | ||
| Date: 2026-07-06 | ||
| --]] |
There was a problem hiding this comment.
Please change this comment to:
-- Copyright 2026 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0
| local PowerConfiguration = zcl_clusters.PowerConfiguration | ||
| local utils = require "st.utils" | ||
|
|
||
| -- 电池轮询间隔(秒):SWV1C 是电池休眠设备,每 2 小时轮询一次 |
There was a problem hiding this comment.
Please use english language in You comments (remark applies to all files)
| -- 电池轮询间隔(秒):SWV1C 是电池休眠设备,每 2 小时轮询一次 | ||
| local BATTERY_POLL_INTERVAL = 7200 | ||
|
|
||
| -- SWV1C 设备指纹匹配表 |
There was a problem hiding this comment.
Please use english language in You comments (remark applies to all files)
| --- OnOff 属性上报处理器 → valve 能力点事件 | ||
| --- 必须显式处理,因为子驱动定义了 capability_handlers 后, | ||
| --- 父驱动的默认 OnOff→valve 映射会被跳过(只剩 OnOff→switch) |
There was a problem hiding this comment.
Please use english language in You comments (remark applies to all files)
| device:send(OnOff.attributes.OnOff:read(device)) | ||
| end | ||
|
|
||
| --- valve.close 能力点处理器 |
There was a problem hiding this comment.
Please use english language in You comments (remark applies to all files)
| device:send(OnOff.attributes.OnOff:read(device)) | ||
| end | ||
|
|
||
| --- 设备匹配检查 |
There was a problem hiding this comment.
Please use english language in You comments (remark applies to all files)
| }, | ||
| zigbee_handlers = { | ||
| attr = { | ||
| -- OnOff 属性上报 → valve 事件(弥补父驱动默认映射被跳过的缺陷) |
There was a problem hiding this comment.
Please use english language in You comments (remark applies to all files)
| [OnOff.ID] = { | ||
| [OnOff.attributes.OnOff.ID] = onoff_attr_handler | ||
| }, | ||
| -- 电池百分比属性上报 → battery 事件 |
There was a problem hiding this comment.
Please use english language in You comments (remark applies to all files)
| -- Copyright 2022 SmartThings | ||
| -- | ||
| -- Licensed under the Apache License, Version 2.0 (the "License"); | ||
| -- you may not use this file except in compliance with the License. | ||
| -- You may obtain a copy of the License at | ||
| -- | ||
| -- http://www.apache.org/licenses/LICENSE-2.0 | ||
| -- | ||
| -- Unless required by applicable law or agreed to in writing, software | ||
| -- distributed under the License is distributed on an "AS IS" BASIS, | ||
| -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| -- See the License for the specific language governing permissions and | ||
| -- limitations under the License. |
There was a problem hiding this comment.
Please change this comment to:
-- Copyright 2026 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0
| [capabilities.valve.ID] = { | ||
| [capabilities.valve.commands.open.NAME] = valve_open_handler, | ||
| [capabilities.valve.commands.close.NAME] = valve_close_handler, | ||
| } | ||
| }, |
There was a problem hiding this comment.
Did You check if Your device works with the zigbe-valve driver default handling ? (without this custom handling)
| [OnOff.ID] = { | ||
| [OnOff.attributes.OnOff.ID] = onoff_attr_handler | ||
| }, |
There was a problem hiding this comment.
Did You check if Your device works with the zigbe-valve driver default handling ? (without this custom handling)
|
Duplicate profile check: Passed - no duplicate profiles detected. |
|
Profile category check: ✅ Passed - all profiles have a category defined. |
|
Invitation URL: |
|
zigbee-valve_coverage.xml
Minimum allowed coverage is Generated by 🐒 cobertura-action against d3ca759 |
Test Results 73 files 541 suites 0s ⏱️ For more details on these failures, see this check. Results for commit d3ca759. |
|
Thanks for the review. Yes, I checked this behavior with the SONOFF SWV1C device. The device uses the Zigbee OnOff cluster for valve control and reports the valve state through the OnOff attribute. The custom handlers were added to explicitly map:
This is also needed because the device reports the OnOff value as I can also re-test without the custom handlers and confirm whether the default zigbee-valve handling covers this device correctly. |
Check all that apply
Type of Change
Checklist
Description of Change
Summary of Completed Tests