Skip to content
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

New device: Tuya smart plug 16a #5334

Closed
tomvanderduin opened this issue Sep 30, 2021 · 115 comments
Closed

New device: Tuya smart plug 16a #5334

tomvanderduin opened this issue Sep 30, 2021 · 115 comments
Labels

Comments

@tomvanderduin
Copy link

Device

Product name: Tuya smart plug 16a
Manufacturer: _TZ3000_dpo1ysak
Model identifier: TS011F

Device type : Smart plug with power metering

Screenshots

1 clusters
2 node info panel
3 cluster info
4a identity
4b groups
4c scenes
4d on-off
4e simple metering
4f electrical metering
4g otau

@Smanar
Copy link
Collaborator

Smanar commented Sep 30, 2021

It's possible this PR was enought to enable the power measurement for it, if you can make a try ?
#5206

@hcpalka
Copy link

hcpalka commented Sep 30, 2021

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?

@jfparis
Copy link

jfparis commented Oct 5, 2021

@Smanar I built and install the PR and it made no difference

  • Switched are recognised as a "light"
  • power statistics are not available

@Smanar
Copy link
Collaborator

Smanar commented Oct 5, 2021

@jfparis Can you share the device JSON ?
You can have it in http://phoscon.de/pwabeta Help / API information

@jfparis
Copy link

jfparis commented Oct 10, 2021

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

@Smanar
Copy link
Collaborator

Smanar commented Oct 10, 2021

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.

@jfparis
Copy link

jfparis commented Oct 10, 2021

Manufacturer code is 0x1002.

Just to make sure I test properly

Should I see the power reading in the Phoscon interface as well ?

@Smanar
Copy link
Collaborator

Smanar commented Oct 10, 2021

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" ?

@jfparis
Copy link

jfparis commented Oct 10, 2021

@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

@Smanar
Copy link
Collaborator

Smanar commented Oct 11, 2021

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

@thomas-svrts
Copy link

thomas-svrts commented Oct 26, 2021

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

@thomas-svrts
Copy link

if needed this is the info of my Tuya device

Node info:
Schermafbeelding 2021-10-26 om 14 53 15
Node info:
Schermafbeelding 2021-10-26 om 14 55 34

Basic cluster
Schermafbeelding 2021-10-26 om 14 53 05

Simple metering cluster
Schermafbeelding 2021-10-26 om 14 54 21

Electrical measurement cluster:
Schermafbeelding 2021-10-26 om 14 54 42

On/Off cluster attributes:
Schermafbeelding 2021-10-26 om 14 53 59

@HejThereWorld
Copy link

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!

@thomas-svrts
Copy link

thomas-svrts commented Oct 26, 2021

@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:
Schermafbeelding 2021-10-26 om 17 24 35

If you share your manufacturer (something that contains _TZ3000 )from the deconz gui, we could check if it's part of that release...

@Smanar
Copy link
Collaborator

Smanar commented Oct 26, 2021

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
Copy link

@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: Schermafbeelding 2021-10-26 om 17 24 35

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.
image

Thank you very much for you help.

@thomas-svrts
Copy link

thomas-svrts commented Oct 26, 2021

@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 #4838
Someone tested the same device you reported and confirmed it works with the last beta

@diibify
Copy link

diibify commented Nov 5, 2021

I have a _TZ3000_cphmq0q7 Is it also in it?

@febalci
Copy link
Contributor

febalci commented Nov 11, 2021

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...

@Smanar
Copy link
Collaborator

Smanar commented Nov 12, 2021

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.

@febalci
Copy link
Contributor

febalci commented Nov 12, 2021

@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.

@Smanar
Copy link
Collaborator

Smanar commented Nov 13, 2021

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

@jasimancas
Copy link

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):
image
In Node-red/HA:
image
image

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".

@thomas-svrts
Copy link

Are you sure?
The value 482 reported by Tuya means 4,82kWh or 4820 Wh.

@jasimancas
Copy link

jasimancas commented Nov 20, 2021

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.

@Smanar
Copy link
Collaborator

Smanar commented Nov 20, 2021

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.

@oywino
Copy link

oywino commented Nov 22, 2021

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:
image

The electric measurement is present and correct in deConz:
image

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):
image

New Plug (with the yellow collar):
image

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) ?

@oywino
Copy link

oywino commented Jan 24, 2022

@steljwagh - thanks for you reply, but regretfully - I'm still a bit lost.
Is it so that a DDF file is specific for each device (item) and brand (model)?
So in the case #5570, that file will only work for a Tua Smart Plug TZ3000_w0qqde0g , right?

@steljwagh
Copy link
Contributor

@oywino you're welcome.
Indeed, you have to change the "manufacturername" in the DDF to get it applied on your specific device. Also the ID is used, but since TS011F is maintained by the different models of these plugs (so it seems), that's probably also kept the same with your plugs.

@iisworks
Copy link
Contributor

Ah my bad, I mistakenly took you for @iisworks , he is the one that announced a fw update introduced reporting back.

I also created a new DDF for the TZ3000_w0qqde0g and it worked, but had serious issues with DDF in general (slowing deconz to a crawl and eventually crashing it), so I am holding off for now. There are 15 brand new updated plugs waiting for the next Beta, will try again then. :)

@oywino
Copy link

oywino commented Jan 24, 2022

On the DDF cheat sheet Dresden writes "All DDF coming with deCONZ typically reside in /usr/share/deCONZ/devices/generic/"
But in my installation, this folder contains no DDF files at all. This is the content of that folder on my system:

#/usr/share/deCONZ/devices/generic 
# ls

total 24
drwxr-xr-x5 root root 4096 Dec 29 10:29 ./
drwxr-xr-x 13 root root 4096 Dec 29 10:29 ../ 
drwxr-xr-x2 root root 4096 Dec 29 10:29 color_control_cluster/
-rw-r--r--1 root root 1824 Dec 18 15:54 constants.json
drwxr-xr-x2 root root 4096 Dec 29 10:29 items/
drwxr-xr-x2 root root 4096 Dec 29 10:29 subdevices/

(I'm not sure why it says: total 24)

@Smanar
Copy link
Collaborator

Smanar commented Jan 24, 2022

All DDF coming with deCONZ typically reside in /usr/share/deCONZ/devices/generic/ on a Linux system and are loaded first

Thoses one will be modified every time you update deconz.

However, files residing in the home directory of the user running deCONZ (e.g. /home/deconzuser/.local/share/dresden-elektronik/deCONZ/devices) will override the pre-packaged files to allow users to amend and keep their own files if desired.

But the path can change on docker

https://github.com/dresden-elektronik/deconz-rest-plugin/tree/master/devices/generic

You are 1 folder too hight ^^.

@oywino
Copy link

oywino commented Jan 24, 2022

@Smanar - do you mean this folder:

/usr/share/deCONZ/devices 
# ls
total 172 
drwxr-xr-x 13 root root 4096 Dec 29 10:29 ./
drwxr-xr-x 10 root root 4096 Dec 29 10:29 ../ 
-rw-r--r--1 root root 120646 Dec 18 15:54 button_maps.json
drwxr-xr-x2 root root 4096 Dec 29 10:29 dresden_elektronik/ 
drwxr-xr-x5 root root 4096 Dec 29 10:29 generic/
drwxr-xr-x2 root root 4096 Dec 29 10:29 ikea/ 
drwxr-xr-x2 root root 4096 Dec 29 10:29 immax/
drwxr-xr-x2 root root 4096 Dec 29 10:29 innr/ 
drwxr-xr-x2 root root 4096 Dec 29 10:29 lutron/ 
drwxr-xr-x2 root root 4096 Dec 29 10:29 philips/
drwxr-xr-x2 root root 4096 Dec 29 10:29 samsung/
drwxr-xr-x2 root root 4096 Dec 29 10:29 tuya/ 
drwxr-xr-x2 root root 4096 Dec 29 10:29 wiser/
drwxr-xr-x2 root root 4096 Dec 29 10:29 xiaomi/ 

@Smanar
Copy link
Collaborator

Smanar commented Jan 25, 2022

Yep you can use this one, make a folder for exemple "personnal_DDF" inside this one, but remember this folder is for deconz, so you can use it for test, but the next time you will update deconz, the folder will be deleteds

@oywino
Copy link

oywino commented Jan 25, 2022

@Smanar, your contribution and knowledge is highly appreciated. Thank you for sharing.

@Flight777
Copy link

I've got the same issue now with:

_TZ3000_typdpbpg

@Smanar
Copy link
Collaborator

Smanar commented Jan 27, 2022

Can do same fo all plugs #5633 (comment)

@steljwagh
Copy link
Contributor

Today I received the Tuya gateway, which solely purpose was only to update all of my Tuya zigbee plugs to get them remember the last state they were in.
Well, It worked perfectly, every plug was updated to version V1.0.10 (298.81KB), which I tried to obtain by decrypting SSL, but unfortunately that failed. If somebody can sniff that image, an update though Deconz could be made easily as well.

But, for 15 dollar you can update all of your slimline Tuya zigbee plugs. Beware btw, they are lacking of quality control, you can see much signal difference between some plugs.

@EmJay276
Copy link
Contributor

Where in Deconz did you got the option to set power on state after the firmware upgrade?
It's the main disadvantage for this plus atm, it's highly unwanted after a power outage that all the plugs are off.

on the on/off cluster you can see and change that behaviour: Schermafbeelding 2022-01-21 om 16 36 44

0x8002 is not available for my Blitzwolf SHP15 Device :(
Any suggestion?
grafik
grafik

@Smanar
Copy link
Collaborator

Smanar commented Feb 17, 2022

What is your deconz version ?

@EmJay276
Copy link
Contributor

EmJay276 commented Feb 17, 2022

I should be on something like v2.14.0-beta (I'm exactly on my Pull-Request version https://github.com/EmJay276/deconz-rest-plugin/tree/Tuya-fix-offset_BRT-100). I can merge the current master branch if needed.

But I think the problem is the "to old" firmware version I have. @steljwagh mentioned he needed v1.0.10, I am at app version 69, which should be 1.0.6(?). But I don't have a Tuya gateway to update it and there is no sniff available to use the conbee 2

@Smanar
Copy link
Collaborator

Smanar commented Feb 17, 2022

This attribute is in the deconz xml file, so if you have a recent version you need to have it displayed in the GUI https://github.com/dresden-elektronik/deconz-rest-plugin/blob/master/general.xml#L654

@EmJay276
Copy link
Contributor

I just merged the newest master commit, but I still don't see the 0x8002 id.
Do I have to reset/reconnect the device or anything else?

@Smanar
Copy link
Collaborator

Smanar commented Feb 18, 2022

You need to install the last deconz application, the github is just for the API plugin used by it.
Or you can edit the xml file yourself.

/usr/share/deCONZ/zcl/general.xml

@EmJay276
Copy link
Contributor

EmJay276 commented Feb 18, 2022

Thanks, that worked like a charm. It was a bit tricky to edit the file, 'cause I'm running deCONZ in a docker container.
But it worked! Thank you very much!

@Smanar
Does the GUI also use the https://github.com/dresden-elektronik/deconz-rest-plugin/blob/master/general.xml file? Or is it stored somewhere else?
I build a new docker image with the changes you linked but it didn't affect the file within the docker container. I had to edit the file within the docker container.

@Smanar
Copy link
Collaborator

Smanar commented Feb 18, 2022

Or is it stored somewhere else?

It's stored on deconz folder itself (or deconz system config folder), when you install it, when manup update the deconz package it take the one from the githup, but the file is not updated when you use github stuff.

@github-actions
Copy link
Contributor

As there has not been any response in 21 days, this issue has been automatically marked as stale. At OP: Please either close this issue or keep it active It will be closed in 7 days if no further activity occurs.

@github-actions github-actions bot added the stale label Mar 12, 2022
@github-actions
Copy link
Contributor

As there has not been any response in 28 days, this issue will be closed. @ OP: If this issue is solved post what fixed it for you. If it is not solved, request to get this opened again.

@Tjomsen
Copy link

Tjomsen commented Apr 25, 2022

Today I received the Tuya gateway, which solely purpose was only to update all of my Tuya zigbee plugs to get them remember the last state they were in. Well, It worked perfectly, every plug was updated to version V1.0.10 (298.81KB), which I tried to obtain by decrypting SSL, but unfortunately that failed. If somebody can sniff that image, an update though Deconz could be made easily as well.

But, for 15 dollar you can update all of your slimline Tuya zigbee plugs. Beware btw, they are lacking of quality control, you can see much signal difference between some plugs.

@steljwagh
Can I ask what specific gateway is needed? Never looked at Tuya gateways, but googling I see a lot of different ones...

@phwagner82
Copy link

the problem is still there (2.16.01)

@Smanar
Copy link
Collaborator

Smanar commented May 30, 2022

Wich one issue ?
On some firmware, it s not working natively and need poll for the other just need a DDF.
what is your manufacture name ?

@phwagner82
Copy link

@Smanar the Tuya _TZ3000_gjnozsaz TS011F
i have the latest Firmware installed on the device (1.0.10)
If i need a DDF, can you discribe how to add the ddf file in HAOS. i found no way to add the file in the container.
Kind regards
Philipp

@Smanar
Copy link
Collaborator

Smanar commented Jun 10, 2022

Have updated the issue here #5633
And yes, the DDF is not yet present on deconz (you have it on the last post on the other issue)

To add it on HA https://forum.phoscon.de/t/how-to-add-edit-a-ddf-on-home-assistant-using-text-editor/1839

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests