Closed alexvaltchev closed 2 months ago
Your remote is not known of ZHA. It need being added in this quirk https://github.com/zigpy/zha-device-handlers/blob/dev/zhaquirks/tuya/ts0041.py in the right class that matching the signature and if its not one its need one new device lass is needed.
The switch is the GUI is because tuya have done the firmware wrongly as one light but its being fixed in the quirk then its being loaded.
Hello, I added this quirk https://github.com/zigpy/zha-device-handlers/blob/dev/zhaquirks/tuya/ts0041.py but nothing changes. The quirk does not seem to work.
Try adding to your local file that class (at the bottom of file):
class TuyaSmartRemote0041TI_Var02(TuyaSmartRemote0041TI):
"""Tuya 1-button remote device with time on in."""
signature = {
# SizePrefixedSimpleDescriptor(endpoint=1, profile=260, device_type=0x0401, input_clusters=[0, 10, 1, 6], output_clusters=[25]))
MODEL: "TS0041",
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.IAS_ANCILLARY_CONTROL,
INPUT_CLUSTERS: [
Basic.cluster_id,
PowerConfiguration.cluster_id,
OnOff.cluster_id,
Time.cluster_id,
],
OUTPUT_CLUSTERS: [Ota.cluster_id],
},
},
}
Save changes, restart HA and repair the device.
You mean to add this code to the bottom of my ts0041.py file?
Nothing has changed. I added the code, remove the device, restarted HA and added device again. No change.
Can you check if device gets the quirk? You can see it in the device info tab. Also, you can enable the debug logs during the pairing proccess and attach here?
Sorry I am noob. Where to click to get device info tab and debug log? Please give me step by step? home-assistant_2023-03-31T10-42-30.446Z.log
All we need is the "Zigbee Info" from your screenshoot. Sometime also will ask for the diagnostics from the "Download diagnostics" option. Your device is saying us that no quirk is loaded (well, it is not saying that has a quirk loaded, that is the same). You have a few errors in the HA startup. Let's try with another approach.
Remove the current version of ts0041.py
.
Copy the version from:
Save changes, delete any __pycache__
folder from your local quirk folder, restart HA and re pair the device again.
If you still get error in the HA startup, remove all the other files and test again.
I cleared the code form ts0041.ty and pasted from the link above. I added the code from https://github.com/zigpy/zha-device-handlers/issues/2314#issuecomment-1491653239 to the very bottom (I use Studio code sever) so no option to save. I belive it is saved automatically.
I checked in my quirk folder there is no pycache files. I restarted HA, removed the device and pair it again. No change
Still looks the same, nothing change. Am I doing something wrong?
Do I need to remove other .PY files? Seems like there is error with them? How do I fix it?
__pycache__
is a folder and I'm not sure if it 'shows' as a hidden folder.
Most of your quirks files have errors. You need to fix them or remove (or rename to .py_ ie).
Can you check if there are errors from the ts0041.py
file?
Hello, sorry I was not available for a few days. 1) If the pycache folder is hidded, how do I find find/delete it? I have File editor and Studio Code Server installed, but dont see "hidden" option,
What is the problem? Please help :(
I see this in the log:
Unexpected exception importing custom quirk 'ts0041' 6:29:28 PM – (ERROR) /usr/local/lib/python3.10/site-packages/zhaquirks/init.py
But not sure what it is and how to fix it?
You will have an error in the HA startup. Look for the error in the homeassistant.log file. Probably some indent or format error in the file.
Error/formating in which file ? The ts0041 ?
Here is the log: home-assistant.log /config/home-assistant.log home-assistant.log
Yes in the file that is trying to load and the only that is in the folder. Any error in the log?
Yes, here are the errors:
Yes, here are the errors:
And?
Have you read what is saying the error?
File "/config/custom_zha_quirks/ts0041.py", line 185
And:
IndentationError: expected an indented block after class definition on line 184
You can check your /config/custom_zha_quirks/ts0041.py
at line 185 and will see that the comment is not indented as the proposed from the previous comment:
https://github.com/zigpy/zha-device-handlers/issues/2314#issuecomment-1491653239
Yes I read is line 185. It is a comment "- """Tuya 1-button remote device with time on in."""
I removed it and now shows 186. The indentation seems good. Here is a screenshot
"""Tuya 1-button remote device with time on in."""
signature = {
# SizePrefixedSimpleDescriptor(endpoint=1, profile=260, device_type=0x0401, input_clusters=[0, 10, 1, 6], output_clusters=[25]))
MODEL: "TS0041",
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.IAS_ANCILLARY_CONTROL,
INPUT_CLUSTERS: [
Basic.cluster_id,
PowerConfiguration.cluster_id,
OnOff.cluster_id,
Time.cluster_id,
],
OUTPUT_CLUSTERS: [Ota.cluster_id],
},
},
}
This is the whole .PY file:
"""Tuya 1 Button Remote."""
from zigpy.profiles import zha
from zigpy.quirks import CustomDevice
from zigpy.zcl.clusters.general import Basic, OnOff, Ota, PowerConfiguration, Time
from zhaquirks.const import (
BUTTON_1,
COMMAND,
DEVICE_TYPE,
DOUBLE_PRESS,
ENDPOINT_ID,
ENDPOINTS,
INPUT_CLUSTERS,
LONG_PRESS,
MODEL,
OUTPUT_CLUSTERS,
PROFILE_ID,
SHORT_PRESS,
)
from zhaquirks.tuya import TuyaSmartRemoteOnOffCluster, TuyaZBE000Cluster
class TuyaSmartRemote0041TO(CustomDevice):
"""Tuya 1-button remote device with time on out."""
signature = {
# SizePrefixedSimpleDescriptor(endpoint=1, profile=260, device_type=0, device_version=1, input_clusters=[0, 1, 6], output_clusters=[25, 10])
MODEL: "TS0041",
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.ON_OFF_SWITCH,
INPUT_CLUSTERS: [
Basic.cluster_id,
PowerConfiguration.cluster_id,
OnOff.cluster_id,
],
OUTPUT_CLUSTERS: [Ota.cluster_id, Time.cluster_id],
},
},
}
replacement = {
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.REMOTE_CONTROL,
INPUT_CLUSTERS: [
Basic.cluster_id,
PowerConfiguration.cluster_id,
TuyaSmartRemoteOnOffCluster,
],
OUTPUT_CLUSTERS: [Ota.cluster_id, Time.cluster_id],
},
},
}
device_automation_triggers = {
(SHORT_PRESS, BUTTON_1): {ENDPOINT_ID: 1, COMMAND: SHORT_PRESS},
(LONG_PRESS, BUTTON_1): {ENDPOINT_ID: 1, COMMAND: LONG_PRESS},
(DOUBLE_PRESS, BUTTON_1): {ENDPOINT_ID: 1, COMMAND: DOUBLE_PRESS},
}
class TuyaSmartRemote0041TI(CustomDevice):
"""Tuya 1-button remote device with time on in."""
signature = {
# SizePrefixedSimpleDescriptor(endpoint=1, profile=260, device_type=0, device_version=1, input_clusters=[0, 10, 1, 6], output_clusters=[25]))
MODEL: "TS0041",
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.ON_OFF_SWITCH,
INPUT_CLUSTERS: [
Basic.cluster_id,
PowerConfiguration.cluster_id,
OnOff.cluster_id,
Time.cluster_id,
],
OUTPUT_CLUSTERS: [Ota.cluster_id],
},
},
}
replacement = {
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.REMOTE_CONTROL,
INPUT_CLUSTERS: [
Basic.cluster_id,
PowerConfiguration.cluster_id,
TuyaSmartRemoteOnOffCluster,
Time.cluster_id,
],
OUTPUT_CLUSTERS: [Ota.cluster_id],
},
},
}
device_automation_triggers = {
(SHORT_PRESS, BUTTON_1): {ENDPOINT_ID: 1, COMMAND: SHORT_PRESS},
(LONG_PRESS, BUTTON_1): {ENDPOINT_ID: 1, COMMAND: LONG_PRESS},
(DOUBLE_PRESS, BUTTON_1): {ENDPOINT_ID: 1, COMMAND: DOUBLE_PRESS},
}
class TuyaSmartRemote0041TOPlusA(CustomDevice):
"""Tuya 1-button remote device with time on out cluster."""
signature = {
# SizePrefixedSimpleDescriptor(endpoint=1, profile=260, device_type=0, device_version=1, input_clusters=[0, 1, 6, 57344], output_clusters=[10, 25]))
# SizePrefixedSimpleDescriptor(endpoint=2, profile=260, device_type=0, device_version=1, input_clusters=[1, 6], output_clusters=[])
# SizePrefixedSimpleDescriptor(endpoint=3, profile=260, device_type=0, device_version=1, input_clusters=[1, 6], output_clusters=[])
# SizePrefixedSimpleDescriptor(endpoint=4, profile=260, device_type=0, device_version=1, input_clusters=[1, 6], output_clusters=[])
MODEL: "TS0041",
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.ON_OFF_SWITCH,
INPUT_CLUSTERS: [
Basic.cluster_id,
PowerConfiguration.cluster_id,
OnOff.cluster_id,
TuyaZBE000Cluster.cluster_id,
],
OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
},
2: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.ON_OFF_SWITCH,
INPUT_CLUSTERS: [
PowerConfiguration.cluster_id,
OnOff.cluster_id,
],
OUTPUT_CLUSTERS: [],
},
3: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.ON_OFF_SWITCH,
INPUT_CLUSTERS: [
PowerConfiguration.cluster_id,
OnOff.cluster_id,
],
OUTPUT_CLUSTERS: [],
},
4: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.ON_OFF_SWITCH,
INPUT_CLUSTERS: [
PowerConfiguration.cluster_id,
OnOff.cluster_id,
],
OUTPUT_CLUSTERS: [],
},
},
}
replacement = {
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.ON_OFF_SWITCH,
INPUT_CLUSTERS: [
Basic.cluster_id,
PowerConfiguration.cluster_id,
TuyaZBE000Cluster,
],
OUTPUT_CLUSTERS: [
Time.cluster_id,
Ota.cluster_id,
TuyaSmartRemoteOnOffCluster,
],
},
},
}
device_automation_triggers = {
(SHORT_PRESS, BUTTON_1): {ENDPOINT_ID: 1, COMMAND: SHORT_PRESS},
(LONG_PRESS, BUTTON_1): {ENDPOINT_ID: 1, COMMAND: LONG_PRESS},
(DOUBLE_PRESS, BUTTON_1): {ENDPOINT_ID: 1, COMMAND: DOUBLE_PRESS},
}
class TuyaSmartRemote0041TI_Var02(TuyaSmartRemote0041TI):
"""Tuya 1-button remote device with time on in."""
signature = {
# SizePrefixedSimpleDescriptor(endpoint=1, profile=260, device_type=0x0401, input_clusters=[0, 10, 1, 6], output_clusters=[25]))
MODEL: "TS0041",
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.IAS_ANCILLARY_CONTROL,
INPUT_CLUSTERS: [
Basic.cluster_id,
PowerConfiguration.cluster_id,
OnOff.cluster_id,
Time.cluster_id,
],
OUTPUT_CLUSTERS: [Ota.cluster_id],
},
},
}
I was able to load the quirk finally. Here it is:
However, there is nothing showing. I clicked the button and there is no Logbook. Maybe the quirk is no good? What do I do from now on? Thanks
Enable the debug logs (you can do it from the 3 dots next to the "RECONFIGURE" button). Once enabled, press the physicals buttons (click, double,...) . When you hit the stop debug logs a file will be downloaded. Attach it here.
I dont see "Debug log" When I click the 3 dots I get this:
Here is Download diagnostics
I rename it to "Office white round button" and made automation, even that there is no such entity for the button (how weird). There is no blueprint that I could find so I made manual automation and it works.
@Drmatterpl Wish IP-class is you needing ? If PI44 is enough use IKEA RODRET (OnOff is released and OpenClose and Shortcut is on the way) and is Zigbee certificated = dont need any quirks for working OK and is very likely getting firmware updates to new Zigbee standard ZCL R9,
I deleted the post before I saw your response, in fact all was good - I followed the instructions above and the button works as expected. I need this remote to open a gate-door (release electric lock) - it will be mounted on the fance - totally outside, IP44 is not enough. My wife also wants to be able to turn on the lights in backyard with it.
Now we have it all working - thanks to you !!!
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
I purchase this button from AliExpress: https://www.aliexpress.com/item/1005003711313613.html?spm=a2g0o.order_list.order_list_main.30.83f91802xjGrTT and I am trying to make it work in HA. It works with Tuya as 3 functions.
My HA system has both ZHA and MQTT running in parallel and I tried both.
ZHA recognize it as switch, even after adding a custom quirk ts0041.py - https://github.com/zigpy/zha-device-handlers/pull/957/commits/cdf38b4e3c8b7796239b3848347e7eb77144a013
When clicked nothing registers in the logbook.
I then tried with Zigbee2MQTT and it works better there.
In the logbook it shows all (single click, double click and click hold), all 3 states.
Since it comes as this device - https://www.zigbee2mqtt.io/devices/TS0041.html I tried this Blueprint - https://community.home-assistant.io/t/zigbee2mqtt-1-button-scene-switch-ts0041/475324
I set up everything from the Blueprint as it should but when I clicked, nothing happens.
I also check this - https://zigbee.blakadder.com/Tuya_TS0041.html where is says it works with ZHA, but is a different photo, not the one I have. But the model shows as TS0041 by _TZ3000_3oitjgaa
Describe the solution you'd like I need a quirk for ZHA or MQTT to make this button works in all 3 states. Maybe another blueprint since this does not seem to work.
Device signature
```yaml Paste the device signature here. Don't remove the extra line breaks outside the ``` { "node_descriptor": "NodeDescriptor(logical_type=[mqtt-940e4d82963367913f262015136efa0e-Smart button white round-aa41b106c091fd6554c096c3a4cc6d4e.json.txt](https://github.com/zigpy/zha-device-handlers/files/11120123/mqtt-940e4d82963367913f262015136efa0e-Smart.button.white.round-aa41b106c091fd6554c096c3a4cc6d4e.json.txt)
[zha-1be608adfd5dabaaecaf06df5a0aa201-_TZ3000_3oitjgaa TS0041-573e8ab03fa904085f1a51c5d7d72978.json.txt](https://github.com/zigpy/zha-device-handlers/files/11120178/zha-1be608adfd5dabaaecaf06df5a0aa201-_TZ3000_3oitjgaa.TS0041-573e8ab03fa904085f1a51c5d7d72978.json.txt)
```yaml Paste the diagnostic information here. Don't remove the extra line breaks outside the ``` marks. ```Additional logs
``` Paste any additional debug logs here. Don't remove the extra line breaks outside the ``` marks. ```Additional context Add any other context or screenshots about the feature request here.