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

Wireless Scene Switch 3-gang Zigbee TS0043 _TZ3000_w8jwkczz #5552

Closed
kvnnap opened this issue Dec 4, 2021 · 35 comments
Closed

Wireless Scene Switch 3-gang Zigbee TS0043 _TZ3000_w8jwkczz #5552

kvnnap opened this issue Dec 4, 2021 · 35 comments

Comments

@kvnnap
Copy link

kvnnap commented Dec 4, 2021

Device

  • Product name: Scene Switch (Powered by Tuya)
  • Manufacturer: _TZ3000_w8jwkczz
  • Model identifier: TS0043
  • Device type :
    • Switch
      Front:
      front
      Back:
      back

Screenshots

switch-general

switch-node-info

Switch 01

Basic

switch-01-Basic

Power Configuration

switch-01-Power

On/Off

switch-01-On-Off

OTAU (Grey)

switch-01-OTAU

Time (Grey)

Shows nothing.

On/Off (Grey)

switch-01-On-Off-gray

Switch 02

Power Configuration

switch-02-Power

On/Off

switch-02-On-Off

On/Off (Grey)

switch-02-On-Off-gray

Switch 03

Power Configuration

switch-03-Power

On/Off

switch-03-On-Off

On/Off (Grey)

switch-03-On-Off-gray

Attempt

I have attempted to imitate other code changes, such as this PR here and compiled, tested and prepared a commit here. The device buttons work. I see the correct codes when a call to the REST API is made. However, I still see 3 On/Off entries under Lights in Phoscon. The resulting json and screenshots are below:

Correct switch addition:

phoscon-switches

    "3": {
        "config": {
            "battery": null,
            "on": true,
            "reachable": true
        },
        "ep": 1,
        "etag": "7b783e20cf59c61f25ff3e2841af53a2",
        "lastannounced": "2021-12-04T10:01:50Z",
        "lastseen": "2021-12-04T10:01Z",
        "manufacturername": "_TZ3000_w8jwkczz",
        "mode": 1,
        "modelid": "TS0043",
        "name": "Switch",
        "state": {
            "buttonevent": 3002,
            "lastupdated": "2021-12-04T09:56:12.904"
        },
        "type": "ZHASwitch",
        "uniqueid": "80:4b:50:ff:fe:06:9a:e6-01-0006"
    }

Incorrect light additions:

phoscon-lights

    "8": {
        "etag": "0f4db69999cf0585054066ba8287affb",
        "hascolor": false,
        "lastannounced": "2021-12-04T10:01:50Z",
        "lastseen": "2021-12-04T10:01Z",
        "manufacturername": "_TZ3000_w8jwkczz",
        "modelid": "TS0043",
        "name": "On/Off light 8",
        "state": {
            "alert": "none",
            "on": false,
            "reachable": true
        },
        "swversion": null,
        "type": "On/Off light",
        "uniqueid": "80:4b:50:ff:fe:06:9a:e6-01"
    },
    "9": {
        "etag": "e3443691a63e2147e780d80e469dc850",
        "hascolor": false,
        "lastannounced": "2021-12-04T10:01:50Z",
        "lastseen": "2021-12-04T10:01Z",
        "manufacturername": "_TZ3000_w8jwkczz",
        "modelid": "TS0043",
        "name": "On/Off light 9",
        "state": {
            "alert": "none",
            "on": false,
            "reachable": true
        },
        "swversion": null,
        "type": "On/Off light",
        "uniqueid": "80:4b:50:ff:fe:06:9a:e6-02"
    },
    "10": {
        "etag": "0555947fec87e0ea2599a6ad5d17e405",
        "hascolor": false,
        "lastannounced": "2021-12-04T10:01:50Z",
        "lastseen": "2021-12-04T10:01Z",
        "manufacturername": "_TZ3000_w8jwkczz",
        "modelid": "TS0043",
        "name": "On/Off light 10",
        "state": {
            "alert": "none",
            "on": false,
            "reachable": true
        },
        "swversion": null,
        "type": "On/Off light",
        "uniqueid": "80:4b:50:ff:fe:06:9a:e6-03"
    }

Environment and Other

The software runs on a Rasperry Pi 4b inside a docker container. To compile the change, the following Dockerfile was produced:

FROM debian:10.11-slim

ARG MYUSER=deconz

RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
    && apt-get -y dist-upgrade \
    && apt-get -y install wget gnupg2 g++ make qtdeclarative5-dev \
    && wget -O - http://phoscon.de/apt/deconz.pub.key | apt-key add - \
    && echo "deb http://phoscon.de/apt/deconz $(cat /etc/os-release | grep -oP \
      '(?<=VERSION_CODENAME\=).*')-beta main" > /etc/apt/sources.list.d/deconz.list \
    && apt-get update \
    && apt-get -y dist-upgrade \
    && apt-get -y install deconz-dev \
    && useradd -ms /bin/bash $MYUSER \
    && apt-get -y install --no-install-recommends sudo \
    && echo $MYUSER ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$MYUSER \
    && chmod 0440 /etc/sudoers.d/$MYUSER

USER $MYUSER
WORKDIR /home/$MYUSER

and this Dockerfile was used to test the change after libde_rest_plugin.so was compiled:

FROM deconzcommunity/deconz:latest
COPY libde_rest_plugin.so /usr/share/deCONZ/plugins
COPY button_maps.json /usr/share/deCONZ/devices
@Mimiix
Copy link
Collaborator

Mimiix commented Dec 4, 2021

@Smanar

@Smanar
Copy link
Collaborator

Smanar commented Dec 4, 2021

It's normal.
Just ignore them for the moment, need to cxode something to prevent their creation.

@kvnnap
Copy link
Author

kvnnap commented Dec 4, 2021

ok, will test the code as soon as there is an update.

@Smanar
Copy link
Collaborator

Smanar commented Dec 4, 2021

I think the next update will be a DDF file and need more time for battery switch (the code is not ready yet)

@github-actions
Copy link
Contributor

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 Dec 26, 2021
@kvnnap
Copy link
Author

kvnnap commented Dec 28, 2021

Keeping issue alive. @Smanar Any updates on this?

@Smanar
Copy link
Collaborator

Smanar commented Dec 28, 2021

Nope, for the moment all PR are blocked.
The official method is using the DDF file, but the deconz core don't support battery switches yet.
So for the moment all is waiting list.

@github-actions github-actions bot removed the stale label Dec 29, 2021
@github-actions
Copy link
Contributor

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 Jan 20, 2022
@kvnnap
Copy link
Author

kvnnap commented Jan 20, 2022

Keeping issue alive.

@github-actions github-actions bot removed the stale label Jan 21, 2022
@kvnnap
Copy link
Author

kvnnap commented Feb 2, 2022

Hi @Smanar

Is there any timeline about this and is there anywhere I can follow updates about support for battery switches?

I am asking so I can get an idea about when this issue will be tackled.

@Mimiix
Copy link
Collaborator

Mimiix commented Feb 2, 2022

@kvnnap please check #5733

@github-actions
Copy link
Contributor

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 Feb 24, 2022
@kvnnap
Copy link
Author

kvnnap commented Feb 26, 2022

Keeping this alive..

@github-actions github-actions bot removed the stale label Feb 27, 2022
@github-actions
Copy link
Contributor

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 Mar 20, 2022
@kvnnap
Copy link
Author

kvnnap commented Mar 25, 2022

keeping this alive

@github-actions github-actions bot removed the stale label Mar 26, 2022
@github-actions
Copy link
Contributor

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 Apr 16, 2022
@kvnnap
Copy link
Author

kvnnap commented Apr 19, 2022

keeping this alive

@Smanar
Copy link
Collaborator

Smanar commented Apr 19, 2022

Hello.
It's old, but If I right the code is working, you just want to remove the useless entries ?

I think it's possible using DDF.
We will use them during the creation and let the legacy code make his work after.

https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/DDF-cheat-sheet

Just select "edit DDF", and remove useless light entry, or just add a ZHASwitch one. If it don't work can you copy paste your DDF ?

@github-actions github-actions bot removed the stale label Apr 20, 2022
@kvnnap
Copy link
Author

kvnnap commented Apr 25, 2022

Hi @Smanar,

Been busy, will try later today and let you know.

Thanks!

@kvnnap
Copy link
Author

kvnnap commented May 7, 2022

Hi @Smanar,

I tried editing the DDF and removing the useless light entries, however they still show in Phoscon Web. Then I tried removing the lights from Phoscon Web but it removed the switch too.

Not sure how to proceed.

@Smanar
Copy link
Collaborator

Smanar commented May 7, 2022

Are you using the GUI or text editor ? The easier way is reincluding the device with a working DDF, don't forget to set the status to "Gold"
Can you show your final DDF ?

And yes it s something normal, you can't remove a "part of a device", it s all or nothing.

@kvnnap
Copy link
Author

kvnnap commented May 7, 2022

I was using the GUI and I set it to Silver (but allowed silver DDFs). I just tested with status Gold and I have the same result. I also tried removing the device and adding it back after saving this DDF. Here's the final DDF:

{
  "schema": "devcap1.schema.json",
  "manufacturername": "_TZ3000_w8jwkczz",
  "modelid": "TS0043",
  "product": "TS0043",
  "sleeper": false,
  "status": "Gold",
  "path": "/devices/ts0043.json",
  "subdevices": [
    {
      "type": "$TYPE_SWITCH",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x0006"
      ],
      "fingerprint": {
        "profile": "0x0104",
        "device": "0x0000",
        "endpoint": "0x01",
        "in": [
          "0x0000",
          "0x0001"
        ],
        "out": [
          "0x0006"
        ]
      },
      "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",
          "description": "The current device battery level in 0&ndash;100&thinsp;%.",
          "default": 0
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/buttonevent",
          "description": "The last received button event."
        },
        {
          "name": "state/lastupdated"
        }
      ]
    }
  ],
  "bindings": [
    {
      "bind": "unicast",
      "src.ep": 1,
      "dst.ep": 1,
      "cl": "0x0001",
      "report": [
        {
          "at": "0x0021",
          "dt": "0x20",
          "min": 300,
          "max": 2700,
          "change": "0x00000001"
        }
      ]
    },
    {
      "bind": "unicast",
      "src.ep": 2,
      "dst.ep": 1,
      "cl": "0x0001",
      "report": [
        {
          "at": "0x0021",
          "dt": "0x20",
          "min": 300,
          "max": 2700,
          "change": "0x00000001"
        }
      ]
    },
    {
      "bind": "unicast",
      "src.ep": 3,
      "dst.ep": 1,
      "cl": "0x0001",
      "report": [
        {
          "at": "0x0021",
          "dt": "0x20",
          "min": 300,
          "max": 2700,
          "change": "0x00000001"
        }
      ]
    }
  ]
}

@Smanar
Copy link
Collaborator

Smanar commented May 7, 2022

So all seem fine for me ...
And if you try to include the device you have 1 sensor and still 3 lights entries.
What is your deconz version ?

@kvnnap
Copy link
Author

kvnnap commented May 7, 2022

Correct, the web interface still shows 1 switch and 3 light entries.

Current deCONZ version: 2.15.03

I am using this docker image: deconzcommunity/deconz:latest

image

@Smanar
Copy link
Collaborator

Smanar commented May 7, 2022

I m asking to other devs, Not sure at 100% the legacy code is bypassed by DDF, but the result is still strange for me.
You have a way to be sure the DDF is used ? because it s hard to use DDF on docker OS, you can see it on the GUI (on the editor window title when making "edit DDF") or on logs at start ?

@kvnnap
Copy link
Author

kvnnap commented May 7, 2022

I restarted the container and noticed that the logs show that it is loaded:

image

Also, when I click Edit DDF on the switch I get this:

image

Phoscon Web still shows:

image

and

image

I also tried reverting the docker container to a version where I have no switch setup and restarting this whole setup, but it still gives this result.

@Mimiix
Copy link
Collaborator

Mimiix commented May 7, 2022

Phoscon will never show the correct result as they have to add support on their own.

Please use the rest api and websocket to determine if the behavior is correct.

@Smanar
Copy link
Collaborator

Smanar commented May 8, 2022

He have give the API extract on the first post, with all json.

For me it's realy an issue on DDF core. For me the legacy code is not enought by-passed.

@kvnnap
Copy link
Author

kvnnap commented May 8, 2022

I checked the API to make sure and the extra lights are still listed:

image

@kvnnap
Copy link
Author

kvnnap commented May 8, 2022

I have also noticed that I am unable to get the button events (buttonevent is null). Prior to DDF I had changed the button_maps.json file (see here) in order to make it work. How does it work now with DDF?

{
    "config": {
        "battery": 0,
        "on": true,
        "reachable": true
    },
    "ep": 2,
    "etag": "72e466e434e9860936a90f40f4328e37",
    "lastannounced": "2022-05-08T08:52:49Z",
    "lastseen": "2022-05-08T08:52Z",
    "manufacturername": "_TZ3000_w8jwkczz",
    "mode": 1,
    "modelid": "TS0043",
    "name": "Switch 7",
    "state": {
        "buttonevent": null,
        "lastupdated": "none"
    },
    "type": "ZHASwitch",
    "uniqueid": "80:4b:50:ff:fe:06:9a:e6-02-0006"
}

@Smanar
Copy link
Collaborator

Smanar commented May 8, 2022

I m seing this PR #6021

I readly don't see what do the code but seem usefull according to description

Since DDF devices and their light and sensor resources are created async, the rule triggers can't be indexed in the plugin constructor.

The PR delays/debounces the indexing so that all devices are handled properly. This is also a bit faster since prior for each device useless container calls where made during startup.

@kvnnap
Copy link
Author

kvnnap commented May 9, 2022

Is this PR going to be included in the upcoming release 2.15.04? If so I will wait and test when this is out.

@Smanar
Copy link
Collaborator

Smanar commented May 9, 2022

Yep, it's already merged.

@github-actions
Copy link
Contributor

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 May 31, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Jun 8, 2022

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.

@github-actions github-actions bot closed this as completed Jun 8, 2022
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

3 participants