[WWSTCERT-13462, WWSTCERT-13465] Sonoff SWV2C valve support - #3171
[WWSTCERT-13462, WWSTCERT-13465] Sonoff SWV2C valve support#3171yezi289 wants to merge 2 commits into
Conversation
1、Add Sonoff valve subdriver lazy loading. 2、Modify comment language and file name
|
I have tested this with a physical Sonoff SWV2C device. It pairs successfully in the SmartThings app, and both valve controls work normally. |
That's the easiest part, but does it stay on for longer than 10 minutes or does it automatically turn itself off after 10 minutes? What happens after - say - 15 minutes? The device is completely useless when it turns itself off after 10 minutes. Users don't want to turn it on every 10 minutes if they want to irrigate for an hour. Discussion: It's a bit more complicated (link to (outdated) code and technical documentation): |
|
Another issue: before a channel is turned on, the opposite channel must be turned off. According to the official manual only one channel should be open at any time. |
|
I tested this with a physical Sonoff SWV2C device. For the 10-minute behavior: yes, the device has an internal default auto-close/manual watering duration. In my test, if a valve is opened normally, the device closes it automatically after the configured duration. The default value appears to be 10 minutes. Users can change the irrigation/manual watering duration through the device's own configuration path outside of this basic valve control behavior. For the dual-channel behavior: I also tested the mutual exclusion behavior on the physical device. The two channels cannot stay open at the same time. If channel 1 is open and then channel 2 is opened, channel 1 is automatically closed and channel 2 opens. The device firmware reports the valve state automatically when a valve is operated, and the SmartThings app state updates correctly from those reports. If preferred, I can update the driver to explicitly send an Off command to the opposite endpoint before opening the requested channel, so the SmartThings state stays aligned with the device behavior. |
|
Thanks for the feedback. I’d prefer to keep this PR focused on SWV2C. SWV2C is a different hardware product from SWV1C. SWV1C is a single-channel valve, while SWV2C is a dual-channel valve with two endpoints and mutual-exclusion behavior between the two channels. There is already a separate PR for SWV1C, and that PR is focused on the single-channel device. Since SWV2C requires different handling for the second endpoint and child device, I think it is clearer and safer to review SWV2C in this dedicated PR instead of combining both hardware products into one submission. This also keeps the scope of each PR aligned with one hardware product and one WWST certification flow. |
| -- 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.
There is no need to change that.
| local sub_drivers = { | ||
| lazy_load_if_possible("sinope"), | ||
| lazy_load_if_possible("ezex"), | ||
| lazy_load_if_possible("sonoff"), |
There was a problem hiding this comment.
nit: I'd remove that comma
| local zigbee_test_utils = require "integration_test.zigbee_test_utils" | ||
| local t_utils = require "integration_test.utils" | ||
|
|
||
| -- 父设备(端点1):valve + battery + powerSource + firmwareUpdate + refresh |
There was a problem hiding this comment.
Please add comments only in english
| test.set_test_init_function(test_init) | ||
|
|
||
| -- ============================================================================ | ||
| -- 父设备(端点1)测试:OnOff 属性上报 → valve 事件 |
There was a problem hiding this comment.
Please add comments only in english
| ) | ||
|
|
||
| -- ============================================================================ | ||
| -- 子设备(端点2)测试:OnOff 属性上报 → 子设备 valve 事件 |
There was a problem hiding this comment.
Please add comments only in english
| ) | ||
|
|
||
| -- ============================================================================ | ||
| -- doConfigure 生命周期测试 |
There was a problem hiding this comment.
Please add comments only in english
| ) | ||
|
|
||
| -- ============================================================================ | ||
| -- Refresh 测试 |
There was a problem hiding this comment.
Please add comments only in english
| ) | ||
|
|
||
| -- ============================================================================ | ||
| -- Device added 生命周期测试(验证子设备创建 + refresh) |
There was a problem hiding this comment.
Please add comments only in english
| test.socket.zigbee:__set_channel_ordering("relaxed") | ||
| test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) | ||
|
|
||
| -- 验证子设备创建 |
There was a problem hiding this comment.
Please add comments only in english
| parent_assigned_child_key = "02" | ||
| }) | ||
|
|
||
| -- 验证 refresh 读取父设备属性 |
There was a problem hiding this comment.
Please add comments only in english
Check all that apply
Type of Change
Checklist
Description of Change
Summary of Completed Tests