Closed tomvanderduin closed 2 years ago
It's possible this PR was enought to enable the power measurement for it, if you can make a try ? https://github.com/dresden-elektronik/deconz-rest-plugin/pull/5206/
I have the same device and installed it in home assistant -but no energy metering sensor was
created - any help or ideas how to remedy this?
@Smanar I built and install the PR and it made no difference
@jfparis Can you share the device JSON ? You can have it in http://phoscon.de/pwabeta Help / API information
decon.log Hi @Smanar
Please find attached. I had to rename the .json to .log to please the github interface but this should be what you asked
Regards
Have added the mac adress for the first one
const quint64 silabs3MacPrefix = 0x8cf6810000000000ULL;
But your is already in code
const quint64 YooksmartMacPrefix = 0x84fd270000000000ULL;
Can you check if your manufacture number is 0x1002 too ? in node info panel. Have updated the code, remember you need to re-include the device for the new sensor be created.
Manufacturer code is 0x1002.
Just to make sure I test properly
Should I see the power reading in the Phoscon interface as well ?
Should I see the power reading in the Phoscon interface as well ?
No, I don't think Phoscon display power measurement device, but like you have done previously is fine, take a llok in the json direclty.
For me all is fine, the device is in whitelist
{ VENDOR_EMBER, "TS011F", YooksmartMacPrefix }, // Tuya Plug Blitzwolf BW-SHP15
VENDOR_EMBER = 0x1002
YooksmartMacPrefix = 0x84fd270000000000ULL;
If it s still not working, can you share logs during the inclusion ? with "info" and "info_l2" ?
@Smanar
For some reason, I cannot compile the new branch
device.cpp:1488:20: error: ‘DBG_DEV’ was not declared in this scope
I believe this is probably due to the way I am compiling (not having a full deConz dev environment and just installing the deconz-dev package - stable version - on raspbian)
I backported your patch (essentially the whitelisting of addresses) to the previous version in your branch (the one from last week that I was able to compile) and I can confirm that I am now getting some power reading in home assistant but not in the gateway interface
All good for me. Looking forward to have this integrated in the stable version
The code is now in the master branch, just validated, and yes the deconz-dev package is updated ATM because ddf file
Have same issue than you for the moment after having installed qtdeclarative5-dev and libqt5qml5
Hey @Smanar , I have the same plug but different manufacturer. Should that also work?
Product name: Tuya smart plug 16a Manufacturer: _TZ3000_ew3ldmgx Model identifier: TS011F
Device type : Smart plug with power metering (EU version)
Rebranded as: Smatrul Rebranded model: BSD33
if needed this is the info of my Tuya device
Node info:
Node info:
Basic cluster
Simple metering cluster
Electrical measurement cluster:
On/Off cluster attributes:
I am also using the Tuya smart plug and would really be interessted in the energy monitoring feature. Since I am new to the HA world - is this a feature that is currently into development/integration? If yes, is there a way to test this?
Thank you very much!
@HejThereWorld Be aware that not all zigbee Tuya plugs have this power monitor feature. And also be aware that Tuya devices are rebranded many times, so I assume all different "manufacturers" should be added to the deconz codebase.
the above mentioned PR adds the "power monitor" feature to deconz (and Home Assistant), It is part of release 2.13 which is currently in beta: https://github.com/dresden-elektronik/deconz-rest-plugin/releases/tag/v2.13.1-beta
In supervisor you can find the deconz version you are running on:
If you share your manufacturer (something that contains _TZ3000 )from the deconz gui, we could check if it's part of that release...
I have the same plug but different manufacturer. Should that also work?
Like have said @thomas-svrts I can't be sure. The PR is working for lot of device with model id "TS011F" using a generic way.
But the code use white/black list for sensors, so this can prevent the device creation.
Your seem fine too for that for the version I m using ATM
const quint64 silabs14MacPrefix = 0x0C43140000000000ULL;
@HejThereWorld Be aware that not all zigbee Tuya plugs have this power monitor feature. And also be aware that Tuya devices are rebranded many times, so I assume all different "manufacturers" should be added to the deconz codebase.
the above mentioned PR adds the "power monitor" feature to deconz (and Home Assistant), It is part of release 2.13 which is currently in beta: https://github.com/dresden-elektronik/deconz-rest-plugin/releases/tag/v2.13.1-beta
In supervisor you can find the deconz version you are running on:
If you share your manufacturer (something that contains _TZ3000 )from the deconz gui, we could check if it's part of that release...
Hi, That is what I can find in the deCONZ app for the manufacturer.
Thank you very much for you help.
@HejThereWorld your mac address is in the same range as mine. So comment of Smanar is also valid for you:
Your seem fine too for that for the version I m using ATM
const quint64 silabs14MacPrefix = 0x0C43140000000000ULL;
So let’s hope that they move quickly to a stable release of deconz. (Normally they have a stable release every 2á3 months, so I expect a release in November…). Or does somebody know an easy way to install a beta release as ha addon?
edit: check https://github.com/dresden-elektronik/deconz-rest-plugin/issues/4838 Someone tested the same device you reported and confirmed it works with the last beta
I have a _TZ3000_cphmq0q7
Is it also in it?
As i see from zigpy, they also handled both the restore of powerOnOff and power readings. Is there a way to create a DDF file for this? I am using _TZ3000_ew3ldmgx and only On/Off works on this. Thanks...
The power reading is workng on last version on ? Wich one version have you ? Your device is a "TS011F" ? Have you tried a re-inclusion ? For the restore of poweronoff can try this edition on the xml file
Just after
<attribute id="0x8001" name="Light mode" type="enum8" default="0" required="m" access="r">
<value name="Mode 1" value="0"></value>
<value name="Mode 2" value="1"></value>
<value name="Mode 3" value="2"></value>
</attribute>
Add
<attribute id="0x8002" name="Power on state" type="enum8" default="0" required="m" access="r">
<value name="Off" value="0"></value>
<value name="On" value="1"></value>
<value name="Last state" value="2"></value>
</attribute>
<attribute id="0x8004" name="Switch mode" type="enum8" default="0" required="m" access="r">
<value name="Command" value="0"></value>
<value name="Event" value="1"></value>
</attribute>
If it work pls make a PR.
@Smanar, thanks for showing me the way. I use deconz 12.3.2.beta. My device is a TS011F with manufacturer code _TZ3000_ew3ldmgx. I did a re-inclusion; still only on/off works. Power readings 0x505, 0x508 and 0x50B are all '0' all the time. Although i do not know the refresh period of these values i happened to test it for short periods. I am gonna test it hourly tomorrow.
This works perfectly for the Power On State:
<attribute id="0x8002" name="Power on state" type="enum8" default="0" required="m" access="rw">
<value name="Off" value="0"></value>
<value name="On" value="1"></value>
<value name="Last state" value="2"></value>
</attribute>
I had to change access="r" to access="rw" in order to be able to change the setting. Although i didn't had any use for 0x8004 - "Switch Mode" for this particular plug, i put it there anyway.
i didn't had any use for 0x8004 - "Switch Mode" for this particular plug, i put it there anyway.
As you want it's your PR, but it was for other devices, it s a same place, it's just to avoid making 2 PRs.
And BTW, thx for making the PR
I have used the DDF files from the latest beta version and got it to report measurement values, but I have a problem. In the cluster (Wh): In Node-red/HA:
480 vs 4800.
Is it possible to solve this directly from the DDF?
It seems to return 4 digits instead of 3, which should be "0482" instead of "4820".
Are you sure? The value 482 reported by Tuya means 4,82kWh or 4820 Wh.
Ok, I just realized that it could be true, the problem as far as I can see is that HA in the Energy section is measuring that value multiplied by two.
I'll have to see if tomorrow that failure repeats itself again, or if the meter is reset correctly.
I think I can consider the measurement as correct.
And yes it s possible, on the DDF editor, you have a field "Expression" with something like "Item.val = Attr.val" you can add a *10 or / 10.
I just received the Tuya 16A Smart Plug and connected it to Conbee II and deConz 2.13.01 and HA 2021.11.5 This is my device ID:
The electric measurement is present and correct in deConz:
But electric data does not exist in HA. Instead, I note that the same error (phantom device registrations) appear with this new Tuya Smart Plug as with the old Tuya Smart Plug model:
Old Plug (the big one):
New Plug (with the yellow collar):
As you can see, the new (yellow) plug does not offer any electric measurement data, but it suffers from the same number of phantom switches. This seems to be a consistent issue with all Tuya devices. I have several other Smart Plugs, (Develco, Aqara, Apex) and none of them have such issues with missing electric measures and phantom plugs.. I wonder what is it that Tuya does, to make so much trouble (incompatibilities) ?
There is a strange issue on this device ATM https://forum.phoscon.de/t/new-tuya-smart-plug-nas-wr01b-or-tz3000-w0qqde0g/819
It seem reporting is not working.
Perhaps a stupid question, byt why is it that electric measurement data is not present in the event message from the REST API, event though it does show in HA ?
{
"17:31:13:495": {
"attr": {
"id": "45",
"lastannounced": "2021-11-20T22:07:00Z",
"lastseen": "2021-11-23T16:31Z",
"manufacturername": "LUMI",
"modelid": "lumi.plug.maeu01",
"name": "Smart plug Aqara",
"swversion": "09-10-2019",
"type": "Smart plug",
"uniqueid": "04:cf:8c:df:3c:82:39:9c-01"
},
"e": "changed",
"id": "45",
"r": "lights",
"t": "event",
"uniqueid": "04:cf:8c:df:3c:82:39:9c-01"
},
"17:31:48:306": {
"e": "changed",
"id": "45",
"r": "lights",
"state": {
"alert": "none",
"on": false,
"reachable": true
},
"t": "event",
"uniqueid": "04:cf:8c:df:3c:82:39:9c-01"
}
}
I was expecting to be able to see all data in the Event stream ?
It s because the value is not updated in the API, and I think the api is configured to send only changed value on your side. You can try to look direclty in the api http://phoscon.de/pwabeta in help / api information.
And this one is not a tuya one.
That's exactly what I was doing. The above event stream was picked up from the help / API information.
Lol, oups, sorry, haven't reconized it ^^.
But it s the notification, according to your setting it can send only changed value, on same place you can see the complete json, And remember the Consumption is a "sensor", the one on your post is the "light" device. You have at least 1 light + 1 sensor (or more) for your device.
Aha - to my big surprise, it does show up as a sensor: //192.168.XX.XX:6080/api/CC04FEXXXX/sensors/32
{
"config": {
"on": true,
"reachable": true
},
"ep": 1,
"etag": "388765bb6598093b31862ede4f1fc8ec",
"lastannounced": null,
"lastseen": "2021-11-23T21:28Z",
"manufacturername": "_TZ3000_cphmq0q7",
"modelid": "TS011F",
"name": "Consumption 32",
"state": {
"consumption": 8650,
"lastupdated": "2021-11-23T21:28:32.503",
"power": 0
},
"type": "ZHAConsumption",
"uniqueid": "84:71:27:ff:fe:8d:96:1d-01-0702"
}
However, this "sensor" is not listed in Phoscon under "Sensors" !
And of course, no sensors are visible in Phoscon for the "new" Tuya Plug - although all the sensors are visible in deConz.
You did "something" with the configuration to make this work for the "old" Tuya Plug.
Now the problem is back again for this "new" version of the Tuya Plug.
Will it be like this every time ? And only for Tuya products ?
Can you fix this also, just like you did for the "old" Tuya plug ?
But ZHAConsumption are never displayed in phoscon. I don't understand what is the issue ?
That was my mistake, I'm sorry for the confusion. You answered my question perfectly.
The remaining "issue" is how to get electric measurements from the "new" Tuya Plug visible in HA. I just hope this can be fixed ?
Ha the link above ?
I realy don't have idea for the moment, and it s same code for all tuya plug, so this one have something specal, but no idea yet.
After updating deConz to 2.13.02 the new Tuya works as expected with electric measurements. Moving onwards to deCONZ 2.13.03 and it still works 😊
However, my new Tuya Power strips fails to provide correct electric measurments. https://www.aliexpress.com/i/4001148859962.html
This is what is shown in the API:
{
"18:44:14:416": {
"config": {
"on": true,
"reachable": false
},
"e": "changed",
"id": "38",
"r": "sensors",
"t": "event",
"uniqueid": "60:a4:23:ff:fe:80:2b:dd-01-0b04"
},
"18:45:01:575": {
"attr": {
"id": "38",
"lastannounced": null,
"lastseen": "2021-12-10T17:45Z",
"manufacturername": "_TZ3000_o005nuxx",
"modelid": "TS011F",
"name": "Power 38",
"swversion": null,
"type": "ZHAPower",
"uniqueid": "60:a4:23:ff:fe:80:2b:dd-01-0b04"
},
"e": "changed",
"id": "38",
"r": "sensors",
"t": "event",
"uniqueid": "60:a4:23:ff:fe:80:2b:dd-01-0b04"
}
}
Why is a device listed as "unreachable" and still it produces an output (?) Doesn't the fact that the output triggers the API imply that the device somehow is reachable?
Here's the node info:
0000 Basic Cluster info:
0006 On/Off cluster:
This is the cluster list for 1 of the 4 identical output sockets.
It's interesting to notice that there is no information anywhere about electrical measurements. Still, two entities shows up both in the API as well as in HA:
Is it somehow possible to 'fix' this so that electric measurements becomes usable? Many thanks in advance.
Why is a device listed as "unreachable" and still it produces an output (?) Doesn't the fact that the output triggers the API imply that the device somehow is reachable?
Yes, but I have the impression seing this issue all the time ATM. But the code is moving a lot.
Now the bad news, this device don't use classic zigbee cluster for power and consumption, IDK how you can have them in the json (but now I understans why this sensor is marked as unreachable). Its totally new cluster, not used by deconz yet.
So not even DDF could solve this?
No, need firt to sniff the traffic to find how work this new cluster (if it s not already done on other project) them add it in deconz code.
Are you using Google Translate?? Your sentence makes no sense at all. What does "firt" mean? "them add in" what does that mean?
Lol, not but a bad english.
was "first", and the rest mean we need to add something in the deconz core to manage this cluster.
Wasn't the main purpose of the DDF to allow adding almost everything - via end-user configuration ? Thus, no longer the need to make more PR for core modification and recompiling? Or am I wrong?
Wasn't the main purpose of the DDF to allow adding almost everything - via end-user configuration ? Thus, no longer the need to make more PR for core modification and recompiling? Or am I wrong?
Yes exactly, but the support in DDF core need to be added feature by feature, the next step will be the battery switches, then the tuya cluster.
If this device use "normal working mode", you can use DDF file even with a not supported cluster in deconz. But for that you need to know with one cluster is used 0xE000 or 0xE001 and wich one attribute need to be read. If the device use the same working mode than the tuya cluster, it will be not possible yet using DDF.
And BTW, are you sure this device support power measurement ? it s not present in z2m too https://www.zigbee2mqtt.io/devices/SM-SO306EZ-10.html
I added a DDF for Neo NAS-WR01B (i.e. model TS011F with manufacturer __TZ3000w0qqde0g) in this pull request.
@torandreroland the ddf worked - thanks
but in Home Assistant I can see a refresh rate for example on the power consumption of 5min
I can't help it, but I have a distinct feeling that DDF could be the magic wand that can solve my problem. The problem is that I hardly understand anything about what, how and why when it comes to DDF. You guys seem to understand exactly how to exploit DDF. Could you point me in the right direction to something readable to begin my learning process?
@oywino I personaly don't know that much about ddf. The only thing I know is that they point the data from those devices to the right directions.
For Installing: I copied @torandreroland ddf file to /usr/share/deCONZ/devices/neo/NAS-WR01B.json and readded my devices - and it worked
What exactly do you mean by "and added my device" ? How did you add your device to his DDF file? Were your device identical to his?
So for me I don't had to assign this ddf to my devices - deCONZ knows that this ddf exists and that my device can/should use it
Device
Product name: Tuya smart plug 16a Manufacturer: _TZ3000_dpo1ysak Model identifier: TS011F
Device type : Smart plug with power metering
Screenshots