-
Notifications
You must be signed in to change notification settings - Fork 825
Add Tuya v2 quirk builder #3417
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
Merged
Merged
Changes from 11 commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
851d54f
Clean up soil sensors.
prairiesnpr 8555f3e
Refactor
prairiesnpr ded6e7a
Need to set in init.
prairiesnpr 88068fc
Add power, temp, and soil functions
prairiesnpr 4e7fb61
Cleanup, set defaults
prairiesnpr 91a4012
Cleanup, set defaults
prairiesnpr 6b32bff
all kwargs
prairiesnpr f1906b0
Remove default DPs, Simplify scaling
prairiesnpr c9cc9b2
Don't format tuya_dp function def
prairiesnpr b83c29f
Add EntityMetadata methods
prairiesnpr c6d5f30
Initial tests
prairiesnpr 241a50f
Clean up soil sensors.
prairiesnpr ac35ab9
Refactor
prairiesnpr a698b9d
Need to set in init.
prairiesnpr 63725d9
Add power, temp, and soil functions
prairiesnpr 316d3f6
Cleanup, set defaults
prairiesnpr 6458e02
Cleanup, set defaults
prairiesnpr 9e8fade
all kwargs
prairiesnpr 3c7e5fc
Remove default DPs, Simplify scaling
prairiesnpr bc790aa
Don't format tuya_dp function def
prairiesnpr 2123900
Add EntityMetadata methods
prairiesnpr 56266db
Initial tests
prairiesnpr ac9ccc7
Merge remote-tracking branch 'origin/clean-up-soil-sensors' into clea…
prairiesnpr 24d3e4c
Move TuyaQuirkBuilder out of MCU, use AttrDefs
prairiesnpr a90674a
Remove unused logging
prairiesnpr 6803bc0
Revert unrelated changes
prairiesnpr fac92fe
Add converter and dp_converter to tuya_sensor
prairiesnpr c3d1c93
Ensure mcu_version attr is present.
prairiesnpr 7f27503
Add humidity method
prairiesnpr eff64ba
Require zigpy > 0.68
prairiesnpr 868d0a8
Update tests for zigpy changes
prairiesnpr 3ff810f
Additonal test fixes
prairiesnpr d47d2f4
Revert Test Updates
prairiesnpr c043b1f
Merge branch 'dev' of https://github.com/prairiesnpr/zha-device-handl…
prairiesnpr 576b8e6
Update tests.
prairiesnpr 8c28fef
Use AttributeDefs
prairiesnpr 89cd451
Use zigpy 0.69
prairiesnpr 87ba6f1
Code cleanup
prairiesnpr ea9d912
Formatting, add entity_type to binary_sensor
prairiesnpr f1323ac
commas and more commas
prairiesnpr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
"""Mock utilities that are async aware.""" | ||
|
||
from unittest.mock import * # noqa: F401, F403 | ||
|
||
|
||
class _IntSentinelObject(int): | ||
"""Sentinel-like object that is also an integer subclass. | ||
|
||
Allows sentinels to be used | ||
in loggers that perform int-specific string formatting. | ||
""" | ||
|
||
def __new__(cls, name): | ||
instance = super().__new__(cls, 0) | ||
instance.name = name | ||
return instance | ||
|
||
def __repr__(self): | ||
return f"int_sentinel.{self.name}" | ||
|
||
def __hash__(self): | ||
return hash((int(self), self.name)) | ||
|
||
def __eq__(self, other): | ||
return self is other | ||
|
||
__str__ = __reduce__ = __repr__ | ||
|
||
|
||
class _IntSentinel: | ||
def __init__(self): | ||
self._sentinels = {} | ||
|
||
def __getattr__(self, name): | ||
if name == "__bases__": | ||
raise AttributeError | ||
return self._sentinels.setdefault(name, _IntSentinelObject(name)) | ||
|
||
def __reduce__(self): | ||
return "int_sentinel" | ||
|
||
|
||
int_sentinel = _IntSentinel() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.