Replies: 32 comments 145 replies
-
I have a TS004F that just arrived this week. What's funny is that it says "ESW-0ZAA-EU" on the back, which matches the compatibility db, but the zigbee ID differs - the manufacturer on my device is _TZ3000_xabckq1v and then the model is TS004F. It seems that only 2 of the 4 buttons fire events in ZHA directly (the right side buttons), so I've just now started working with zigbee2mqtt to try and debug further. Within zigbee2mqtt the 4 buttons seem to work, as @neforce shows, but the messages from the left side and right side are different. For posterity, here's what I see in the debug logs with what I would call a short, single press:
Long presses seem to send the same message, and double clicks do nothing. You can also see that the left side doesn't have associated data which must be why ZHA can't see it, though that's obviously not an issue for this forum. |
Beta Was this translation helpful? Give feedback.
-
https://community.home-assistant.io/t/zigbee2mqtt-tuya-4-button-scene-switch-ts0044/274735/14 This is external converter for TS004F. |
Beta Was this translation helpful? Give feedback.
-
This is still an issue. In the Tuya app there is 12 actions for a 4 button switch and only 6 in z2m. Surely there is some way to access the other 6 actions. |
Beta Was this translation helpful? Give feedback.
-
I've done some sniffing. Using my ESW-OZAA-EU model, which is recognised by Z2M as a TS004F. Device sends a button press, and waits for the server to advise if it needs to change modes. At that point the server decides whether it needs to tell the button (and whole switch) to change modes or not to change modes. If a mode change is required, the write attributes sequence is initiated. Once in the new mode, the "write attributes" isn't called again for a button press unless the mode is changed in the Tuya app. This is the sequence for a button press after a mode change in the app:
The response that changes the mode is in the Write Attributes lines. Where the Attribute Field, Enum8 is changed.
I crashed my session, so I'll send some additional commands sometime later this evening. |
Beta Was this translation helpful? Give feedback.
-
More testing completed. full capture test notes.txt
Testing notes: There were one or two occasions I didn't note the correct frame, so had to perform that test again. Therefore, there are a couple of errant lines I'm sorry. Please let me know if any additional capture or explanation. EDIT: Spelling and grammar |
Beta Was this translation helpful? Give feedback.
-
So @kkossev at hubitat seems to have solved this which is awesome. Seems like from the ZHA thread that they're using:
Right now I'm not sure how that's different from my failed attempt: But I'm hopeful that some people smarter than me can use this knowledge to implement this correctly. Also congrats again to @kkossev for solving this. |
Beta Was this translation helpful? Give feedback.
-
With Tuya Hub we can change mode, but even if i change, when i go back to z2m it returns to dimmer mode |
Beta Was this translation helpful? Give feedback.
-
There was some good progress in the last days configuring the TS004F device in Scene Control (or 'Device Trigger') mode! A remaining problem is that after successfully switching the mode, cluster 6 commands are not bound to the Zigbee coordinator, but are sent as a broadcast, which requires filtering of repetitive keypress events. Hopefully, a solution for this issue can be found soon. |
Beta Was this translation helpful? Give feedback.
-
Hi. Recently I added mode switching for a similar device, but it looks like a remote control. |
Beta Was this translation helpful? Give feedback.
-
@kirovilya Looks like tuya is making all thing in one very strange way :-( I taking on look in your sniff and see if i can finding somthing. |
Beta Was this translation helpful? Give feedback.
-
@kirovilya Your device is reporting the mode switch attribute after have joining the network and before its requesting one updated link key from the coordinator so only need looking for the attribute being reported and then writing it back with it set to one.
I cant see that the coordinator is sending the mode switch attribute so i think you was doing it with key pressing on the device but the coordinator is broadcasting
And you device have the on/off and light level cluster as out cluster = right and our have all on the in cluster that is completely wrong so making problem with binding and configuring reporting in zigbee standard way. |
Beta Was this translation helpful? Give feedback.
-
Just wondering, I have an TS004F and on the back it says: ESW-OZAA-EU, however just above the battery on a small sticky it says: ESW-OZBA-EU. |
Beta Was this translation helpful? Give feedback.
-
My TS004F sais inside ESW-0ZBA-EU and on the outside it sais RSH-ZigBee-SC04 (outside there is no other number that starts with ESW...) |
Beta Was this translation helpful? Give feedback.
-
I purchased new dongles to move to z2m, and I'm trying to add my switches that weren't supported by the OpenHab controller. I would like to use my TS004F switch, and it looks like it is working for the Hubitat guys here: https://community.hubitat.com/t/yagusmart-4-button-scene-switch/57237/137 |
Beta Was this translation helpful? Give feedback.
-
Hi, I have bought few 4-button switches: on the box So when pairing finishes, I can't get any actions on the log (debug mode is on) or on mqtt. No any messages, when pressing, doubleclicking or holding any of four keys. Tried default converters, tried examples that I was able to find. I eve can't get into situation, when 6 of 12 actions are working, as I have a case when 0 of 12 actions are working. I am getting only battery percentage, signal strength and last seen values. From database.db:
Bought it from aliexpress. My buttons numbering is like this:
When device is unpaired, after pressing Is there anyone else with similar situation, any hints what could I do to make it work? |
Beta Was this translation helpful? Give feedback.
-
PR Raised. Please feel free to upvote, although @Koenkk seems very responsive to the community. |
Beta Was this translation helpful? Give feedback.
-
You guys are amazing, but unfortunately, I am unable to get this to work
for me.
I followed the instructions, and after about an hour of multiple
combinations of button presses, I cannot get messages in 4button mode.
6sec long press on 2-4, results in a single flash on #3, which I am
assuming switches modes. I can switch modes back and forth no problem
between dimmer mode and switch mode. I just don't get any events in
switch mode.
Another thing I found is that long press 1-3 results in #3 blinking, I
assume keeping the device awake, because I can switch between modes in
this state.
I tried putting it in switch mode, and removing/rejoining, but this puts
the device back in dimmer mode.
Finally, I shut down the server, pulled the USB dongle, and pulled the
battery from the device, then restarted from there.
What sort of logs would help you guys?
On 12/1/21 1:13 AM, fringefilmsoz wrote:
Solution
** Note: there are some variants of this model, which may behave
differently. Please report if this solution does not work for your
model. **
The solution identified and contributed to by many smart people above,
and final solution posted by @antbarney
<https://github.com/antbarney>. Thank you everyone.
Instructions
1. In |fromZigbee.js| modify or add the below function.
(My file was located at:
/opt/zigbee2mqtt/node_modules/zigbee-herdsman-converters/converters)
|tuya_on_off_action: { cluster: 'genOnOff', type: 'raw', convert:
(model, msg, publish, options, meta) => { if
(hasAlreadyProcessedMessage(msg, msg.data[1])) return; const
clickMapping = {0: 'single', 1: 'double', 2: 'hold'}; let
buttonMapping = null; if (model.model === 'TS0042') { buttonMapping =
{1: '1', 2: '2'}; } else if (model.model === 'TS0043') { buttonMapping
= {1: '1', 2: '2', 3: '3'}; } else if (['TS0044', 'YSR-MINI-Z',
'TS004F'].includes(model.model)) { buttonMapping = {1: '1', 2: '2', 3:
'3', 4: '4'}; } const button = buttonMapping ?
`${buttonMapping[msg.endpoint.ID]}_` : ''; // Since it is a non
standard ZCL command, no default response is send from zigbee-herdsman
// Send the defaultResponse here, otherwise the second button click
delays. // #8149
msg.endpoint.defaultResponse(0xfd, 0, 6, msg.data[1]).catch((error) =>
{}); return {action: `${button}${clickMapping[msg.data[3]]}`}; }, }, |
2. In |tuya.js| replace the existing content of the TS004F config in
file with:
(My file was located at:
/opt/zigbee2mqtt/node_modules/zigbee-herdsman-converters/devices)
|{ fingerprint: [{modelID: 'TS004F', manufacturerName:
'_TZ3000_xabckq1v'}], model: 'TS004F', vendor: 'TuYa', description:
'Wireless switch with 4 buttons', exposes: [e.battery(),
e.action(['1_single', '1_double', '1_hold', '2_single', '2_double',
'2_hold', '3_single', '3_double', '3_hold', '4_single', '4_double',
'4_hold'])], fromZigbee: [ fz.battery, fz.tuya_on_off_action ],
toZigbee: [tz.tuya_operation_mode], configure: async (device,
coordinatorEndpoint, logger) => { const endpoint =
device.getEndpoint(1); await endpoint.read('genBasic', [0x0004, 0x000,
0x0001, 0x0005, 0x0007, 0xfffe]); await endpoint.write('genOnOff',
{'tuyaOperationMode': 1}); await endpoint.read('genOnOff',
['tuyaOperationMode']); try { await endpoint.read(0xE001, [0xD011]); }
catch {}; await endpoint.read('genPowerCfg', ['batteryVoltage',
'batteryPercentageRemaining']); await reporting.bind(endpoint,
coordinatorEndpoint, ['genPowerCfg']); await
reporting.bind(device.getEndpoint(1), coordinatorEndpoint,
['genOnOff']); await reporting.bind(device.getEndpoint(2),
coordinatorEndpoint, ['genOnOff']); await
reporting.bind(device.getEndpoint(3), coordinatorEndpoint,
['genOnOff']); await reporting.bind(device.getEndpoint(4),
coordinatorEndpoint, ['genOnOff']); }, }, |
3. After making these changes, reboot your server.
4. You should then remove your device(s) from Z2M, ideally using
ZigbeeToMQTT frontend or by modifying configuration.yaml.
5. Place the devices into pairing mode (hold bottom left button for
10 seconds).
6. Device should pair and be registered in Z2M after about 10-20 seconds.
7. If device has paired but button presses are not recognised: Long
press buttons 2+4 (two right buttons) for approximately 6 seconds.
This will change the button action mode.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#7158 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC4KR44TMRDZ4WR46UPUJNTUOXDH5ANCNFSM43KIM7MQ>.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
--
Brian Michalk
Owner, Hasgrok.com, LLC.
512-699-4037
www.hasgrok.com
|
Beta Was this translation helpful? Give feedback.
-
Thank you @fringefilmsoz I just install latest z2m HA addons (1.22.1), the fix was already applied. At first, after switching to trigger mode, only button 1 works. So, I delete the device in z2m, take the battery out and put it back in again to do a hard reset then restarting the z2m server, finally everything works. My device info: |
Beta Was this translation helpful? Give feedback.
-
Two weeks after I bought the device from 'A' there is a z2m update to make it work exactly as I want. (ESW-0ZAA-EU, z2m 1.22.1) It was a bit complicated to get it recognized correctly. I removed the batteries, waited a while, restarted the system (HA) at that moment I put the batteries back in so the device is not yet recognized. Then activated permit join and pressed button 3 until all lights flash to pair. Then I pressed all buttons multiple times. Switched to scene mode (button 2 + 4 until button 3 light) and pressed each combination at least once (single, double, long for each button) to get all events/actions registered. Perhaps there is an easier way but it is working as 12 way switch now. |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot for your work @fringefilmsoz ! I got this device 1 month ago and was quite frustrated to not have all the 12 states. Just updated zigbee2mqtt add-on to 1.22.1-1 My switch were completely lost. I force deleted it from zigbee2mqtt, paired it again (10 seconds button 3), changed mode from dimmer to scene (6 seconds buttons 2+4), then i got all the scenes with the right action name! Good job ! 👍 |
Beta Was this translation helpful? Give feedback.
-
Thanks for all this work, my Moes version is now working and seen as a Tuya. MQTT trace on zigbee2mqtt/4 Scene buttons:
MQTT trace on zigbee2mqtt/4 Scene buttons/action:
|
Beta Was this translation helpful? Give feedback.
-
Hi, bit of a basic question here but how do I a git pull to the latest release? Cheers |
Beta Was this translation helpful? Give feedback.
-
Does anyone has a comprehensive guide to get this thing to work?? I spent just like 4 hours trying everything i could read about this "D@Mfidhdkdkd" switch. Up until the point where i can not even connect to my home assistant anymore. :) Luckily this is my testboard but still. So apparantly it is included in latest release of zigbee2mqtt. That is great. Only when the thing is added to my list i only see swicth.action and switch.battery . I am at a total loss here, i tried everything written in this thread but to no avail. i hope someone can pull the sheet from over my eyes. |
Beta Was this translation helpful? Give feedback.
-
ok i understand it now as per https://www.zigbee2mqtt.io/devices/TS004F.html#tuya-ts004f the actions are there, you just can't see them or get/set them. but you can action on them in a automation. Unfortunately, they still don't fire for me when i press a button :-( update ok got it to work. Had to switch modes 2+4 (make sure to press long enough to get the left bottom light to flash). |
Beta Was this translation helpful? Give feedback.
-
Ok now i see 2 hold actions, but still not 4. I need to figure out what the proper procedure is after/during pairing. |
Beta Was this translation helpful? Give feedback.
-
PS could anyone explain how the dimmer mode function works ? |
Beta Was this translation helpful? Give feedback.
-
What worked for me is to restart Zigbee2Mqtt then press the „reconfigure” button and start to press all the buttons of the switch (1 press, 2 presses, hold and so on). After that i can see all the triggers and also it starts to report all the data to HA (ex: battery life) |
Beta Was this translation helpful? Give feedback.
-
Hello, We're looking for someone to help investigate a delay observed on the buttons 2-3-4 on the TS004F in scenario mode (12 actions) with a CC2531 sniffer and a tuya bridge, maybe @neforce or @fringefilmsoz can help there? Thanks! |
Beta Was this translation helpful? Give feedback.
-
Can we use the switch in dimmer mode with Z2M? If I don't need double clicks or holds, it sounds like it's better to use it in dimmer mode as the click will be reported straight away instead of waiting for a potential double click (hypothetically)? |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Hi there,
Trying adding my TS004F which looks like exactly the same as TS0044. But it's not recognized well.
Let me explain;
I bought a Tuya 4 gang wireless scene button thing. Globally known as the TS0044. However mine is identified as TS004F (whut....).
I had to change my devices.js and fromZigbee.js to get it more or less working.
However, every button is identified different and does not fire any double tap/hold data.
When pressing buttons from topleft, topright, bottom left, bottom right:
So, every button is a unique action. But when i double tap, i don't see anything, no logs are incoming, even when i debug the hersman with: /opt/zigbee2mqtt DEBUG=zigbee-herdsman* npm start
What i have done to get it working so far:
Even when i change fz.command_step, fz.ewelink_action to something else, it still doesn't do anything with double tap or hold.
What to do now? I can attach simple on/off actions to these buttons. But i want to use doubletap and hold also...
Beta Was this translation helpful? Give feedback.
All reactions