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

Device Request: TY0201 _TZ3000_bjawzodf #7684

Closed
1 task done
4MeInfo opened this issue Mar 28, 2024 · 25 comments
Closed
1 task done

Device Request: TY0201 _TZ3000_bjawzodf #7684

4MeInfo opened this issue Mar 28, 2024 · 25 comments

Comments

@4MeInfo
Copy link

4MeInfo commented Mar 28, 2024

Is there already an existing issue for this?

  • I have searched the existing issues and there is none for my device

Product name

TY0201

Manufacturer

Tuya

Model identifier

_TZ3000_bjawzodf

Device type to add

Sensor

Node info

Bildschirmfoto 2024-03-28 um 21 18 21

Endpoints and clusters

Bildschirmfoto 2024-03-28 um 21 26 07 Bildschirmfoto 2024-03-28 um 21 
<img width= 25 46" src="https://github.com

Bildschirmfoto 2024-03-28 um 21 25 13

bcd-5074-434f-9563-95d7daac512c"> /dresden-elektronik/deconz-rest-plugin/assets/53448222/af7bd224-799c-47a0-b114-7c80c22060cd">

Basic

Bildschirmfoto 2024-03-28 um 21 19 10 Bildschirmfoto 2024-03-28 um 21 26 31

Further relevant clusters

Power Configuration

On/Off

Level Control

Color Control

Thermostat

Simple Metering

Electrical Measurement

Any other cluster of relevance/interest

@4MeInfo 4MeInfo closed this as completed Mar 29, 2024
@4MeInfo
Copy link
Author

4MeInfo commented Mar 29, 2024

_TZ3000_bjawzodf.json
Bildschirmfoto 2024-03-29 um 08 32 55

I modify some existing file and it works.

@4MeInfo 4MeInfo reopened this Mar 29, 2024
@4MeInfo 4MeInfo closed this as completed Mar 29, 2024
@Smanar
Copy link
Collaborator

Smanar commented Mar 29, 2024

Ha yes there is already a DDF, but not for the same model

  "manufacturername": "_TZE200_bjawzodf",
  "modelid": "TS0601",

https://github.com/dresden-elektronik/deconz-rest-plugin/blob/master/devices/tuya/_TZE200_bjawzodf_humidity_temp.json

If it's the one you have modified, can you submit a PR ?

@Smanar
Copy link
Collaborator

Smanar commented Mar 29, 2024

Ha yes, one DDF work with tuya cluster, the second one with classics clusters.
And your device have both ....

Lol, so impossible to guess without the device. Thx for tests.

Do you want to make a PR to add it officially ?

@TheNON75
Copy link

TheNON75 commented Oct 11, 2024

hi @Smanar ,

what is the progress on this?
Just bought one myself too. Can I support you somehow?

@Smanar
Copy link
Collaborator

Smanar commented Oct 11, 2024

Nothing was done as I dn't have answer.

You can try this DDF to see if it work

{
  "schema": "devcap1.schema.json",
  "uuid": "d20fd95e-3343-4898-adc3-59111f4812af",
  "manufacturername": ["_TZ3000_yd2e749y", "_TZ3000_fllyghyj", "_TZ3000_fie1dpkm", "_TZ3000_lbtpiody", "_TZ3000_5nrcorgu", "_TZ3000_ena8vgqb", "_TZ3000_xr3htd96", "_TZ3000_0s1izerx", "_TZ3000_saiqcn0y", "_TZ3000_utwgoauk", "_TZ3000_bjawzodf", "_TZ3000_bjawzodf"],
  "modelid": ["TS0201", "TS0201", "TS0201", "TS0201", "TS0201", "TS0201", "TS0201", "TS0201", "TS0201", "TS0201", "TS0201", "TY0201"],
  "vendor": "Tuya",
  "product": "Temperature and humidity sensor (TS0201)",
  "sleeper": true,
  "status": "Gold",
  "subdevices": [
    {
      "type": "$TYPE_TEMPERATURE_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x0402"
      ],
      "items": [
        {
          "name": "attr/id"
        },
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion",                   
          "parse": {"fn": "zcl:attr", "ep": 1, "cl": "0x0000", "at": "0x0001", "script": "tuya_swversion.js"},
          "read": {"fn": "zcl:attr", "ep": 1, "cl": "0x0000", "at": "0x0001"}
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "config/battery",
          "awake": true,
          "parse": {
            "at": "0x0021",
            "cl": "0x0001",
            "ep": 1,
            "eval": "Item.val = Attr.val / 2;",
            "fn": "zcl:attr"
          }
        },
        {
          "name": "config/offset"
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/temperature",
          "awake": true
        }
      ]
    },
    {
      "type": "$TYPE_HUMIDITY_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x0405"
      ],
      "items": [
        {
          "name": "attr/id"
        },
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion",                   
          "parse": {"fn": "zcl:attr", "ep": 1, "cl": "0x0000", "at": "0x0001", "script": "tuya_swversion.js"},
          "read": {"fn": "zcl:attr", "ep": 1, "cl": "0x0000", "at": "0x0001"}
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "config/battery",
          "awake": true,
          "parse": {
            "at": "0x0021",
            "cl": "0x0001",
            "ep": 1,
            "eval": "Item.val = Attr.val / 2;",
            "fn": "zcl:attr"
          }
        },
        {
          "name": "config/offset"
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/humidity",
          "awake": true
        },
        {
          "name": "state/lastupdated"
        }
      ]
    }
  ],
  "bindings": [
    {
      "bind": "unicast",
      "src.ep": 1,
      "cl": "0x0001",
      "report": [
        {
          "at": "0x0021",
          "dt": "0x20",
          "min": 3600,
          "max": 84600,
          "change": "0x00000002"
        }
      ]
    },
    {
      "bind": "unicast",
      "src.ep": 1,
      "cl": "0x0402",
      "report": [
        {
          "at": "0x0000",
          "dt": "0x29",
          "min": 60,
          "max": 300,
          "change": "0x00000064"
        }
      ]
    },
    {
      "bind": "unicast",
      "src.ep": 1,
      "cl": "0x0405",
      "report": [
        {
          "at": "0x0000",
          "dt": "0x21",
          "min": 60,
          "max": 300,
          "change": "0x00000064"
        }
      ]
    }
  ]
}

@TheNON75
Copy link

Ok, I will try it later tonight

@TheNON75
Copy link

TheNON75 commented Oct 11, 2024

it is kind of weird stuff.
phoscon state: not reachable, measurements from yesterday are shown
deconz gui: temp and rh clusters show recent data
REST API: same as phoscon

Let me know what information you need, I will try to provide them, however I will be busy during the weekend by running around

edit: hot reload was not enough, restarted deconz, now it looks better. Phoscon shows recent data, REST API too. Battery percentage might be not okay, but let's see

image

@Smanar
Copy link
Collaborator

Smanar commented Oct 12, 2024

Yep, the battery status can need some time.
Tell me if it works to make the PR, or you can make it too if you want, just need to add the model to this DDF https://github.com/dresden-elektronik/deconz-rest-plugin/blob/master/devices/tuya/_TZ3000_TS0201_temp_hum_sensor.json

@TheNON75
Copy link

TheNON75 commented Oct 12, 2024

Well, battery and version are still not okay, but apart from this the device works.

Do you want to dig into it, or see it later if it can be fixed at all? If the latter, then please proceed with a pr.

image

@Smanar
Copy link
Collaborator

Smanar commented Oct 13, 2024

Can try to fix the batrtery first, perhaps this device need something not standard.
Can you check the cluster 0x0001, to see if the attributes 0x0021 is used ?

On the DDF, can try replace

        {
          "name": "config/battery",
          "awake": true,
          "parse": {
            "at": "0x0021",
            "cl": "0x0001",
            "ep": 1,
            "eval": "Item.val = Attr.val / 2;",
            "fn": "zcl:attr"
          }
        },

by

        {
            "name":"config/battery",
            "refresh.interval": 86400,
            "read":{
                "at":"0x0021",
                "cl":"0x0001",
                "ep":1,
                "fn":"zcl:attr"
            },
            "parse":{
                "at":"0x0021",
                "cl":"0x0001",
                "ep":1,
                "eval":"Item.val = Attr.val/2"
            },
            "default":0
        },

@TheNON75
Copy link

The adjusted part is in place, waiting for updated data.

@TheNON75
Copy link

@Smanar after 24H the battery is still not updated. Fyi in the gui it show simply 76
image

image

@Smanar
Copy link
Collaborator

Smanar commented Oct 15, 2024

76 ?
Your device have a dead battery, or this device don't need the / 2.
You haven't another battery to make try ?

Another thing, when you read a value in the GUI, it update the value in the API too, so you need to have a 76/2 value for battery now.

Else can you enable log in deconz with only flag "DDF", will be not too much talkative and try to read this value again ?
(You have 1 "config/battery" by entry)

@TheNON75
Copy link

TheNON75 commented Oct 17, 2024

Battery is swapped with an Ikea vallhorn where the battery was reported to be 200.
The batteries from the tuya reported in Ikea as 166
The batteries from Ikea reported in Tuya as 192 (instead of 200, see above), but .... (!!!!!)
Apparently this value was reported after insertion. By the next reporting it became c0 (!!!), which is in fact 192....

image

edit: slowly I am going slightly mad...
1, restarted deconz
2, after startup, battery level: u8, 198
3, next refresh battery level: enum8 c4
4, log ddf grepped to mac address: 12:29:02:782 a4:c1:38:2c:8e:d8:a6:67-01-0402/config/battery expression: Item.val = Attr.val/2 --> 98 (subsequent updates seem to be similarly ok)
5, phoscon battery level: 0%
6, REST API reports temp sensor's battery as 98% humidity's a 0
7, further reports are also ok, I think phoscon cannot handle properly more than 1 battery entries in the ddf for the same devices

@Smanar
Copy link
Collaborator

Smanar commented Oct 17, 2024

So fisrt bug, it seem sometime deconz show hexa value instead of decimal, what is your deconz version ?

So the battery level is good on the API, but not on Phoscon ?
This device create 2 entries, a ZHATemperature and a ZHAHumidity, both have good battery level ? Perhaps Phoscon use the bad one ?

@TheNON75
Copy link

TheNON75 commented Oct 17, 2024

I went back to 2.22 recently as aqara sensors were reporting very sporadically, sometimes for 4-6hours no updates at all.

Correct, good in API but not in phoscon.
No, humidity battery level is 0% (parsing is missing) and I agree, phoscon picks the second one (0%)
Imo battery shall be kept only for one sensor or perhaps add zhabattery(?)...in the other hand, the same battery level can be reported to both sensors if this is the standard

Ps.: I can change to any version you prefer to check. I am on docker

@TheNON75
Copy link

On 2.28.1 the battery is shown in phoscon properly (however this version is less good for aquaria sensors)
The device is currently not reachable but it is normal as decent was restarted recently due to switching to latest stable.

Only the version is not defined yet in ddf and so it is missing
image

@Smanar
Copy link
Collaborator

Smanar commented Oct 18, 2024

It's definied on the DDF

        {
          "name": "attr/swversion",                   
          "parse": {"fn": "zcl:attr", "ep": 1, "cl": "0x0000", "at": "0x0001", "script": "tuya_swversion.js"},
          "read": {"fn": "zcl:attr", "ep": 1, "cl": "0x0000", "at": "0x0001"}
        },

You have put the DDF on the "tuya" folder ? there is a relative path.

No, humidity battery level is 0% (parsing is missing) and I agree, phoscon picks the second one (0%)
Imo battery shall be kept only for one sensor or perhaps add zhabattery(?)...in the other hand, the same battery level can be reported to both sensors if this is the standard

So it work for an entry and not the other ? Here I don't understand, same code mean same result.
I m checking the DDF again, and I m seing the same code

        {
          "name": "config/battery",
          "awake": true,
          "parse": {
            "at": "0x0021",
            "cl": "0x0001",
            "ep": 1,
            "eval": "Item.val = Attr.val / 2;",
            "fn": "zcl:attr"
          }
        },

Or you are using the modified code only on one of them ?

        {
            "name":"config/battery",
            "refresh.interval": 86400,
            "read":{
                "at":"0x0021",
                "cl":"0x0001",
                "ep":1,
                "fn":"zcl:attr"
            },
            "parse":{
                "at":"0x0021",
                "cl":"0x0001",
                "ep":1,
                "eval":"Item.val = Attr.val/2"
            },
            "default":0
        },

@TheNON75
Copy link

You're right, adjusted only one of the batteries (however in the latest stable it is picked and shown properly)

The file is in the /opt/deCONZ/devices (I am on docker) folder and this explains why the js did not run. Do you want me to copy it over or we accept the theory "it should work"?

@Smanar
Copy link
Collaborator

Smanar commented Oct 24, 2024

or we accept the theory "it should work"

Lol, yes I think we can, it's the same code on ALL tuya DDF.

So do you want to submit a PR or want I make it ?

@TheNON75
Copy link

Let's accept it should work :) If you don't mind, I would leave the pr for you to avoid that I screw up something accidentally

@Smanar
Copy link
Collaborator

Smanar commented Oct 25, 2024

Done > #7993

@TheNON75
Copy link

Thank you!

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

No branches or pull requests

3 participants