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

PJ-1203A - Tuya Zigbee power meter with 2 clamps #7324

Closed
1 task done
aldoushx opened this issue Oct 29, 2023 · 13 comments
Closed
1 task done

PJ-1203A - Tuya Zigbee power meter with 2 clamps #7324

aldoushx opened this issue Oct 29, 2023 · 13 comments

Comments

@aldoushx
Copy link

aldoushx commented Oct 29, 2023

Is there already an existing issue for this?

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

Product name

power meter

Electricity Energy Monitor

Manufacturer

_TZE204_81yrt3lo

Model identifier

TS0601

Device type to add

Sensor

Node info

cluster list

node info 1
node info 2

Endpoints and clusters

Scenes
Groups

Basic

cluster info
cluster info2

Further relevant clusters

Power Configuration

On/Off

Level Control

Color Control

Thermostat

Simple Metering

Electrical Measurement

Any other cluster of relevance/interest

@Smanar
Copy link
Collaborator

Smanar commented Oct 29, 2023

Hello, you miss the node picture with the cluster list.
Can start with this DDF

{
  "schema": "devcap1.schema.json",
  "manufacturername": ["_TZE204_81yrt3lo", "_TZE200_rks0sgb7"],
  "modelid": ["TS0601", "TS0601"],
  "product": "PJ-1203A - Zigbee power meter with 2 clamps",
  "sleeper": true,
  "status": "Gold",
  "subdevices": [
    {
      "type": "$TYPE_CONSUMPTION_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x0702"
      ],
      "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/offset",
          "default": 0
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/consumption",
          "parse": {"fn": "tuya", "dpid": 106, "eval": "Item.val = Attr.val / 100;" },
          "read": {"fn": "none"},
          "default": 0
        },
        {
          "name": "state/lastupdated"
        }
      ]
    },
    {
      "type": "$TYPE_POWER_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x0b04"
      ],
      "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": "none"}
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "config/offset",
          "default": 0
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/current",
          "parse": {"fn": "tuya", "dpid": 113, "eval": "Item.val = Attr.val / 1000;" },
          "read": {"fn": "none"},
          "default": 0
        },
        {
          "name": "state/voltage",
          "parse": {"fn": "tuya", "dpid":112, "eval": "Item.val = Attr.val / 10;" },
          "read": {"fn": "none"},
          "default": 0
        },
        {
          "name": "state/power",
          "parse": {"fn": "tuya", "dpid": 101, "eval": "Item.val = Attr.val / 10;" },
          "read": {"fn": "none"},
          "default": 0
        }
      ]
    },
    {
      "type": "$TYPE_CONSUMPTION_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x02",
        "0x0702"
      ],
      "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/offset",
          "default": 0
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/consumption",
          "parse": {"fn": "tuya", "dpid": 108, "eval": "Item.val = Attr.val / 100;" },
          "read": {"fn": "none"},
          "default": 0
        },
        {
          "name": "state/lastupdated"
        }
      ]
    },
    {
      "type": "$TYPE_POWER_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x02",
        "0x0b04"
      ],
      "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": "none"}
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "config/offset",
          "default": 0
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/current",
          "parse": {"fn": "tuya", "dpid": 114, "eval": "Item.val = Attr.val / 1000;" },
          "read": {"fn": "none"},
          "default": 0
        },
        {
          "name": "state/voltage",
          "parse": {"fn": "tuya", "dpid":112, "eval": "Item.val = Attr.val / 10;" },
          "read": {"fn": "none"},
          "default": 0
        },
        {
          "name": "state/power",
          "parse": {"fn": "tuya", "dpid": 105, "eval": "Item.val = Attr.val / 10;" },
          "read": {"fn": "none"},
          "default": 0
        }
      ]
    }
  ]
}

@aldoushx
Copy link
Author

Thank you for your answer, I updated the 1st message with the node picture.

For an unknown reason, I cannot edit/save the ddf in the editor with the ddf provided above : I open the json in the ddf editor window of the device, the data is well displayed in the ddf editor, but when i save it, close the window then go back in the editor, the ddf is back to the initial data...
I tried after a hot reload, and after deleting/reinclude the node, but i get the same result every time, the ddf is not saved.

Any idea what it could be ? That is the first time I see this behaviour with a ddf...

@Smanar
Copy link
Collaborator

Smanar commented Oct 29, 2023

You can't use the editor.
What is your OS ? You need to create a text file called what_you_want.json in a "devices" folder, but it will depend of your OS.

@aldoushx
Copy link
Author

aldoushx commented Oct 29, 2023

I know the procedure, but the ddf.json file does not stay loaded in the editor after I opened it and saved (unlike the other ddf files I used for other devices).
My setup : graphic deconz interface on an ubuntu VM, no problem with other ddf and devices.

@Smanar
Copy link
Collaborator

Smanar commented Oct 29, 2023

Don't use the deconz editor, I don't think it's able to manage tuya device, better to use a text editor.
Close deconz, put the file in one of the 2 "devices" folder, and reload deconz.

@aldoushx
Copy link
Author

I don't know why but saving and loading the ddf file in another directory worked...
Anyway, the ddf provided above is working well for the power measure by the 2 clamps, but not for the energy consumption.

@Smanar
Copy link
Collaborator

Smanar commented Oct 30, 2023

You have zero values or bad one ? Perhaps the /100 is too much.
You haven't the GUI to check logs ? with deconz/help/debug veiw with flag "DDF"

@aldoushx
Copy link
Author

The consumption values were ridiculously low in Home Assistant, so I assumed they were not returned.
I then changed the /100 by *10 in the ddf and now the values are the right ones (in Wh in deconz debug).
I can also see the current and voltage values in the deconz debug window, but these values are not returned as sensors in HA.

@Smanar
Copy link
Collaborator

Smanar commented Oct 30, 2023

Can you take a look direclty in the api ?
Using phoscon/help/API Information/sensors.

@aldoushx
Copy link
Author

aldoushx commented Oct 31, 2023

It the API, the voltage and current values are displayed (curently at 0 for the current, as there is no power consumption)

{
    "config": {
        "offset": 0,
        "on": true,
        "reachable": true
    },
    "etag": "11d7731910045ed5a11b959d8704db9b",
    "lastannounced": null,
    "lastseen": "2023-10-31T21:06Z",
    "manufacturername": "_TZE204_81yrt3lo",
    "modelid": "TS0601",
    "name": "Power 113",
    "state": {
        "current": 0,
        "lastupdated": "2023-10-31T21:06:59.519",
        "power": 0,
        "voltage": 236
    },
    "type": "ZHAPower",
    "uniqueid": "a4:c1:38:1e:ff:ed:10:fd-01-0b04"
}

@Smanar
Copy link
Collaborator

Smanar commented Nov 1, 2023

Ok, so you know the method to "refresh" a device in HA ? for exemple delete it in HA and not deconz, then relaod it ?

If I m right HA create the entry the first time it see the device, so if the state/voltage was missing at this moment, it will stay missing, even it will apear later.

Because all seem fine for me, no reason to don't have the voltage.

Copy link

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 Nov 23, 2023
Copy link

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.

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

2 participants