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

[Device Support Request] Zemismart 3 Gang Remote Switch (2nd attempt) #3524

Closed
stevewull opened this issue Oct 27, 2020 · 67 comments
Closed

Comments

@stevewull
Copy link

Device

  • Product name: Zemismart Wireless Switch Work with Tuya Hub One Two Three Gangs Touch Switches Sticker
  • Manufacturer: _TZ3400_key8kk7r
  • Model identifier: TS0043
  • Device type:
    • Switch

Listed here: https://zigbee.blakadder.com/Zemismart_ZM-ZS3.html

Purchased here: https://www.aliexpress.com/item/4000460643839.html?aff_platform=link-c-tool&cpt=1579460387259&sk=_sPA71V&aff_trace_key=1ea588879adf4a71b69472fcc8469bea-1579460387259-01187-_sPA71V&terminal_id=5ab3b3bf703c438dac102dcfef054d7e

I have the three gang version

Screenshots

image

image

Switch 01:

image

image

image

image

image

Switch 02:
image

image

Switch 03:
image

image

@Smanar
Copy link
Collaborator

Smanar commented Oct 28, 2020

Hello, so I have made a mistake on PR and removed a part of code, can you try this code pls.

To test it, you need an Unix OS, and take a look here https://github.com/dresden-elektronik/deconz-rest-plugin#install-deconz-development-package-optional-linux-only with a modification for step 1

git clone --branch tuya https://github.com/Smanar/deconz-rest-plugin.git
cd deconz-rest-plugin
qmake && make -j2
sudo cp ../libde_rest_plugin.so /usr/share/deCONZ/plugins

@stevewull
Copy link
Author

Thanks Smanar,

I will try to set up a test environment. I have done this in the past. This has caused problems as I only have one Conbee and have to bring down the production environment. Some of the devices get confused and have trouble pairing properly when I try to restore them to production.

@Smanar
Copy link
Collaborator

Smanar commented Nov 1, 2020

If you have an unix machine, no danger, just make a backup of the file lib (in other folder), and you just need 10s to rollback, the code don't change anything to c,onfig.

@stevewull
Copy link
Author

Hi Smanar,
I now have a Pi4 running the stable version of deConz that I can use for testing. You provided a link with instructions but I am not quire sure where to start.

Should I uninstall the stable version of deconz?
Should I start with the line that installs deconz-dev?

@Smanar
Copy link
Collaborator

Smanar commented Nov 8, 2020

Hello, no depend of the deconz version you have, but there is a major modification on deconz core for button gestion (use now a json file), so I think it s better if you can install the last beta (if you have no issue with it)

Then after yes https://github.com/dresden-elektronik/deconz-rest-plugin#install-deconz-development-package-optional-linux-only

So it will be for you

sudo apt install deconz-dev
git clone --branch tuya https://github.com/Smanar/deconz-rest-plugin.git
cd deconz-rest-plugin
qmake && make -j2
sudo cp ../libde_rest_plugin.so /usr/share/deCONZ/plugins

If you want to avoid re-installation, you can make a backup of the file "libde_rest_plugin.so", in another folder, so if you have problem, the rollback just take 30s.

@stevewull
Copy link
Author

Thanks for the instructions. Test environment is working using your branch for the plug-in.

The Zemismart switch now appears in the Phoscon App as three "On/Off lights."

I think they are supposed to act like a switch with each of the three buttons having single press, long press, and hold.

@Smanar
Copy link
Collaborator

Smanar commented Nov 9, 2020

Sorry my bad, was wired device in my mind.
I have corrected the code to use them as wirelesss device now

Pls make a new try, will be faster

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

@stevewull
Copy link
Author

Ok. I loaded your new code. Not sure exactly what to check for testing.

Each of the three buttons still show up in Phoscon App as an on/off light.

@Smanar
Copy link
Collaborator

Smanar commented Nov 10, 2020

You have deleted them, before the new inclusion ?

@Smanar
Copy link
Collaborator

Smanar commented Nov 11, 2020

Ok I think I have found the problem, the tuya hack was working if you have only 1 endpoint, can you make another try pls ?

@stevewull
Copy link
Author

Hi Sameer,
I performed a new git pull and compiled your code. I launched deConz and, using Phoscon app, removed the switch from deConz.

I then put the switch in pairing mode. The Phoscon app does not detect or display when I choose add new lights, switches, or sensors.

However, the switch is visible as a node in the deConz gui, not connected to other nodes. The light on the switch continues to flash indicating that it did not leave pairing mode. I see the cluster info for three different on/off switches.

Separately, I connected the switch to a non-deConz controlled Zigbee network. This also detected the three clusters as on/off switches. I didn't see a way to detect single press, long press, hold.

@Smanar
Copy link
Collaborator

Smanar commented Nov 13, 2020

Can you make a try.

  • Set phoscon in permit join (add new sensor)
  • Read again basic attribute on deconz, cluster 0x0000, button "read" probalby need to make the device awake in same time

The device will to be visible in sensor part but invisible in phoscon.

@Smanar
Copy link
Collaborator

Smanar commented Nov 14, 2020

I m sorry but I need to finalize the code sunday if I want it be in next beta.
There is no one that can try the code ?
On "tuya" branch or "tuya_pr" (based on last code possible)

I just need to know if the "switches group" is working (mean all buttons are working in the same entry), else I will make a roolback to have 1 sensor device by endpoint.

@Mimiix
Copy link
Collaborator

Mimiix commented Nov 14, 2020

@Smanar release will be today.

@stevewull
Copy link
Author

testing now

@stevewull
Copy link
Author

When you say "device will be visible in sensor part". Do you mean in the API?

@stevewull
Copy link
Author

I performed a git pull from the Tuya branch listed above. The switch shows up in the sensors section of the API. Three entries.

"2": {
  "config": {
    "battery": 95,
    "on": true,
    "reachable": false
  },
  "ep": 1,
  "etag": "a3a55398dd4805c633e6d0d75e201e70",
  "lastseen": null,
  "manufacturername": "_TZ3400_key8kk7r",
  "mode": 1,
  "modelid": "TS0043",
  "name": "TS0043 2",
  "state": {
    "buttonevent": 1002,
    "lastupdated": "2020-11-10T04:31:17.116"
  },
  "type": "ZHASwitch",
  "uniqueid": "60:a4:23:ff:fe:a0:f1:30-01-0006"
},
"3": {
  "config": {
    "battery": 95,
    "on": true,
    "reachable": false
  },
  "ep": 2,
  "etag": "a3a55398dd4805c633e6d0d75e201e70",
  "lastseen": null,
  "manufacturername": "_TZ3400_key8kk7r",
  "mode": 1,
  "modelid": "TS0043",
  "name": "TS0043 3",
  "state": {
    "buttonevent": 2002,
    "lastupdated": "2020-11-10T04:31:21.146"
  },
  "type": "ZHASwitch",
  "uniqueid": "60:a4:23:ff:fe:a0:f1:30-02-0006"
},
"4": {
  "config": {
    "battery": 95,
    "on": true,
    "reachable": false
  },
  "ep": 3,
  "etag": "a3a55398dd4805c633e6d0d75e201e70",
  "lastseen": null,
  "manufacturername": "_TZ3400_key8kk7r",
  "mode": 1,
  "modelid": "TS0043",
  "name": "TS0043 4",
  "state": {
    "buttonevent": 3003,
    "lastupdated": "2020-11-10T04:31:48.870"
  },
  "type": "ZHASwitch",
  "uniqueid": "60:a4:23:ff:fe:a0:f1:30-03-0006"
}

}
}

@Smanar
Copy link
Collaborator

Smanar commented Nov 15, 2020

@Mimiix I have ask manup, I have until tonight.

@stevewull It s strange, on other issue the user have the 3 entries grouped with the same code, BTW if it s working it s the principal, thx.

@stale
Copy link

stale bot commented Dec 19, 2020

As there hasn't 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.

@stale stale bot added the stale label Dec 19, 2020
@petosak
Copy link

petosak commented Dec 19, 2020

Anybody knows how to change and use as a button?
image
HA recognize as switch but never switched anything

@stale stale bot removed the stale label Dec 19, 2020
@Smanar
Copy link
Collaborator

Smanar commented Dec 19, 2020

You have a battery device ?
I don't know HA, the 3 "3 button No 1" are "light" ? If yes, there is a problem, don't delete your device but remake inclusion, you need to have a field that use "buttonevent"

@petosak
Copy link

petosak commented Dec 19, 2020

I have exactly same 3button controller as in this case:
#3220
Each button can do different things. I thought that i'll can use push/hold/click for each button for action in HA....
What you mean "remake inclusion"? How can i do that?

@Smanar
Copy link
Collaborator

Smanar commented Dec 19, 2020

Ok is the battery powered one, you nned to have a sensor entry with "buttonevent".
Just re-pair (or re-include) the device but without deleting the old entry.

@petosak
Copy link

petosak commented Dec 20, 2020

I still can't see events as in Aqara. Still see only On/Off for every 3 buttons. Is it right? On right side is one button 3state Aqara.
image

@Smanar
Copy link
Collaborator

Smanar commented Dec 21, 2020

Not normal at all, you haven't 0x0006 cluster so to have on/off ....
Can you find the complete device JSON somewhere ? (On deconz logs for exemple)

@petosak
Copy link

petosak commented Jan 6, 2021

Yes. You're right. Lights not working.
I know how to use events. I meant that i see 2 events on one push button. On every one push/click/hold i get 2 events.
I can see only diffent id. I don't know why, but it works.

@Smanar
Copy link
Collaborator

Smanar commented Jan 6, 2021

It s not your fault ^^.
I m still searching why this double event, in my mind was the pooling, but if you have the problem for other event, for me it s realy 2 command send by the device.
And I don't understand why some users don't have the problem.

@clovisdivay
Copy link

@Smanar Okay I did what you asked, now I have the manufacturer's name.
I don't have the 3 switches in Phoscon (I removed them before doing what you told me), but I don't have anything now... Maybe I should start over ? Should I reset the switch to factory settings and start the process over ?

image

@Smanar
Copy link
Collaborator

Smanar commented Jan 6, 2021

All seem fine.
If you realy have nothing in sensor (not in light), in your third app, the sensor can be invisible in phoscon.
Just set phoscon in permit join (add new sensor/light), and read again the basic attribute (a second time), deconz already know the manufacture name, so you will not have the light creation, but you need have the sensor one.
Else can you show the log during the inclusion ?

@clovisdivay
Copy link

clovisdivay commented Jan 6, 2021

Okay it seems to work now, though it is still invisible in Phoscon (not a big deal for me).

I also have the "double event" issue.

Thanks for your help ! :)

@Smanar
Copy link
Collaborator

Smanar commented Jan 7, 2021

@clovisdivay I don't think it will change something, but can you show me the long during the double event too pls.
On deconz / help with debug log 'info" and "info_l2"

@clovisdivay
Copy link

INFO :
image

For INFO_l2, there is too much going on in the log, I don't know what would be of interest for you. What should I be looking for ?

@Smanar
Copy link
Collaborator

Smanar commented Jan 7, 2021

Right, hard to see something usefull.
If I add some debug line in code, are you able to recompile it to test it ?

@clovisdivay
Copy link

Sorry, no :( I use deconz as a plugin in Home Assistant (I think it uses pydeconz) and I can't chose the version.

@Flow-tech-lab
Copy link

Yep this device seem present on the code

{ VENDOR_EMBER, "TS0043", silabs7MacPrefix }, // Tuya wireless switch

Iike have said Mimix, you can check the manufacture name again (it faild sometime), you NEED to have one of those


                    else if ((sensorNode->manufacturer() == QLatin1String("_TZ3000_bi6lpsew")) ||
                        (sensorNode->manufacturer() == QLatin1String("_TZ3400_keyjhapk")) ||
                        (sensorNode->manufacturer() == QLatin1String("_TYZB02_key8kk7r")) ||
                        (sensorNode->manufacturer() == QLatin1String("_TZ3400_keyjqthh")) ||
                        (sensorNode->manufacturer() == QLatin1String("_TZ3400_key8kk7r")) ||
                        (sensorNode->manufacturer() == QLatin1String("_TZ3000_vp6clf9d")) ||
                        (sensorNode->manufacturer() == QLatin1String("_TYZB02_keyjqthh")))

If you haven't it, the API can't reconize it, but if you can see it in deconz, the API can use deconz value to help for inclusion.

But your problem is a problem to include it ?

Hello @Smanar, first of all, thank you all the work on these Tuya switches!

I have a Zemismart 3gang switch and tried everything you described, but never saw the sensor in the Rest API.

Might it be because of the manufacturer name? Mine is "_TZ0300_qzjcsmar", which is not in your list. Model identifier is correct, TS0043.

@Smanar
Copy link
Collaborator

Smanar commented Jan 15, 2021

If is a battey one, yes.
I can add it, but be sure of the manufacture name ^^, I think there is (at least) one typo in "_TZ0300_qzjcsmar".

@Flow-tech-lab
Copy link

Flow-tech-lab commented Jan 15, 2021

It is a battery one, yes. You are right, there was a typo: It is "_TZ3000_qzjcsmar"
image

@Smanar
Copy link
Collaborator

Smanar commented Jan 15, 2021

Just added here #4157

@Flow-tech-lab
Copy link

Awesome, that was quick!
I already made a git pull to try it, everything looks fine in deconz, but API still doesnt show it as a sensor. Must be missing something

@Smanar
Copy link
Collaborator

Smanar commented Jan 15, 2021

Yep, you probably need to make 2 inclusions, without deleting the old one (you can have a light entry created first)

@Flow-tech-lab
Copy link

I dont really understand, how you mean the 2 inclusions, but I got it to work, at least partly:

  • Phoscon shows the device under "switches"
  • My Rest API Client shows the following:

image

So, battery state shows correct, but "buttonevent": null is not correct, right?

@Smanar
Copy link
Collaborator

Smanar commented Jan 18, 2021

Depend of the version you are using.
This device was added 3 days ago > #3524 (comment)

So if you use this branch it will work, (no need to remake the inclusion)

Edit :
Haaaaaa, yes I remember, you need too edit the json file, recompiling the code is not enough, sorry.
You need to edit the file button_maps.json with the modification visible here https://github.com/dresden-elektronik/deconz-rest-plugin/pull/4157/files

@Flow-tech-lab
Copy link

Flow-tech-lab commented Jan 18, 2021

Really appreciate your help, thanks a lot! I already use this branch with the changes in button_maps.json and de_web_plugin.cpp. This is how I did it:

image

Included it two times in Phoscon, see it as a switch (not as light, not as sensor).
Was this the correct way? I am not sure what else you mean with recompiling the code.

It seems, that everything is recognized correctly, just the buttonevent has no value at all.. Here a screenshot from my iobroker:

image

@Smanar
Copy link
Collaborator

Smanar commented Jan 18, 2021

Tuya are boring to include, it s ok now ^^, stop to include it.

Your method is good, the result too, else you will be not able to see it in the API, you are not using docker ?
If you press a button this value need to change.

Else if you have the GUI, can you take a look in log when pressing a button ? in deconz/help/log with "info" and "info_l2"

@Flow-tech-lab
Copy link

Flow-tech-lab commented Jan 19, 2021

Ok, so I think I got it to work now. Thank you again @Smanar (is there a way to support your work?)!

If anyone has the same issues, this is all I did:

  • branch tuya_switch as mentioned above
  • include it as a sensor in phoscon
  • change the button_maps.json in /usr/share/deCONZ/devices/ to the new one
  • iobroker: it did not recognize any button changes, until I renamed the device in iobroker (default name was "Schalter")

@jirimissbach
Copy link

Hello @Smanar,
I just unpacked a new 3 gang battery switch Manufacturer: _TZ3000_qzjcsmar and as it is not working for me, Google pointed me to this issue. I assume this sill be merged with the main branch but is there any estimate when/which version? I have only one switch so wondering whether I shall use the branch tuya_switch or just wait ...

Thanks and sorry for the newbie question.

Jiri

@Smanar
Copy link
Collaborator

Smanar commented Jan 20, 2021

I think it will be in the master in 1 week, but after need to wait for the master be official.
Depend of how many time you can wait, but if you are using a Linux machine with complete OS recompiling the code is fast.

@jirimissbach
Copy link

Thank you for the details. I'm running in under HA in a container so will need to look into how to "patch" it. I'm not that familiar with that

@Smanar
Copy link
Collaborator

Smanar commented Jan 20, 2021

Hu ^^, I had a disagreement recently with an user about docker, so it s possible to patch the file inside the docker, but realy not easy. And honnestly I m not familiar with docker too.

@jirimissbach
Copy link

Thank you Smanar, I'll play with other wired switches and will look into the docker patching later if still needed.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2021

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 5, 2021
@github-actions
Copy link
Contributor

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

7 participants