-
Notifications
You must be signed in to change notification settings - Fork 737
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
Add Tuya pool sensor quirk #2927
Conversation
Thanks for the PR!
The Tuya data command is also used for other Tuya devices in Z2M, right?
As a note for others wanting to test this without changes to ZHA, you should already be able to access the attributes through the clusters menu (device page, "Manage Zigbee device", clusters, tuya cluster). |
Nice solution :-)
Yes, Koenkk immediately identified the issue from the Tuya Zigbee trace I provided, saying he had already seen this in a few devices (he gave examples, they are somewhere in Koenkk/zigbee2mqtt#18704). I'm wondering how I can contribute the code to HA/core/components/zha now? It breaks HA because of the missing quirk_id. Should I wait for the new zha-device-handler library to be integrated in HA? It's here: https://github.com/tschiex/core/tree/dev |
BTW, for people trying to use this. I noticed that after pairing, HA has to be restarted twice for this to properly work. The first time, only the temperature sensor shows. After one restart, all the sensors show up as well as the Button. After a 2nd restart, all 8 'Number' entities show up. @TheJulianJES Any possible explanation for this strange behavior? |
Hmm, generally it's enough to add the values to However, with the Tuya devices, the attributes are all fake anyway, so when ZHA tries to poll the attributes, it never actually gets any values. I guess we might need to do something like this:
The second approach seems nicer(?) if that works correctly for you. It might be better to send the special "update" command during from ZHA, but I don't think that's easily possible(?) |
I've rebased your branch to include the latest "Tuya data query spell" PRs. Let me know if this still works. For testing, you'll likely have to replace the complete |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #2927 +/- ##
==========================================
+ Coverage 87.62% 87.63% +0.01%
==========================================
Files 295 296 +1
Lines 9039 9084 +45
==========================================
+ Hits 7920 7961 +41
- Misses 1119 1123 +4 ☔ View full report in Codecov by Sentry. |
@TheJulianJES I tested the PR under my HA instance and the device is properly recognized and answers requests. I further "pushed" it on my running HA instance (with the edited version of the HA/zha files) and everything shows up nicely. Looks fine! |
Awesome! However, that could also mean that we need to pull in some quirks part to properly test the code in ZHA. EDIT: Hmm, although not awaiting the response of the command isn't great. (Because it's catched in |
Thought about this again, and it might be better to override If the device does not get the query data command, does it sends updates on a regular interval or not at all? |
Hello. I have that same device and I cannot get any information on ZHA. I understand you made a quirk for it but I don't understand where to get it and how to apply it in hassio. I looked at zha-device-handlers but there to there no explanation on how to add it too hassio. Does anyone has a noob easy explanation on how to add this device to ZHA? |
If you want full access to the device, with associated sensors, it will
be challenging. The device has sensors for many new types of measures,
some which exist in the Zigbee Control Library (ZCL) but not in ZHA and
some that even don't exist in the ZCL. Making the device operational in
a proper way requires changes in ZHA and HA core (have a look here:
https://github.com/tschiex/core). I have paused this for the moment
because I have more urgent things to do (and delivering proper code for
HA core is demanding).
If you want to be able to ask the device for measures using the ZHA
toolkit, this is somewhat simpler. You need to create a folder named
"custom_zha_quirks" in the config folder of HA (where the
configuration.yaml file is) and put the quirk in the new folder, then
pair the device and restart HA. Then install the ZHA toolkit and query
the suitable clusters (in ZHA, if you go to the device page, click on
the three vertical dots on the right of 'reconfigure', access the
"Manage the Zigbee device' item: you will be able to get a list of
clusters (top) and attributes to query. You can get the same measures
though the ZHA toolkit then).
Sorry to not be able to make this move forward for the moment.
Le 07/03/2024 à 13:00, mbuiot5 a écrit :
Hello. I have that same device and I cannot get any information on
ZHA. I understand you made a quirk for it but I don't understand where
to get it and how to apply it in hassio. I looked at
zha-device-handlers but there to there no explanation on how to add it
too hassio. Does anyone has a noob easy explanation on how to add this
device to ZHA?
—
Reply to this email directly, view it on GitHub
<#2927 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADRL5FAHQGEHU3TX24JFM23YXBJFVAVCNFSM6AAAAABCDJ4YWGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBTGM3DEMZYGM>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--------------e57S8joy2S4pGX5aj9c5iaCc
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: 8bit
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>If you want full access to the device, with associated sensors,
it will be challenging. The device has sensors for many new types
of measures, some which exist in the Zigbee Control Library (ZCL)
but not in ZHA and some that even don't exist in the ZCL. Making
the device operational in a proper way requires changes in ZHA and
HA core (have a look here: <a class="moz-txt-link-freetext" href="https://github.com/tschiex/core">https://github.com/tschiex/core</a>). I
have paused this for the moment because I have more urgent things
to do (and delivering proper code for HA core is demanding).<br>
</p>
<p>If you want to be able to ask the device for measures using the
ZHA toolkit, this is somewhat simpler. You need to create a folder
named "custom_zha_quirks" in the config folder of HA (where the
configuration.yaml file is) and put the quirk in the new folder,
then pair the device and restart HA. Then install the ZHA toolkit
and query the suitable clusters (in ZHA, if you go to the device
page, click on the three vertical dots on the right of
'reconfigure', access the "Manage the Zigbee device' item: you
will be able to get a list of clusters (top) and attributes to
query. You can get the same measures though the ZHA toolkit then).</p>
<p>Sorry to not be able to make this move forward for the moment.</p>
<div class="moz-cite-prefix">Le 07/03/2024 à 13:00, mbuiot5 a
écrit :<br>
</div>
<blockquote type="cite"
***@***.***">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<p dir="auto">Hello. I have that same device and I cannot get any
information on ZHA. I understand you made a quirk for it but I
don't understand where to get it and how to apply it in hassio.
I looked at zha-device-handlers but there to there no
explanation on how to add it too hassio. Does anyone has a noob
easy explanation on how to add this device to ZHA?</p>
<p
style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>
Reply to this email directly, <a
href="#2927 (comment)"
moz-do-not-send="true">view it on GitHub</a>, or <a
href="https://github.com/notifications/unsubscribe-auth/ADRL5FAHQGEHU3TX24JFM23YXBJFVAVCNFSM6AAAAABCDJ4YWGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBTGM3DEMZYGM"
moz-do-not-send="true">unsubscribe</a>.<br>
You are receiving this because you authored the thread.<img
src="https://github.com/notifications/beacon/ADRL5FAHJG5RHQBRORUCQY3YXBJFVA5CNFSM6AAAAABCDJ4YWGWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTWG62U6.gif"
alt="" moz-do-not-send="true" width="1" height="1"><span
style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message
ID: <span><zigpy/zha-device-handlers/pull/2927/c1983362383</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
***@***.***": "http://schema.org",
***@***.***": "EmailMessage",
"potentialAction": {
***@***.***": "ViewAction",
"target": "#2927 (comment)",
"url": "#2927 (comment)",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
***@***.***": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>
</blockquote>
</body>
</html>
…--------------e57S8joy2S4pGX5aj9c5iaCc--
|
thank you. Where is the latest quirk code? |
May I request a little more help? I added the quirk and rebooted but the quirk didn't applied. I got the logs and I get this message. Any idea of what is wrong ?
|
Quirks v2 will allow exposing enough metadata from quirks to have ZHA create "custom entities" from that. So, with quirks v2, it's very likely that no HA changes are needed for this. |
@mbuiot5 Sorry, I didn't remind the fact that the quirk already assumes changes in HA/ZHA. You will not be able to test it in its current state. My bad. If I find time this WE I will try to produce a "barely usable" version (using the ZHA toolkit).. @TheJulianJES What would you advise here? Should I stop and wait for Quirks v2 to be integrated in ZHA/HA or insist on using the existing Quirk system? I have the feeling that my changes in HA/ZHA go beyond registering/matching (units and measures that are not in the ZCL. Would Quirk v2 deal with this?) |
@tschiex Hi, thanks for your hard work! |
Well. The PR I had (in ZHA but also in the core of HA https://github.com/tschiex/core) was working, you may have a look at it. The only likely remaining issue was the possibility that the device still needed "Data Query" requests from ZHA to "speak". This can easily be solved by an automation and the ZHA toolkit. My understanding is that the quirks which were required to make it work (in HA, not ZHA) may become a thing of the past with the arrival of quirk v2. So I'm mostly waiting for quirk v2... |
thanks all for your work, i'd really like to integrate this pool sensors to HA too :) |
Hello, I have the same device and I try to make it working with ZHA and your quirk. I rebased your changes on HA core to the latest 2024.5.5 tag and build a HA docker image with it. I put my Dockerfile bellow:
Note: the last I successfully linked my device with ZHA but I only see the temperature sensor without value retrieved. May be I missed something to have all the sensors. Do you have some advices? Many tanks! |
I haven't fully understood why but this device will need two HA reboots to show up all its sensors. See #2927 (comment) If this is not enough, I would advise to install the ZHA toolkit and send a data query packet (Send cluster command, command id 3) to the device (target endpoint 1, use the device IEEE address). When I started trying to have the device work, I installed an automation that does this regularly. |
Thanks for your return. I try to link my device and reboot HA two times and I still have only the temperature sensor with an unknown value. I try to send the command as explain, but I'm not sure to know what I have to set as cluster value. I try different values without success. An example of sent request: service: zha_toolkit.zcl_cmd
data:
ieee: 7c:c6:b6:ff:fe:xx:xx:xx
cluster: 1
cmd: 3
endpoint: 1 The answer: zha_toolkit_version: v1.1.10
zigpy_version: 0.64.0
zigpy_rf_version: 0.38.4
ieee_org:
- 117
- 190
- 138
- 254
- 255
- 182
- 198
- 124
ieee: 7c:c6:b6:ff:fe:xx:xx:xx
command: zcl_cmd
command_data: null
start_time: "2024-05-28T12:59:21.996665+00:00"
errors: []
params:
cmd_id: 3
endpoint_id: 1
cluster_id: 1
dir: 0
tries: 1
expect_reply: true
args: []
read_before_write: true
read_after_write: true
cmd_reply:
- 3
- 195
success: true It seem to have no effect. I join my device debug info. Do you have an example of request (in YAML format) I have to sent ? Or could you please share your automation that sent the request ? |
I'm jumping on the bandwagon as I also have the exact same device. |
Jumping on here as well as I have the same device and would like to get it working with ZHA. Let me know if there's any testing or anything that would be useful. |
Any update? I have a floating brick 😭 |
I also have this device and would like to get it working with ZHA. |
I also have this device HA-less floating around, is there anything I can help you guys out? |
@TheJulianJES any development on this? |
Now that a quirk v2 ahs been proposed based on this, I will kill this. |
Do you have a link to this proposal ? Thanks ! |
Yes. My bad :-) I have installed it in my HA instance and it works flawlessly (except for the lack of units, that's another topic, related to HA more than ZHA). |
Proposed change
New quirk for a Pool sensor device. This is currently unusable because it relies on new entities/classes in ZHA (see https://github.com/tschiex/core) but it does not break anything.
Additional information
A quirk_id for the sensor has been added.
Relevant issue: #2565
Checklist
pre-commit
checks pass / the code has been formatted using Black