-
Notifications
You must be signed in to change notification settings - Fork 721
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
Xiaomi H1 Wired Double Rocker Switch With Neutral #1391
Xiaomi H1 Wired Double Rocker Switch With Neutral #1391
Conversation
One more thing, if anyone wants to test this: my working environment is based on the ZCLv7 update from puddly. There might be an issue with OppleCluster.attributes vs OppleCluster.manufacturer_attributes |
Pull Request Test Coverage Report for Build 2956280996
💛 - Coveralls |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #1391 +/- ##
==========================================
- Coverage 71.74% 71.56% -0.18%
==========================================
Files 237 239 +2
Lines 7195 7358 +163
==========================================
+ Hits 5162 5266 +104
- Misses 2033 2092 +59 ☔ View full report in Codecov by Sentry. |
I have several H1 one-button WS-EUK03 lumi.switch.n1aeu1 switches, is there anything I can do to help? |
Hi! Thanks for offering your help! Could you send me the device descriptor of your switches? |
…1-3button-wall-switch
…1-3button-wall-switch
Hi, I am new to world of HA and ZHA. I bought Aqara WS-EUK04. Temperature and electric doesn't work. So I have found you quirk - now I am stuck with this:
Any advice? |
It seems like Xiaomi devices change their type when they are re-joined. Maybe try removing and re-joining the device a few times and check if the entities that are discovered change. Mine for example only have the electric measurements every other time. Also sometimes they are switches sometimes lights I believe. |
No luck - logs shows the same error, so I am trying to provide some useful info.
|
You alwas get the same 3 clusters? |
If clusters means keys in endpoints ("1", "2", "242") - yes they are always the same |
Yes, sorry, that is what I meant. Do you have debugging turned on for zigpy? My best guess is that some of the endpoints somewhere get lost because they do not get matched or so. Maybe there ist just a slight difference in the actual device descriptor. Also what software versions are you using? |
Debugging turned on - unfortunately I dont know what should I look for....
I can provide full log if you want.
|
…m:dumpfheimer/zha-device-handlers into dumpfheimer/xiaomi-d1-3button-wall-switch
…: datatype mismatch
@javicalle I think I see what you mean. I'm out of time for now but will look into it eventually. Thanks for your help |
@@ -52,28 +53,28 @@ | |||
PRESS_TYPES = {0: "hold", 1: "single", 2: "double", 3: "triple", 255: "release"} | |||
|
|||
|
|||
class OppleOperationMode(t.uint8_t): | |||
class OppleOperationMode(t.uint8_t, Enum): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the t.enum8
can be used here instead of t.uint8_t, Enum
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately not. I then get data type errors when I set the Attribute
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the error I got:
[homeassistant.components.zha.api] Set attribute for: cluster_id: [64704] cluster_type: [in] endpoint_id: [1] attribute: [512] value: [False] manufacturer: [4447] response: [Write_Attributes_rsp(status_records=[WriteAttributesStatusRecord(status=<Status.INVALID_DATA_TYPE: 141>, attrid=0x0200)])]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you maybe trying to set the values as True
/False
instead of 1/0?
It had been implemented this way in other places:
https://github.com/zigpy/zha-device-handlers/blob/dev/zhaquirks/tuya/__init__.py#L849..L853
But it is known that it does not work with boolean values.
In any case if it is working properly I don't see any problem with keeping it as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the UI? I manually entered 1/0 but also the configuration entity failed to set the values with the same error (no UI feedback, only in the log?
If I look at the raw data they still seem indistinguishable to me:
The A3/A4 part seems to increment with every command so is no "real difference" |
Just wild guess - what about one button has only odd numbers and the other even numbers? |
I looked at that too, also within the timestamp.. nothing relatively obvious |
Does someone have the Xiaomi gateway? Are there distinguishable long press events in the Xiaomi ecosystem? |
Does anyone knows what is the It must be triggering errors in this part because that attribute doesn't exists: def _update_attribute(self, attrid, value):
super()._update_attribute(attrid, value)
if attrid == 0x00FC:
self._current_state = PRESS_TYPES.get(value)
.../... |
I'm not sure where I copied that from.. should take another look and see if it's even necessary.. |
Well, turns out it's needed 💪and still, the buttons seem indistinguishable :-/ |
class XiaomiOpple2ButtonSwitchBase(XiaomiCustomDevice): | ||
"""Xiaomi Opple 2 Button Switch.""" | ||
|
||
manufacturer_id_override = 0x115F |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we define the attributes as manufacturer specific I think we can remove these
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple questions left. We can merge this after they’re addressed
|
||
attributes.update( | ||
{ | ||
0x0002: ("power_outage_count", t.uint8_t), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these be defined as manufacturer specific?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
@dumpfheimer Sorry for the late comment, but is there a reason If there's no particular reason, would you mind adding them? MODELS_INFO: [(LUMI, "lumi.switch.n2aeu1")], (or are there further models?) |
There are multiple models that seem to work the same way. I do not know if they are matched this quirk, though. What are you after? |
@dumpfheimer You have some of these devices, right? Can you provide the device signature(s) for all your Xiaomi H1 switches? We want to whitelist those quirks to only apply to the correct manufacturer / models. It's there for almost all other quirks, but missing for these two quirks. ( |
I think there are multiple models that should use this quirk and that is why the model was omitted, not 100% sure, though. My model is lumi.switch.n2aeu1 This is the signature, copied from the debug json{ "node_descriptor": "NodeDescriptor(logical_type=, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=, mac_capability_flags=, manufacturer_code=4447, maximum_buffer_size=127, maximum_incoming_transfer_size=100, server_mask=11264, maximum_outgoing_transfer_size=100, descriptor_capability_field=, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=False, *is_full_function_device=True, *is_mains_powered=True, *is_receiver_on_when_idle=True, *is_router=True, *is_security_capable=False)", "endpoints": { "1": { "profile_id": "0x0104", "device_type": "0x0000", "input_clusters": [ "0x0000", "0x0002", "0x0003", "0x0004", "0x0005", "0x0006", "0x0009", "0x0012", "0x0702", "0xfcc0" ], "output_clusters": [ "0x000a", "0x0019" ] }, "2": { "profile_id": "0x0104", "device_type": "0x0000", "input_clusters": [ "0x0000", "0x0003", "0x0004", "0x0005", "0x0006", "0x0012", "0xfcc0" ], "output_clusters": [] }, "21": { "profile_id": "0x0104", "device_type": "0x0100", "input_clusters": [ "0x000c" ], "output_clusters": [] }, "31": { "profile_id": "0x0104", "device_type": "0x0100", "input_clusters": [ "0x000c" ], "output_clusters": [] }, "41": { "profile_id": "0x0104", "device_type": "0x0100", "input_clusters": [ "0x0012" ], "output_clusters": [] }, "42": { "profile_id": "0x0104", "device_type": "0x0100", "input_clusters": [ "0x0012" ], "output_clusters": [] }, "51": { "profile_id": "0x0104", "device_type": "0x0100", "input_clusters": [ "0x0012" ], "output_clusters": [] }, "61": { "profile_id": "0x0104", "device_type": "0x0100", "input_clusters": [ "0x0012" ], "output_clusters": [] }, "242": { "profile_id": "0xa1e0", "device_type": "0x0061", "input_clusters": [], "output_clusters": [ "0x0021" ] } }, "manufacturer": "LUMI", "model": "lumi.switch.n2aeu1" } |
Added quirk for Xiaomi H1 double rocker switche with neutral (n2aeu1)