zha-device-handlers icon indicating copy to clipboard operation
zha-device-handlers copied to clipboard

WIP: Add quirk for Sonoff TRVZB

Open jayme-github opened this issue 2 years ago • 12 comments

This only adds child lock and window open attributes from the Sonoff manufacturer specific cluster without any further integration.

I've zero experience in Zigbee/ZHA/quirk space and was just playing around a bit. Maybe this can be a starting point but I feel like there are multiple things I don't yet understand how they're supposed to be implemented/quirked. So help/comments/discussions appreciated!

/cc @TheJulianJES as of https://github.com/home-assistant/core/pull/105453 There is an open issue regarding this device at https://github.com/zigpy/zha-device-handlers/issues/2772

Proposed change

Additional information

Checklist

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

jayme-github avatar Dec 12 '23 17:12 jayme-github

Hi, I have tryed your quirk. For me it is not working. With your Quirk I am not able to change values for the TVRZB. Your values were also not displayed. What makes me wonder is that for Clusters for Childmode and windowmode are not available in the cluster browser.

Since this is the first time, I am experimenting with ZHA quirks it could be the case that i have made something wrong.

this is the .json file from my TRVZB: zha-704d08d7027909b328ce78dead5adde6-SONOFF TRVZB-6826b3c1b9b1842e4077cf02615ed158.json.txt

KaiDroste avatar Dec 20 '23 16:12 KaiDroste

Codecov Report

Attention: Patch coverage is 46.82540% with 67 lines in your changes missing coverage. Please review.

Project coverage is 86.93%. Comparing base (cf06668) to head (c3c2cad). Report is 167 commits behind head on dev.

Files with missing lines Patch % Lines
zhaquirks/sonoff/trvzb.py 46.82% 67 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #2831      +/-   ##
==========================================
- Coverage   87.50%   86.93%   -0.57%     
==========================================
  Files         292      293       +1     
  Lines        8952     9078     +126     
==========================================
+ Hits         7833     7892      +59     
- Misses       1119     1186      +67     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.


🚨 Try these New Features:

codecov[bot] avatar Jan 02 '24 17:01 codecov[bot]

Hi, I have tryed your quirk. For me it is not working. With your Quirk I am not able to change values for the TVRZB. Your values were also not displayed. What makes me wonder is that for Clusters for Childmode and windowmode are not available in the cluster browser.

There where no additional clusters defined in the initial commit and yes, reading/writing those attributes via the Manufacturer specific cluster is not currently possible (that's what https://github.com/home-assistant/core/pull/105453 is about).

jayme-github avatar Jan 02 '24 17:01 jayme-github

@TheJulianJES I'd love to get some feedback on this as I still don't feel very confident in the code base. Happy to add tests if this goes into the right direction.

The local_temperature_calibration will come with https://github.com/home-assistant/core/pull/105765

jayme-github avatar Jan 02 '24 17:01 jayme-github

Still on my list to look at this, but also check out: https://github.com/zigpy/zha-device-handlers/pull/2916 It seems to be the same issue you're facing.

The approach also isn't ideal IMO, but might be fine for now.

TheJulianJES avatar Jan 17 '24 01:01 TheJulianJES

@TheJulianJES I'd love to get some feedback on this as I still don't feel very confident in the code base. Happy to add tests if this goes into the right direction.

The local_temperature_calibration will come with home-assistant/core#105765

I really appreciate this feature, but calibration values from -2.5 to +2.5 are too small.

The Sonoff TRVZB supports values from -12.8 to +12,7 °C. (-128 to 127 are valid values for the zigbee-attribute 'local_temperature_calibration')

Unfortunately i have no experience with quirks for zha, but is it possible to extend the calibration range?

keberl avatar Jan 19 '24 16:01 keberl

@TheJulianJES I'd love to get some feedback on this as I still don't feel very confident in the code base. Happy to add tests if this goes into the right direction. The local_temperature_calibration will come with home-assistant/core#105765

I really appreciate this feature, but calibration values from -2.5 to +2.5 are too small.

The Sonoff TRVZB supports values from -12.8 to +12,7 °C. (-128 to 127 are valid values for the zigbee-attribute 'local_temperature_calibration')

Unfortunately i have no experience with quirks for zha, but is it possible to extend the calibration range?

Yes, this is waaaay to small. For example:

image

But the actual temperature is:

image

This would require a value of -4.8

TheNoim avatar Feb 05 '24 07:02 TheNoim

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. Thank you for your contributions.

github-actions[bot] avatar Aug 03 '24 08:08 github-actions[bot]

Are there any plans to finish this?

SuperSandro2000 avatar Aug 03 '24 11:08 SuperSandro2000

Are there any plans to finish this?

I'm using the quirk as is since the initial MR. I can give it another look to see if removing the _is_manuf_specific override works with the changes to HA in a couple of days. Maybe it gets accepted then.

jayme-github avatar Aug 03 '24 18:08 jayme-github

I'm also interested in seeing some of the functionality in this PR merged. Anything I can do to help?

fgsch avatar Sep 10 '24 20:09 fgsch

In the meantime, I've opened https://github.com/zigpy/zha-device-handlers/pull/3358 as an alternative to this.

fgsch avatar Sep 11 '24 13:09 fgsch

We've merged this v2 quirk PR now: https://github.com/zigpy/zha-device-handlers/pull/3358 @jayme-github Still, thanks for your PR and sorry for the long wait time.

TheJulianJES avatar Nov 25 '24 02:11 TheJulianJES