dresden-elektronik / deconz-rest-plugin

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

Tuya Smart Life ZigBee Garage Door Opener Controller #5899

Closed MiAutomations closed 1 year ago

MiAutomations commented 2 years ago

The device is now founded as a Smart plug but I don't see the status of the Sensor, can you please add this function also?

https://s.click.aliexpress.com/e/_A7We5d

Screenshots

Required screenshots:

image

image

Thank you

sebastian-tennant commented 2 years ago

+1 on this request

Zigbee2MQTT already supports it: https://www.zigbee2mqtt.io/devices/PJ-ZGD01.html

github-actions[bot] commented 2 years 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 2 years 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.

serrnovik commented 1 year ago

Have the same device. Same behaviour, button works, state is not working. Woundering if there were any progress on this one?

pdcmoreira commented 1 year ago

Hey, what do you mean about state not working? What happens when you trigger it and the sensor/magnet closes? Does it change state immediately to "on" or "off"? Or it doesn't change state at all? It would make sense to me that it would change state only when the gate closes, not immediately.

pdcmoreira commented 1 year ago

So I bought two of these, which arrived today. I now see what you mean.

It is reported as a switch or light, but its state has nothing to do with the open/close sensor. That sensor state is not being displayed.

Additionally, the switch state doesn't represent the dry contact signal state and to send a signal (close the dry contact for 1s) it is needed to switch it on then off and only then the signal will be sent.

So, for now, to make it work in HA to send a signal, I created a script that turns the switch on, waits 500ms then turns it off and it works fine.

Still don't know how to get the state of the open/close sensor though.

This issue apparently has a DDF to load a similar device, but I'm still trying to understand how the whole thing works.

[Update] I fiddled around a little bit between the DDF editor and editing the json file directly (saving/loading/reloading in the editor was a bit weird) and got it to work!

I got these from the debugger:

Sensor:

dpid: 0x03, type: 0x01, length: 1, val: 0
(closed)

dpid: 0x03, type: 0x01, length: 1, val: 1
(open)

Switch

dpid: 0x01, type: 0x01, length: 1, val: 1
(on)

dpid: 0x01, type: 0x01, length: 1, val: 0
(off)

The resulting DDF is:

{
  "schema": "devcap1.schema.json",
  "manufacturername": "_TZE200_nklqjk62",
  "modelid": "TS0601",
  "product": "TS0601",
  "sleeper": false,
  "status": "Gold",
  "path": "/devices/vendor/_TZE200_nklqjk62.json",
  "subdevices": [
    {
      "type": "$TYPE_OPEN_CLOSE_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0xef00"
      ],
      "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/lastupdated"
        },
        {
          "name": "state/open",
          "refresh.interval": 7200,
          "parse": {
            "dpid": 3,
            "eval": "Item.val = Attr.val;",
            "fn": "tuya"
          }
        }
      ]
    },
    {
      "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"
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "state/on",
          "refresh.interval": 300,
          "read": {
            "fn": "tuya"
          },
          "write": {
            "dpid": 1,
            "dt": "0x10",
            "eval": "Item.val == 1 ? 1 : 0;",
            "fn": "tuya"
          },
          "parse": {
            "dpid": 1,
            "eval": "Item.val = Attr.val;",
            "fn": "tuya"
          }
        },
        {
          "name": "state/reachable"
        }
      ]
    }
  ]
}

This is how it shows up on HA: image ("DRY-1" is the name I gave to the device and switch entity.)

Now, is it possible to improve the signal trigger so that the script isn't needed? Does the open/close sensor look OK? Or can it be improved?

Mimiix commented 1 year ago

Re-opened on request. @BabaIsYou or @Smanar you got time to check in :)?

Mimiix commented 1 year ago

@pdcmoreira or @MiAutomations I do require to have all related screenshots attached.

pdcmoreira commented 1 year ago

Thanks @Mimiix

Screenshots:

image image
Smanar commented 1 year ago

I think @pdcmoreira have made the full DDF ? Or something is still missing ?

pdcmoreira commented 1 year ago

@Smanar I left a couple questions in my previous comment, I don't know if it's possible to deal with that through a DDF:

Now, is it possible to improve the signal trigger so that the script isn't needed? Does the open/close sensor look OK? Or can it be improved?

BabaIsYou commented 1 year ago

Does this link he same issue that needs to use a script : https://github.com/Koenkk/zigbee-herdsman-converters/pull/3897 ?

BTW, nothing very special to improve your DDF, may be some "cosmetics" :

{
    "schema": "devcap1.schema.json",
    "manufacturername": "_TZE200_nklqjk62",
    "modelid": "TS0601",
    "product": "'PJ-ZGD01",
    "vendor": "Matsee",
    "sleeper": false,
    "status": "Gold",
    "subdevices": [{
            "type": "$TYPE_OPEN_CLOSE_SENSOR",
            "restapi": "/sensors",
            "uuid": [
                "$address.ext",
                "0x01",
                "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",
                        "ep": 1,
                        "cl": "0x0000",
                        "at": "0x0001",
                        "script": "tuya_swversion.js"
                    },
                    "read": {
                        "fn": "zcl",
                        "ep": 1,
                        "cl": "0x0000",
                        "at": "0x0001"
                    }
                },
                {
                    "name": "attr/type"
                },
                {
                    "name": "attr/uniqueid"
                },
                {
                    "name": "config/on"
                },
                {
                    "name": "config/reachable"
                },
                {
                    "name": "state/lastupdated"
                },
                {
                    "name": "state/open",
                    "read": {
                        "fn": "none"
                    },
                    "parse": {
                        "dpid": 3,
                        "eval": "Item.val = Attr.val;",
                        "fn": "tuya"
                    }
                }
            ]
        },
        {
            "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",
                        "ep": 1,
                        "cl": "0x0000",
                        "at": "0x0001",
                        "script": "tuya_swversion.js"
                    },
                    "read": {
                        "fn": "zcl",
                        "ep": 1,
                        "cl": "0x0000",
                        "at": "0x0001"
                    }
                },
                {
                    "name": "attr/type"
                },
                {
                    "name": "attr/uniqueid"
                },
                {
                    "name": "state/on",
                    "read": {
                        "fn": "tuya"
                    },
                    "write": {
                        "dpid": 1,
                        "dt": "0x10",
                        "eval": "Item.val == 1 ? 1 : 0;",
                        "fn": "tuya"
                    },
                    "parse": {
                        "dpid": 1,
                        "eval": "Item.val = Attr.val;",
                        "fn": "tuya"
                    }
                },
                {
                    "name": "state/reachable"
                }
            ]
        }
    ]
}
Smanar commented 1 year ago

Yes for me it's fine too, you can send "on" or "off" request, so no problem with trigger.

github-actions[bot] commented 1 year 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 1 year 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.

pdcmoreira commented 10 months ago

I bought another one which came with the _TZE204_nklqjk62 manufacturer code and I want to let you guys know that this exact same DDF still works on it. I basically just opened the _TZE200_nklqjk62 file, changed the manufacturer name and then File → Save as with the _TZE204_nklqjk62 name. Then hot reload (and actually rebooted all docker instances). Behavior is also the same in HA, so I also duplicated the script.

lepeno82 commented 7 months ago

Hello I would like to buy one of this equipment, but can you confirm , with the latest DDF, I can command the switch, and read the state of the sensor? I would like to use it in jeedom with deconz plugin Best regards

pdcmoreira commented 7 months ago

Hello I would like to buy one of this equipment, but can you confirm , with the latest DDF, I can command the switch, and read the state of the sensor? I would like to use it in jeedom with deconz plugin Best regards

Yes, it works, my explanation above is still true today.

lepeno82 commented 7 months ago

Ok thanks