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

Battery not reported on DDF for Tuya temperature and humidity sensor (_TZ3210_ncw88jfq) #7908 #7918

Closed
2 tasks done
RneeJ opened this issue Sep 8, 2024 · 15 comments · Fixed by #7951
Closed
2 tasks done

Comments

@RneeJ
Copy link

RneeJ commented Sep 8, 2024

Does the issue really belong here?

  • I definitively want to report a bug within deCONZ or its REST-API

Is there already an existing issue for this?

  • I have searched the existing issues and there is none for the bug at hand

Describe the bug

@Smanar see #7884

I installed the new DDF from the repo.

In the .json i deliverd for this device the battery was reported correctly, now it is missing.

Steps to reproduce the behavior

NA

Expected behavior

report state of battery as before

Screenshots

afbeelding

For before (in original .json) see #7884

Environment

na

deCONZ Logs

na

Additional context

na

@Smanar
Copy link
Collaborator

Smanar commented Sep 8, 2024

Hello, but on your capture here #7884 (comment)
The battery is here too ? We can see config/battery = 100%

So the problem is from Phoscon ?

@RneeJ
Copy link
Author

RneeJ commented Sep 8, 2024

Hoi Smanar.

Before the battery was reported correctly (at date 30.08.2024):
2024-08-30 17-36-12
then i send in the my working .json.

You made some changes to the .json, it was pulled in and a new DDF was created.

I downloaded the new DDF to my " production" machine and now the battery status is gone.

(But a version is shown correctly)

@Mimiix
Copy link
Collaborator

Mimiix commented Sep 8, 2024

Is it still in the api?

@RneeJ
Copy link
Author

RneeJ commented Sep 8, 2024

Hi all,

I put this .json in my $HOME/.local/share/deCONZ/devices/ :
_TZ3210_ncw88jfq_temp-hum-sensor-RNEEJ.json

Now i have the battery status back again.

(Also in Domoticz)

@Smanar
Copy link
Collaborator

Smanar commented Sep 8, 2024

But we can see the battery level on the API
afbeelding

So if it's not visible in phoscon, the problem is from it.

But it was missing in domoticz too ? Domoticz use direclty the api, so if you can see it using Phoscon/help/API Information/sensor and not in domoticz it 's more problematic. But take care it can take some hours for the battery is updated.
Or you can restart the Domoticz plugin to resynchronise Domoticz and deconz (Hardware panel / deconz / update)

@RneeJ
Copy link
Author

RneeJ commented Sep 8, 2024

@Smanar , i think there is some confusion here, i apologize.
I have a seperate full size "test" and a headless Pi "production" machine.
I used my " test" machine for setting up Zigbee/Phoscon/deCONZ.
I don't want to mess up Domoticz ;-)

But the problem is the same.
This new DDF does not show battery for this device :
afbeelding

This was Domoticz with the installed DDF :
domo_voor

This is now Domoticz with the mentioned _TZ3210_ncw88jfq_temp-hum-sensor-RNEEJ.json installed :
afbeelding

So the DDF Bundle is wrong , because it does not show the battery.

@Smanar
Copy link
Collaborator

Smanar commented Sep 16, 2024

Ha ok.
But I have checked the DDF https://github.com/dresden-elektronik/deconz-rest-plugin/blob/master/devices/tuya/_TZ3210_ncw88jfq_temp-hum-sensor.json
It's the good one "uuid": "f490468c-83c1-4367-9168-4043f59e23cc",

And I m seing the line for battery (even lighter than the working version)

        {
          "name": "config/battery"
        },

So IDK if it's missing or not updated (a null value for exemple)
Can you take a look on your "not working" version how it look direclty in the API ? (the json for the ZHATemperature for exemple) from Domoticz (on the Front end) or Phoscon (Help/API Information/sensor).

The code is lighter, there is only 1 line, but it need to work too.

@RneeJ
Copy link
Author

RneeJ commented Sep 29, 2024

@Smanar , yours isn't working.

I did a complete new install on a complete new machine (Rasp 5). (Domoticz ; it took ages...)
So a new fresh download of deCONZ etc, not fiddled anything by me.
it included "uuid": "f490468c-83c1-4367-9168-4043f59e23cc"

Battery was NOT reported, not in the deCONZ app nor in Domoticz.

I installed my json and battery was reported correct :

"schema": "devcap1.schema.json",
"manufacturername": "_TZ3210_ncw88jfq",
"modelid": "TS0201",
"vendor": "Tuya",
"product": "Temperature and humidity sensor",
"sleeper": true,
"status": "Gold",
"path": "/devices/_TZ3210_ncw88jfq_temp-hum-sensor.json",
"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"
},
{
"name": "attr/type"
},
{
"name": "attr/uniqueid"
},
{
"name": "config/battery",
"refresh.interval": 7265,
"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
},
{
"name": "config/offset",
"default": 0
},
{
"name": "config/on"
},
{
"name": "config/reachable"
},
{
"name": "config/tuya_unlock",
"public": false,
"refresh.interval": 86400,
"default": false
},
{
"name": "state/lastupdated"
},
{
"name": "state/temperature",
"awake": true,
"default": 0
}
]
},
{
"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"
},
{
"name": "attr/type"
},
{
"name": "attr/uniqueid"
},
{
"name": "config/battery",
"refresh.interval": 7265,
"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
},
{
"name": "config/offset",
"default": 0
},
{
"name": "config/on"
},
{
"name": "config/reachable"
},
{
"name": "state/humidity",
"awake": true,
"parse": {
"at": "0x0000",
"cl": "0x0405",
"ep": 0,
"eval": "Item.val = Attr.val * 10 + R.item('config/offset').val",
"fn": "zcl:attr"
},
"default": 0
},
{
"name": "state/lastupdated"
}
]
}
],
"bindings": [
{
"bind": "unicast",
"src.ep": 1,
"cl": "0x0001"
},
{
"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"
}
]
}
]
}

@RneeJ
Copy link
Author

RneeJ commented Sep 29, 2024

And my presence sensor
ts0202_presence_sensor.json with "uuid":"13e89e44-1f42-4e5d-8d29-995d394451ac", has exactly the same problem.

It does not show battery status.

This (by me) changed json does :
{
"schema":"devcap1.schema.json",
"uuid":"13e89e44-1f42-4e5d-8d29-995d394451ac",
"manufacturername": [
"_TYZB01_tv3wxhcz",
"_TYZB01_hqbdru35",
"_TZ3000_tiwq83wk",
"_TZ3000_ykwcwxmz",
"_TZ3000_hgu1dlak",
"_TZ3000_hktqahrq",
"_TZ3000_kmh5qpmb",
"_TZ3000_jmrgyl7o",
"_TZ3000_msl6wxk9",
"_TZ3000_otvn3lne",
"_TZ3000_6ygjfyll",
"_TZ3040_6ygjfyll",
"_TZ3000_mcxw5ehu",
"_TYZB01_ef5xlc9q",
"_TYZB01_vwqnz1sn",
"_TYZB01_2b8f6cio",
"_TZE200_bq5c8xfe",
"_TYZB01_dl7cejts",
"_TYZB01_qjqgmqxr",
"_TZ3000_mmtwjmaq",
"_TYZB01_zwvaj5wy",
"_TZ3000_bsvqrxru",
"_TZ3000_mg4dy6z6",
"_TZ3040_bb6xaihh",
"_TZ3000_lf56vpxj"
],
"modelid":[
"TS0202",
"TS0202",
"TS0202",
"TS0202",
"TS0202",
"TS0202",
"TS0202",
"TS0202",
"TS0202",
"TS0202",
"TS0202",
"TS0202",
"TS0202",
"TS0202",
"TS0202",
"TS0202",
"TS0202",
"TS0202",
"TS0202",
"TS0202",
"TS0202",
"TS0202",
"TS0202",
"TS0202",
"TS0202"
],
"vendor": "Tuya",
"product":"Presence sensor (TS0202)",
"sleeper":true,
"status":"Gold",
"subdevices":[
{
"type":"$TYPE_PRESENCE_SENSOR",
"restapi":"/sensors",
"uuid":[
"$address.ext",
"0x01",
"0x0500"
],
"fingerprint": {
"profile": "0x0104",
"device": "0x0402",
"endpoint": "0x01",
"in": [
"0x0000",
"0x0001",
"0x0500"
]
},
"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",
"refresh.interval": 7265,
"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
},
{
"name":"config/duration"
},
{
"name":"config/enrolled",
"public":false
},
{
"name":"config/on"
},
{
"name":"config/pending"
},
{
"name":"config/reachable"
},
{
"name":"state/lastupdated"
},
{
"name":"state/lowbattery"
},
{
"name":"state/presence",
"awake":true,
"parse":{
"fn":"ias:zonestatus",
"mask":"alarm1"
}
}
]
}
],
"bindings":[
{
"bind":"unicast",
"src.ep":1,
"cl":"0x0500"
},
{
"bind":"unicast",
"src.ep":1,
"cl":"0x0001",
"report":[
{
"at":"0x0021",
"dt":"0x20",
"min":3600,
"max":14400,
"change":"0x00000001"
}
]
}
]
}

@Smanar
Copy link
Collaborator

Smanar commented Sep 29, 2024

Ha yes, have checked the json

{
  "schema": "resourceitem1.schema.json",
  "id": "config/battery",
  "datatype": "UInt8",
  "access": "R",
  "public": true,
  "range": [
    0,
    100
  ],
  "description": "The current device battery level in 0–100 %.",
  "default": 0
}

All is managed by legacy code, so can be buggy.

BTW do you want to make a PR to correct the 2 files or want I make it ?

@RneeJ
Copy link
Author

RneeJ commented Sep 29, 2024

@Smanar thank you for your quick response.

please, you can make the PR. 👍

@Smanar
Copy link
Collaborator

Smanar commented Sep 29, 2024

I think this is fine ? #7951

Have just increase the refresh of polling at 24h, because on some report the value is smaller.

@Smanar Smanar linked a pull request Sep 29, 2024 that will close this issue
@RneeJ
Copy link
Author

RneeJ commented Sep 29, 2024

Oke , i will test them next week. Thank you!

@RneeJ
Copy link
Author

RneeJ commented Oct 5, 2024

Can confirm this works as expected !

In Phoscon App :
afbeelding

also in Domoticz :
afbeelding

Just one thing is not fully oke :
In Phoscon App

  • Temperature is only in full digids : 21 deg
  • Humidity is in decimals : 54,1 %

In Domoticz however :

  • Temperature is only in decimal : 21,3 deg
  • Humidity is in full digids : 54 %

I mean the data is available so why are they not used in the applications ?

The ddf is oke, i can live with this , so if you want

@Smanar
Copy link
Collaborator

Smanar commented Oct 5, 2024

I don't have impact on Phoscon, but on domoticz, the plugin use only the int value, it's perhaps because Domoticz use only int value for humidity (My other domoticz plugin do same), or a choice, temperature move a lot 12 °C is not same than 12.5 °C for regulation, for humidity 53 % or 53.9 %, I don't think it's a big difference.

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

Successfully merging a pull request may close this issue.

3 participants