-
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
[Device Support Request] _TZE204_ac0fhfiq TS0601 BiDirectional ZigBee Energy Meter with 150A Clamp Current Sensor #2420
Comments
I am also looking to get this device supported. The seller mentioned that they could provide configuration assistance for z2m so I have asked them for this information, if I get a response I will share it here. |
I just got one of those. I tried to make it work by adding a TS0601.js file with the parameters for a _TZE204_cjbofhxw : `const fz = require('zigbee-herdsman-converters/converters/fromZigbee'); const fzLocal = { const definition = { module.exports = definition;` I modified the model. The energy value (datapoint 101) works (seems to work). But the rest is either null or 0 when I try other datapoints. Hope this helps. |
Most likely the same quirk can be used as the one resulting from #1973. Probably only need to add the additional device name. |
I'm really new to this, I know nothing about Zigbee, I couldnt get #1973 to work. I managed to use @jkfamillerosier TS0601.js , I found out that you need to have current in the wire with the clamp before you pair the device. Then it gave me another datapoint 102 wich is 0 or 0.1 depending on the direction of the clamp. The energy datapoint 101 seems ok, it gave me 0.03Kwh The sort of "manual" that came with the device gives a hint about how to see the way the current is going, apparently the end number of power I guess is supposed to be 1 or 0 |
I took the quirk from that issue and changed the MODELS_INFO in TuyaPowerMeter to:
After removing the device, deleting pycache, restarting and re-pairing, the quirk is not shown in the device. |
I did some testing with this js , 101 datapoint is definitly the instantaneous power in W (mesured with a fan with 3 speed buttons 35W/41W/49W)
|
Did you define the custom_quirks_path in your configuration.yaml as described f.e. here? |
Yep, I even have enable_quirks out of desperation.
In the logs for HA I do see "Loaded custom quirks". Are there normally further log messages about custom quirks? |
Is working OK in my test systems and getting tuya DP commands in the log. |
Thanks @MattWestb, I have at least got the quirk loaded now. In my logs I saw the following:
So I added the missing endpoint (242) to the #1973 quirk with
and this to the ENDPOINTS dictionary
Does the need for this additional endpoint possibly suggest I have a different variant?
There are about 30 of these, are they the problem? |
EDIT: As shown in later posts, the quirk file listed in this message (from #1973) does NOT work for the _TZE204_ac0fhfiq device. I do leave my original message as reference used when starting the discussion, but it's contents should NOT be used for this device by readers.
|
2023.5.4
My quirk is identical to that, except for the model identifier and the
The clamp is attached to the main live line entering my house, I have also tried the neutral line.
I have restarted several times since adding the device, no new entities have appeared
[zigpy.appdb] Current database version is v11 (table version v11)
I also have some zb tuya monitoring plugs that are working but also show the power factor as Unknown, so I guess that is a "feature" In the logs did see a number
I made the following changes to the datapoints (converters removed for now), the
The active power seems to be correct. Turning on an electric shower increased the value to ~10KW. I have no experience with quirks or python so I have no idea what I am doing lol. @stombi, how did you identify the datapoints? Are they all showing the correct values for you? How are these datapoints supposed to work? |
I know nothing, I'm discovering about all this because my device didnt work :-) @reef-actor can you share your quirk file to see if it works on my system? |
|
Thank you! Same as before for me it throws an error, unfortunatly I know almost nothing about python
|
Is is possible you are using an older version? dp_type was removed recently (and caused a lot of people using custom quirks to see errors like yours) . If you search in the quirk file in this comment and search for dp_type you will see where you need to add them. Bear in mind you will need to remove them again if you update... |
This code works for me. This code works for me, I can't change the name for current and voltage, which gives consumption and production
|
I have found that changing datapoint 1 & 2 to the following I can also get the summation delivered (i.e. total energy consumption)
[Updated with x10 scaling factors for correct values] |
So far the Active Power and Summation Delivered/Received values seem to be good, but my logs were filled with the errors like these (filtered for clarity):
I noticed in another tuya energy quirk they are using a definition like this
With a bit of playing around I have datapoint 6 to
The rms_current value is not quite right though (!). By my calculation in this instance it should be about 10.5A, And I can't understand why active_power is creating errors as it seems to be reporting the correct values in HA. |
Thanks @fred-c1
The result is this Neither seem quite right to me? Perhaps I misunderstand ac power calculations? |
@reef-actor : I also bought a unit here: Debug info from zigbee2mqtt: The above table was provided by the seller last week. (Active) power = RMS_voltage * RMS_current only works for pure sine waves with no delay For active power, you should use dpID 101 and 102 |
So I think I have a working datapoint definition.
The current value returned seems to not require /1000 as the document states (maybe HA is doing some conversion of its own?). So now I have:
I don't have any power generation, which I think is why I don't see Summation received or the power direction indication in HA. If anyone has experience in tidying this up and getting it prepared for pushing upstream without stomping over the existing ts601_din_power.py, I think it is ready. Full quirk: |
Hi @reef-actor I am trying to setup a different device but it is very similar to the device that you have been working with. I have a 3-phase Tuya Power Meter. It is not bidirectional, not sure if this is important. I used your quirk and after changing MODELS_INFO and manufacturer_code ZHA accepted this quirk for my device. Do you have any ideas what I should do next to make it work? I am glad that I did not switched my network from ZHA to zigbee2mqtt because it looks like this device works fine there. Or created a Tuya gateway and connected it to HA, which is not cool and not secure solution anyway. I had no experience in quirks or python before but I learn fast so hope to solve it instead of buying another power meter. I got this far anyway. |
Enable debug logging as described here. The device is probably using different endpoint IDs (data items like voltage, current, power are "endpoints"). With the logging enabled you might see some messages like "unhandled/undefined endpoint" (unsure of the exact wording) in the HA log. Without a device datasheet it is a guessing game for which data point is which value and what scaling needs to be applied. In the case of the device this issue is originally about current and voltage are combined in one endpoint which required picking out specific bytes from the endpoint value which would have been close to impossible without the datasheet. Try changing the endpoint IDs with the ones you see in your HA logs, delete the pycache dir and restart HA. Hopefully you will start to see some new entities and you can work out which values are which. Good luck! (Oh, and for power factor, I think it is added by default. I have never seen it provide any value for any of my power monitors so just disable the entity) |
Thank you for all your suggestions! I got it working! Used attribute 1 to get total consumed kW and attribute 6 to get rms_current and rms_voltage. Was not able to get data for all 3 phases but not really need it right now, can just use the total data since I got only one phase connected anyway. See some other values in logs - lots of zeroes - that are probable other phase data. Got value 50 - that is probably 50Hz. Obviously got some results only 10 minutes after I ordered a 1-phase power meter because found a working quirk for it somewhere in another issue. Classic I now understand a bit better how the world works and will be joining a club for python haters tomorrow. P.S. Can't get active power without voodoo magic but can probably do this and it will work fine. Not sure about RMS and non-RMS though and will I get correct power out of it, need to google that later.
that looks horrible but not sure if this can be done any other way P.P.S. It looks like to get any values (even if your quirk is correct) you need to add a device, make sure that it uses your quirk and then reboot HA. Others you will get stuck with only Power Factor sensor being unknown and no other sensors P.P.P.S. Is there a way to calculate summation power together with some static value that can be changed in HA ? |
For calculating active power, I unfortunately think you're right about AC, it's not so straightforward. If I remember the formula involves the power factor. The power factor or the values needed to calculate it (phase angle?) aren't exposed, so if you want an accurate active power value it needs to come from the monitor. I was also thinking about the possibility of syncing the sum delivered to the actual meter. It's possible that there may be a zb command to overwrite the stored value, but my current idea is a template sensor with an offset value. |
Actually, since we are getting RMS values it means that we can just do rms_current * rms_voltage and get the correct value. If it was not-RMS - then yea, it would be a problem. And this is just for one phase only (but I only have one phase in the house so it is ok). I have checked it with 5kW heater and it is very accurate. And since it is not something that we increment and the error can stack - I think I will use this for now |
For syncing with the actual meter, HA has the utility meter helper which has a "calibrate" service to which you give the reading on your meter so they match up. |
oh yea, thx for that hint. I created all types of energy meters that can reset daily hourly and monthly and even a day/night tarries. P.S. after setting up all the energy meters and stuff I found out the Power panel/dashboard and it does this automatically based on summation counter and shows it so much better then normal UI's that I created in the main panel |
@reef-actor Any idea how to show 3 pairs of data for this device? Actually 4 - 3 phases and 1 total. Like "RMS Voltage A", "RMS Voltage B", etc I have an idea of how to find correct datapoint IDs for all the data : writing a script that will look at logs and show me some info and I will be able to see what is what based on that. But without the ability to create datapoints for different phases - that would be pointless. |
@reef-actor have you had to update the quirk? Using your one, my Active Power is off and the Summation is always 0
|
Still working for me. Looking at the log message, dp102 is for the power direction (which didn't show for me because I have no solar etc). Could be worth seeing what happens if you turn the clamp to face the other direction? |
I don't have solar ether. I turned it around and have the same issue. These devices are really weird |
Hi, |
I think that is just the behaviour of the official app. Over zigbee the direction comes in as a seperate datapoint (DP102, line 177 in this quirk). However I have no energy production equipment to test against so have not seen this value received - it might need more work. |
no it isn't another endpoint : the DP102 is not provided by the device (in my case). The summation delivered only increase if this third digit is 1. |
Aims to address device support requests: 2 bidirectional clamps: zigpy#2549 (_TZE204_81yrt3lo) zigpy#2650 (_TZE200_rks0sgb7) 1 bidirectional clamp: zigpy#2420 (_TZE204_ac0fhfiq) 1 clamp: zigpy#1973 (_TZE204_cjbofhxw) @jmuf I've just spotted that in parallel you've also been working on zigpy#2870 for _TZE200_rks0sgb7, shall we pool ideas?
Hi May you share which quirk to use to have total energy Summation? |
I would be surprised if it was a quirk issue, certainly seems like something odd is going on with the device. Does it report the correct active power use? I think current development support for these devices has moved to #2961, so probably best to get the new quirk from there and contribute to that discussion. Hopefully we will have native support for these soon! |
8,388,607 happens to be the largest number (signed int) that can be represented in 3 bytes. Which suggests that it might be value saturation. The comment from fred-c1 #2420 (comment) says summation_delivered is 4 bytes (max > 2m kWh) but I wonder if the scaling prevents the full range being used. |
Thanks for your interresting answer. It seems to be the correct explanation. did some body have found a way to reset the counters on this equipement ? |
Maybe this process could be used? I'm at 3,700kWh so haven't encountered this yet but it seems like it is something I will have to deal with at some point. |
Thanks i have already this process on this device. But it doesn't work. |
ohoh, same pb here, counter is lock at 8388.6 kwh. Someone find a solution ? |
Hello. This is what works for me. {% if (rc 1000)%10 ==0 %} {{ap}} |
Problem description
Hi I would like to request device support for the _TZE204_ac0fhfiq TS0601 BiDirectional ZigBee Energy Meter with 150A Clamp Current Sensor.
It apears in HA, but without any sensor.
product link : https://www.aliexpress.com/item/1005005466228073.html
Solution description
Any
Screenshots/Video
Screenshots/Video
[Paste/upload your media here]
Device signature
Device signature
Diagnostic information
Diagnostic information
Logs
Logs
Custom quirk
Custom quirk
Additional information
No response
The text was updated successfully, but these errors were encountered: