dresden-elektronik / deconz-rest-plugin

deCONZ REST-API plugin to control ZigBee devices
BSD 3-Clause "New" or "Revised" License
1.9k stars 503 forks source link

Power monitor support requested for _TZ3000_kqvb5akv #7524

Closed Obelixje closed 9 months ago

Obelixje commented 10 months ago

Is there already an existing issue for this?

Product name

Mini Zigbee Switch

Manufacturer

_TZ3000_kqvb5akv

Model identifier

TS0001

Device type to add

Switch

Node info

image

Endpoints and clusters

image

Basic

image

Further relevant clusters

Power Configuration

On/Off

image

Level Control

Color Control

Thermostat

Simple Metering

image

Electrical Measurement

image

Any other cluster of relevance/interest

Obelixje commented 10 months ago

Endpoint:

image

Mimiix commented 10 months ago

@Smanar Can you take a look :)?

Smanar commented 10 months ago

It's a 1 gang switch wired ?

Can try this DDF

{
  "schema": "devcap1.schema.json",
  "manufacturername": ["_TZ3000_mkhkxx1p", "_TZ3000_tgddllx4", "_TZ3000_g92baclx", "_TZ3000_mkhkxx1p", "_TZ3000_tgddllx4", "_TZ3000_kqvb5akv"],
  "modelid": [ "TS0001", "TS0001", "TS0001", "TS0001", "TS0001", "TS0001"],
  "product": "1 gang wired switch",
  "sleeper": false,
  "status": "Gold",
  "subdevices": [
    {
      "type": "$TYPE_ON_OFF_LIGHT",
      "restapi": "/lights",
      "uuid": [
        "$address.ext",
        "0x01"
      ],
      "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/tuya_swversion.js"},
          "read": {"fn": "zcl:attr", "ep": 1, "cl": "0x0000", "at": "0x0001"}
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "state/alert",
          "default": "none"
        },
        {
          "name": "state/on",
          "refresh.interval": 360
        },
        {
          "name": "state/reachable"
        }
      ]
    },
    {
      "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/tuya_swversion.js"},
          "read": {"fn": "zcl:attr", "ep": 1, "cl": "0x0000", "at": "0x0001"}
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/consumption",
          "refresh.interval": 360,
          "parse": {
            "at": "0x0000",
            "cl": "0x0702",
            "ep": 0,
            "eval": "Item.val = 10*Attr.val"
          },
          "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/tuya_swversion.js"},
          "read": {"fn": "zcl:attr", "ep": 1, "cl": "0x0000", "at": "0x0001"}
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/current",
          "refresh.interval": 360,
          "default": 0
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/power",
          "refresh.interval": 360,
          "default": 0
        },
        {
          "name": "state/voltage",
          "refresh.interval": 360,
          "default": 0
        }
      ]
    }
  ],
  "bindings": [
    {
      "bind": "unicast",
      "src.ep": 1,
      "cl": "0x0006",
      "report": [
        {
          "at": "0x0000",
          "dt": "0x10",
          "min": 1,
          "max": 300
        }
      ]
    },
    {
      "bind": "unicast",
      "src.ep": 1,
      "cl": "0x0702",
      "report": [
        {
          "at": "0x0000",
          "dt": "0x25",
          "min": 5,
          "max": 300,
          "change": "0x0000000A"
        }
      ]
    },
    {
      "bind": "unicast",
      "src.ep": 1,
      "cl": "0x0B04",
      "report": [
        {
          "at": "0x0505",
          "dt": "0x21",
          "min": 15,
          "max": 300,
          "change": "0x00000001"
        },
        {
          "at": "0x0508",
          "dt": "0x21",
          "min": 15,
          "max": 300,
          "change": "0x00000001"
        },
        {
          "at": "0x050B",
          "dt": "0x29",
          "min": 5,
          "max": 300,
          "change": "0x00000001"
        }
      ]
    }
  ]
}

Values power, current voltage consumption will need to be corrected (*10 or /10) but they are not visible on the capture. So just tell me the value you have and the one you need for I make adapatation.

Obelixje commented 10 months ago

Hi @Smanar ,

Thank you for your help. I am currently at my work. I have access to HA, bot I am not able to copy this ddf file to the correct folder in Deconz environment. So I think I have to test this from home tomorrow.

Smanar commented 10 months ago

Ha yes on HA Short way > need to install the DDF in /.local/share/dresden-elektronik/deCONZ/devices long way > https://forum.phoscon.de/t/how-to-add-edit-a-ddf-on-home-assistant-using-text-editor/1839

Obelixje commented 10 months ago

@Smanar Hi Smanar,

I am still not able to find the corret folder. My Deconz is installed on a HASSOS RPi, Can you help me access the correct folder?

Smanar commented 10 months ago

No sorry, I don't use docker on my side. But the previous link is just for HA without external deconz docker.

github-actions[bot] commented 9 months ago

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[bot] commented 9 months ago

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.

Onshuis commented 5 months ago

I have exactly the same device. I tried the DDF. I now see consumption, but ... the mini switch is still a light. When i press in phoscon on the light, the blue led on the mini is flasing, but the relais will not turn on. When i manually press the button on the mini switch, the relay goes on and i see the icon in phoscon change to on status. So when using the DDF i got some consumption but i am unable to control the switch from the phoscon app. Also the consumption of my soldering iron is only 25W?

Oh when i shutdown deconz.service and open deCONZ then on 0006 on/off and execute on or off, then the relais does go on and off. But still in the phoscon app, when pressing the light icon, the blue led just flashes several times.

Smanar commented 5 months ago

the mini switch is still a light

Yes, it's not normal ? It's not a plug ? If I m right the TYPE_ON_OFF_PLUGIN_UNIT give a plug picture, thee is too TYPE_ON_OFF_SWITCH but this one was never used yet, so idk the result.

Also the consumption of my soldering iron is only 25W

25W is a power, not a consumption. But the DDF can need adjustement, easy to correct, you are looking power or consumption ?

When i press in phoscon on the light, the blue led on the mini is flasing, but the relais will not turn on

Not good, I can have forget the tuya unlock sequence. Can try with adding on the $TYPE_ON_OFF_LIGHT

        {
          "name": "config/tuya_unlock"
        }

(Take care at comma) Then need to wait 24h or re-include the device (the tuya unlock sequence is done at inclusion or every 24)

Onshuis commented 5 months ago

Okay, i added in "name": "config/tuya_unlock" under $TYPE_ON_OFF_LIGHT but i have a whole ohter problem now. So trying to fix this first i will get back on it. But im now unable to login to phoscon. I just get a blank page with the P logo. So yes, im looking into tjis first and then ill come back to here. But thanks for the help so far.

Onshuis commented 5 months ago

Ah ok, i found some old issue where it logs into ...login2.html so in my address bar it says ....login.html i changed it manually to login2.html and now it works again. So im able to login again. Never had the issue, but now i know to chage it manually to login2.html i can at least login again. Different issue, so now back on "name": "config/tuya_unlock" i will put this line in and wait for 24 hours to see what will happen. See you in 24 hours again.

Onshuis commented 5 months ago

25W is a power, not a consumption. But the DDF can need adjustement, easy to correct, you are looking power or consumption ? Well normally it's both. I can see the actual power and also the consumption.

So now i have it set as an plug, just like other power measurement switches i have. On deCONZ i can see id0x0300 unit of measurement kW & kWh binairy. In the electrical measurment cluster on id 508 and id 50B i can see rms 203 and active power 16. However in the phoscon app there is no measurment of anything. There is meaurment for all the other power measurement switches i have.

I just do not know what to change in the DDF to make it all correct. I have deCONZ, phoscon and domoticz. In deconz i can see some values, in phoson there is nothing of measurement and in domoticz i see my soldering iron is taking 17watts.

What must i change in the ddf?

Im using this now for power measure to work:

{ "schema": "devcap1.schema.json", "manufacturername": ["_TZ3000_rmjr4ufz", "_TZ3000_kqvb5akv"], "modelid": "TS0001", "product": "Random tuya plug", "sleeper": false, "status": "Gold", "subdevices": [ { "type": "$TYPE_ON_OFF_PLUGIN_UNIT", "restapi": "/lights", "uuid": [ "$address.ext", "0x01" ], "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": "state/alert", "description": "The currently active alert effect.", "default": "none" }, { "name": "state/on" }, { "name": "state/reachable" } ] }, { "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" }, { "name": "attr/type" }, { "name": "attr/uniqueid" }, { "name": "config/on" }, { "name": "config/reachable" }, { "name": "state/consumption", "read": {"at": "0x0000", "cl": "0x0702", "ep": 1, "fn": "zcl:attr" }, "parse": {"at": "0x0000", "cl": "0x0702", "ep": 1, "eval": "Item.val = Attr.val * 10"}, "refresh.interval": 365 }, { "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" }, { "name": "attr/type" }, { "name": "attr/uniqueid" }, { "name": "config/on" }, { "name": "config/reachable" }, { "name": "state/current" }, { "name": "state/lastupdated" }, { "name": "state/power" }, { "name": "state/voltage" } ] } ], "bindings": [ { "bind": "unicast", "src.ep": 1, "cl": "0x0006", "report": [ { "at": "0x0000", "dt": "0x10", "min": 1, "max": 1800 } ] }, { "bind": "unicast", "src.ep": 1, "cl": "0x0702", "report": [ { "at": "0x0000", "dt": "0x25", "min": 1, "max": 300, "change": "0x0000000A" } ] }, { "bind": "unicast", "src.ep": 1, "cl": "0x0B04", "report": [ { "at": "0x0505", "dt": "0x21", "min": 1, "max": 500, "change": "0x00000003" }, { "at": "0x0508", "dt": "0x21", "min": 1, "max": 300, "change": "0x0000000F" }, { "at": "0x050B", "dt": "0x29", "min": 1, "max": 300, "change": "0x00000003" } ] } ] }

Onshuis commented 5 months ago

Ok now it is working all, with power measurement and consumption. Im sorry to post in an already closed post. I am out of here now. Glad all is working. Thanks though.

Obelixje commented 5 months ago

Hi,

Can you please share the ddf you are now using?

Smanar commented 5 months ago
          {
          "name": "state/consumption",
          "read": {"at": "0x0000", "cl": "0x0702", "ep": 1, "fn": "zcl:attr" },
          "parse": {"at": "0x0000", "cl": "0x0702", "ep": 1, "eval": "Item.val = Attr.val * 10"},
          "refresh.interval": 365
        },

To correct consumption

          {
            "name": "state/power",
            "read": {"at": "0x050b", "cl": "0x0b04", "ep": 1, "fn": "zcl:attr" },
            "parse": {"at": "0x050b", "cl": "0x0b04", "ep": 1, "eval": "Item.val = Attr.val * 10"},
            "refresh.interval": 365
        },

For power Just need to edit the "*10", save the file and restart deconz, can use the "hot reload" if doing with editor, but better to use text editor.

But take care, the actual DDF is "normaly" working, so you can have a special clone with different convertion, if yes better to create another DDF just for your device.

@Obelixje you have same issue ?

Onshuis commented 5 months ago

Im sorry, i do not know anymore. I have several devices, looking the same. Some of them worked with power measure consumption. Some of them didn't. I thought let's get the others working too, but now when i pair "_TZ3000_kqvb5akv" which is a TS0001, the "_TZ3000_xkap8wtb" which is a TS000F disappears to offline. Then when i remove the DDF of the "_TZ3000_kqvb5akv" restart deconz "_TZ3000_xkap8wtb" re-appears again, but when i try to read values it keeps saying reading.... in deCONZ, but in phoscon it is online and i can see it. But here is the DDF i try to use for the "_TZ3000_kqvb5akv"

{ "schema": "devcap1.schema.json", "manufacturername": "_TZ3000_kqvb5akv", "modelid": "TS0001", "product": "Random tuya plug", "sleeper": false, "status": "Gold", "subdevices": [ { "type": "$TYPE_ON_OFF_PLUGIN_UNIT", "restapi": "/lights", "uuid": [ "$address.ext", "0x01" ], "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": "state/alert", "description": "The currently active alert effect.", "default": "none" }, { "name": "state/on" }, { "name": "state/reachable" } ] }, { "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" }, { "name": "attr/type" }, { "name": "attr/uniqueid" }, { "name": "config/on" }, { "name": "config/reachable" }, { "name": "state/consumption", "read": {"at": "0x0000", "cl": "0x0702", "ep": 1, "fn": "zcl:attr" }, "parse": {"at": "0x0000", "cl": "0x0702", "ep": 1, "eval": "Item.val = Attr.val 10"}, "refresh.interval": 365 }, { "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" }, { "name": "attr/type" }, { "name": "attr/uniqueid" }, { "name": "config/on" }, { "name": "config/reachable" }, { "name": "state/current" }, { "name": "state/lastupdated" }, { "name": "state/power" "read": {"at": "0x050b", "cl": "0x0b04", "ep": 1, "fn": "zcl:attr" }, "parse": {"at": "0x050b", "cl": "0x0b04", "ep": 1, "eval": "Item.val = Attr.val 10"}, "refresh.interval": 365 }, { "name": "state/voltage" } ] } ], "bindings": [ { "bind": "unicast", "src.ep": 1, "cl": "0x0006", "report": [ { "at": "0x0000", "dt": "0x10", "min": 1, "max": 1800 } ] }, { "bind": "unicast", "src.ep": 1, "cl": "0x0702", "report": [ { "at": "0x0000", "dt": "0x25", "min": 1, "max": 300, "change": "0x0000000A" } ] }, { "bind": "unicast", "src.ep": 1, "cl": "0x0B04", "report": [ { "at": "0x0505", "dt": "0x21", "min": 1, "max": 500, "change": "0x00000003" }, { "at": "0x0508", "dt": "0x21", "min": 1, "max": 300, "change": "0x0000000F" }, { "at": "0x050B", "dt": "0x29", "min": 1, "max": 300, "change": "0x00000003" } ] } ] }

I don't know anymore. Some strange behavior is going on here.