Skip to content

Fix Zigbee Dual Curtain Switch _TZ3000_j1xl73iw (TS130F)#6016

Merged
manup merged 2 commits intodresden-elektronik:masterfrom
Xyaren:master
Jul 16, 2022
Merged

Fix Zigbee Dual Curtain Switch _TZ3000_j1xl73iw (TS130F)#6016
manup merged 2 commits intodresden-elektronik:masterfrom
Xyaren:master

Conversation

@Xyaren
Copy link
Contributor

@Xyaren Xyaren commented May 4, 2022

Followup to #3757

I know that PRs regarding devices are not merged if they are not in DDF format, but don't stop reading here.
The logic of reversing the percentage like it is implemented is currently not possible with the DDF specification.

If that changes I am happy to add and test a DDF for the device.

@Xyaren Xyaren changed the title Fix Zigbee Dual Curtain Switch "_TZ3000_j1xl73iw", "TS130F") Fix Zigbee Dual Curtain Switch _TZ3000_j1xl73iw (TS130F) May 4, 2022
@Smanar
Copy link
Collaborator

Smanar commented May 4, 2022

If that changes I am happy to add and test a DDF for the device.

It's WIP, need someone to test it #5710 (comment)

With this PR you can add to the DDF "revers":true at state/open, state/lift or both.

Work only for covering that don't use the tuya cluster (but the covering cluster)

@Xyaren
Copy link
Contributor Author

Xyaren commented May 4, 2022

I'm not sure if that is covering (ha!) this device but I'll happily test it once available.

@Smanar
Copy link
Collaborator

Smanar commented May 4, 2022

The code is available, you have the procedure to test it on the link.
After that you just need to create a DDF for your device, I can help for that too, I just need a skeleton/base for that.

It have worked on my side for a covering module (but in stand alone mode, without real covering)

@Finne75
Copy link
Contributor

Finne75 commented May 4, 2022

[REDACTED]

@Xyaren
Copy link
Contributor Author

Xyaren commented May 6, 2022

@Smanar
So I tried your branch and got it to kind of working with the following DDF:

{
  "schema": "devcap1.schema.json",
  "manufacturername": "_TZ3000_j1xl73iw",
  "modelid": "TS130F",
  "product": "TS130F",
  "sleeper": false,
  "status": "Gold",
  "path": "/devices/ts130f.json",
  "subdevices": [
    {
      "type": "$TYPE_WINDOW_COVERING_DEVICE",
      "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/lift",
          "refresh.interval": 300,
          "parse": {
            "at": "0x0008",
            "cl": "0x0102",
            "ep": 0,
            "eval": "Item.val = (100 - Attr.val);",
            "fn": "zcl",
            "reverse": true
          },
          "default": 0
        },
        {
          "name": "state/open",
          "parse": {
            "at": "0x0008",
            "cl": "0x0102",
            "eval": "Item.val = Attr.val == 100",
            "fn": "zcl"
          }
        },
        {
          "name": "state/reachable"
        }
      ]
    },
    {
      "type": "$TYPE_WINDOW_COVERING_DEVICE",
      "restapi": "/lights",
      "uuid": [
        "$address.ext",
        "0x02"
      ],
      "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/lift",
          "refresh.interval": 300,
          "parse": {
            "at": "0x0008",
            "cl": "0x0102",
            "ep": 0,
            "eval": "Item.val = (100 - Attr.val);",
            "fn": "zcl",
            "reverse": true
          },
          "default": 0
        },
        {
          "name": "state/open",
          "parse": {
            "at": "0x0008",
            "cl": "0x0102",
            "eval": "Item.val = Attr.val == 100",
            "fn": "zcl"
          }
        },
        {
          "name": "state/reachable"
        }
      ]
    }
  ],
  "bindings": [
    {
      "bind": "unicast",
      "src.ep": 2,
      "cl": "0x0102",
      "report": [
        {
          "at": "0x0008",
          "dt": "0x20",
          "min": 0,
          "max": 0
        }
      ]
    },
    {
      "bind": "unicast",
      "src.ep": 1,
      "cl": "0x0102",
      "report": [
        {
          "at": "0x0008",
          "dt": "0x20",
          "min": 0,
          "max": 0
        }
      ]
    }
  ]
}

So the following works:

  • Opening via "Open"
  • Closing via "Close"
  • Setting the Percentage

Percentage and State are show correctly once the shutter comes to a stop at the requested position.

What does not work now:

  • Stop Button

When calling the API I get the following error:
pydeconz.errors.BridgeBusy: 901 /lights/7/state/stop Internal error, 951
This is working when using my PR instead of the DDF

So this is no a feasable solution right now.

@Smanar
Copy link
Collaborator

Smanar commented May 6, 2022

@Xyaren

So this is no a feasable solution right now.

No, but I don't have full device to test code, it's for that I need you.
If you want to continue test here #5710 to not polute your PR.

Have updated the code, you can update it just with

cd deconz-rest-plugin
git pull
qmake && make -j2
sudo cp ../libde_rest_plugin.so /usr/share/deCONZ/plugins

The "stop" request is working now (I think I can listen a "clic" when making the request), but I don't understand why you create 2 light entry on your json ?

@Xyaren
Copy link
Contributor Author

Xyaren commented May 7, 2022

The "stop" request is working now (I think I can listen a "clic" when making the request), but I don't understand why you create 2 light entry on your json ?

I'll have to remove that.
My device has no light at all, so that can be removed.

@Smanar
Copy link
Collaborator

Smanar commented May 7, 2022

No I mean "light entries", it s covering, but you have 2


"subdevices": [
    {
      "type": "$TYPE_WINDOW_COVERING_DEVICE",
      "restapi": "/lights",
      "uuid": [
        "$address.ext",
        "0x01"
      ],
      "type": "$TYPE_WINDOW_COVERING_DEVICE",
      "restapi": "/lights",
      "uuid": [
        "$address.ext",
        "0x02"
      ],

and same in binding part, I don't think your device have 2 cluster ?

@Xyaren
Copy link
Contributor Author

Xyaren commented May 7, 2022

Oh, yeah it does have two clusters.
I can control two individual covers with one device.

https://www.aliexpress.com/item/1005003612165338.html
Color: 2CH Zigbee Module

@Smanar
Copy link
Collaborator

Smanar commented May 7, 2022

Ha yeah, so forget that I m saying. All seem fine in your DDF.
If you can say me if the "stop" request is working now ?

@Xyaren
Copy link
Contributor Author

Xyaren commented May 7, 2022

Stop command is doing something now yes.
Altough the Experience is not as good as with the cpp change of this PR.
I get frequent artifacts, like the shutter moving back to the previous position after it has moved, or it stuttering when using the stop button.
Or for example it is 90% open, and I press the "Open/Up" button (via API from HA) it opens to 100% then goes back down a bit.

Almost feels like something is always fighting my inputs.
This is especially true after performing multiple actions in succession.

This did not happen with code change from this PR.

@Smanar
Copy link
Collaborator

Smanar commented May 7, 2022

BTW, thx for your test. I will stop to pollute your issue ^^
I will copy paste your return on the other issue, to check if it's same or to try to have some logs because I don't see the problem.

@manup
Copy link
Member

manup commented May 31, 2022

Hi, should this PR be included in the next beta or is it work in progress?

@Smanar
Copy link
Collaborator

Smanar commented May 31, 2022

Sorry, my fault, have polluted his PR, discution have nothing to see with his PR.
For me his PR is finished.

@Xyaren
Copy link
Contributor Author

Xyaren commented Jun 9, 2022

I'm fine with this PR beeing merged. I have been testing it for the last weeks and it performs as expected.

@Mimiix
Copy link
Collaborator

Mimiix commented Jun 9, 2022

Device additions are only allowed with DDF's as far as i knew. @manup since when are we adding c++ based device additions again?

@manup
Copy link
Member

manup commented Jun 10, 2022

Only in very rare cases like this one since the PR simple and doesn't hurdle the transition to DDF once possible.
More complex code needs the DDF treatment :)

@Xyaren
Copy link
Contributor Author

Xyaren commented Jun 18, 2022

Only in very rare cases like this one since the PR simple and doesn't hurdle the transition to DDF once possible. More complex code needs the DDF treatment :)

Thanks !
I would love this to be merged, so I can move away from my custom builds 😁

@manup manup added this to the v2.18.0-beta milestone Jul 16, 2022
@manup manup merged commit 0fd1390 into dresden-elektronik:master Jul 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants