Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sonoff SWV-BSP Smart Water Valve improvements #3930

Open
wants to merge 15 commits into
base: dev
Choose a base branch
from
Open

Conversation

micz
Copy link

@micz micz commented Mar 4, 2025

I added these features to the Sonoff SWV-BSP Smart Water Valve (see #3298):

  • Water Leakage binary sensor
  • Water Shortage binary sensor
  • on_time attribute, representing the number of seconds after opening before the valve automatically closes.
  • A custom behaviour for the On command:
    1. If on_time == 0 it's a normal On command (0x01)
    2. If on_time != 0 it sends a on_with_timed_off (0x42), with the on_time numbers of seconds sets in the attribute

immagine immagine

This is my first attempt at creating a Quirk.
Any advice on whether I'm following the correct way would be appreciated.
Thank you!

Checklist

  • The changes are tested and work correctly
  • pre-commit checks pass / the code has been formatted using Black
  • Tests have been added to verify that the new code works

Copy link

codecov bot commented Mar 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.03%. Comparing base (b87ac89) to head (633ae03).

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #3930      +/-   ##
==========================================
+ Coverage   91.00%   91.03%   +0.02%     
==========================================
  Files         328      328              
  Lines       10656    10687      +31     
==========================================
+ Hits         9698     9729      +31     
  Misses        958      958              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fgsch
Copy link
Contributor

fgsch commented Mar 7, 2025

FWIW, I have a similar PR minus the on_time in #3910.

@micz
Copy link
Author

micz commented Mar 7, 2025

Thank you @fgsch, I've updated the code.
The on_time is the feature I need as a failsafe if the Zigbee connection fails.
What do you think about it? Have you tried it?

I didn't see your PR, I'm sorry.
I saw that you changed the Cluster name, do you think it's better to change it here also?
Thank you!

@fgsch
Copy link
Contributor

fgsch commented Mar 8, 2025

Thank you @fgsch, I've updated the code.

👍

The on_time is the feature I need as a failsafe if the Zigbee connection fails. What do you think about it? Have you tried it?

I haven't tried it yet.

IIUC you are using the attribute for the automatic valve close if there is no water together with the timing irrigation command for this purpose? Is this correct?

I didn't see your PR, I'm sorry. I saw that you changed the Cluster name, do you think it's better to change it here also? Thank you!

No worries. I changed the name to match other devices. Might as well do it here but really up to you.

@micz
Copy link
Author

micz commented Mar 8, 2025

IIUC you are using the attribute for the automatic valve close if there is no water together with the timing irrigation command for this purpose? Is this correct?

I'm sorry I don't understand your question.

I added the on_time attribute to let the user decide how much time set for the auto close (0 = no autoclose).
Then, I use that attribute in the command to determine whether it needs to be changed to 0x42.

I added also the two alarms, because I found your PR #3346 that added the attributes and I read that the other PRs in ZHA needed for the attribute_converter were done, but I didn't found your last PR, so I added them here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants