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] TS0601 _TZE204_upagmta9 Tuya outdoor temperature and humidity sensor #2694

Open
raven4is opened this issue Nov 1, 2023 · 95 comments · May be fixed by #3709
Open

[Device Support Request] TS0601 _TZE204_upagmta9 Tuya outdoor temperature and humidity sensor #2694

raven4is opened this issue Nov 1, 2023 · 95 comments · May be fixed by #3709
Labels
Tuya Request/PR regarding a Tuya device

Comments

@raven4is
Copy link

raven4is commented Nov 1, 2023

Problem description

No values recognized

Device info
TS0601
by _TZE204_upagmta9
Zigbee info
IEEE: a4:c1:38:74:06:b0:2c:89
Nwk: 0x2aff
Device Type: EndDevice
LQI: 192
RSSI: -52
Last Seen: 2023-11-01T13:11:52
Power Source: Battery or Unknown

Solution description

How can i get or make a custom quirk for this device?

Screenshots/Video

zigbee_204

Screenshots/Video

[Paste/upload your media here]

Device signature

Device signature
{
  "node_descriptor": "NodeDescriptor(logical_type=<LogicalType.EndDevice: 2>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.AllocateAddress: 128>, manufacturer_code=4417, maximum_buffer_size=66, maximum_incoming_transfer_size=66, server_mask=10752, maximum_outgoing_transfer_size=66, descriptor_capability_field=<DescriptorCapability.NONE: 0>, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=True, *is_full_function_device=False, *is_mains_powered=False, *is_receiver_on_when_idle=False, *is_router=False, *is_security_capable=False)",
  "endpoints": {
    "1": {
      "profile_id": "0x0104",
      "device_type": "0x0051",
      "input_clusters": [
        "0x0000",
        "0x0004",
        "0x0005",
        "0xef00"
      ],
      "output_clusters": [
        "0x000a",
        "0x0019"
      ]
    }
  },
  "manufacturer": "_TZE204_upagmta9",
  "model": "TS0601",
  "class": "zigpy.device.Device"
}

Diagnostic information

Diagnostic information
{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2023.10.5",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.11.5",
    "docker": true,
    "arch": "aarch64",
    "timezone": "Europe/Bucharest",
    "os_name": "Linux",
    "os_version": "6.1.21-v8",
    "supervisor": "2023.10.1",
    "host_os": "Home Assistant OS 11.1",
    "docker_version": "24.0.6",
    "chassis": "embedded",
    "run_as_root": true
  },
  "custom_components": {
    "browser_mod": {
      "version": "2.3.0",
      "requirements": []
    },
    "hacs": {
      "version": "1.32.1",
      "requirements": [
        "aiogithubapi>=22.10.1"
      ]
    },
    "lovelace_gen": {
      "version": "0.1.1",
      "requirements": [
        "jinja2"
      ]
    },
    "fusion_solar_kiosk": {
      "version": "3.0.6",
      "requirements": []
    },
    "scheduler": {
      "version": "v0.0.0",
      "requirements": []
    }
  },
  "integration_manifest": {
    "domain": "zha",
    "name": "Zigbee Home Automation",
    "after_dependencies": [
      "onboarding",
      "usb"
    ],
    "codeowners": [
      "@dmulcahey",
      "@adminiuga",
      "@puddly"
    ],
    "config_flow": true,
    "dependencies": [
      "file_upload"
    ],
    "documentation": "https://www.home-assistant.io/integrations/zha",
    "iot_class": "local_polling",
    "loggers": [
      "aiosqlite",
      "bellows",
      "crccheck",
      "pure_pcapy3",
      "zhaquirks",
      "zigpy",
      "zigpy_deconz",
      "zigpy_xbee",
      "zigpy_zigate",
      "zigpy_znp",
      "universal_silabs_flasher"
    ],
    "requirements": [
      "bellows==0.36.5",
      "pyserial==3.5",
      "pyserial-asyncio==0.6",
      "zha-quirks==0.0.105",
      "zigpy-deconz==0.21.1",
      "zigpy==0.57.2",
      "zigpy-xbee==0.18.3",
      "zigpy-zigate==0.11.0",
      "zigpy-znp==0.11.6",
      "universal-silabs-flasher==0.0.14",
      "pyserial-asyncio-fast==0.11"
    ],
    "usb": [
      {
        "vid": "10C4",
        "pid": "EA60",
        "description": "*2652*",
        "known_devices": [
          "slae.sh cc2652rb stick"
        ]
      },
      {
        "vid": "1A86",
        "pid": "55D4",
        "description": "*sonoff*plus*",
        "known_devices": [
          "sonoff zigbee dongle plus v2"
        ]
      },
      {
        "vid": "10C4",
        "pid": "EA60",
        "description": "*sonoff*plus*",
        "known_devices": [
          "sonoff zigbee dongle plus"
        ]
      },
      {
        "vid": "10C4",
        "pid": "EA60",
        "description": "*tubeszb*",
        "known_devices": [
          "TubesZB Coordinator"
        ]
      },
      {
        "vid": "1A86",
        "pid": "7523",
        "description": "*tubeszb*",
        "known_devices": [
          "TubesZB Coordinator"
        ]
      },
      {
        "vid": "1A86",
        "pid": "7523",
        "description": "*zigstar*",
        "known_devices": [
          "ZigStar Coordinators"
        ]
      },
      {
        "vid": "1CF1",
        "pid": "0030",
        "description": "*conbee*",
        "known_devices": [
          "Conbee II"
        ]
      },
      {
        "vid": "10C4",
        "pid": "8A2A",
        "description": "*zigbee*",
        "known_devices": [
          "Nortek HUSBZB-1"
        ]
      },
      {
        "vid": "0403",
        "pid": "6015",
        "description": "*zigate*",
        "known_devices": [
          "ZiGate+"
        ]
      },
      {
        "vid": "10C4",
        "pid": "EA60",
        "description": "*zigate*",
        "known_devices": [
          "ZiGate"
        ]
      },
      {
        "vid": "10C4",
        "pid": "8B34",
        "description": "*bv 2010/10*",
        "known_devices": [
          "Bitron Video AV2010/10"
        ]
      }
    ],
    "zeroconf": [
      {
        "type": "_esphomelib._tcp.local.",
        "name": "tube*"
      },
      {
        "type": "_zigate-zigbee-gateway._tcp.local.",
        "name": "*zigate*"
      },
      {
        "type": "_zigstar_gw._tcp.local.",
        "name": "*zigstar*"
      },
      {
        "type": "_uzg-01._tcp.local.",
        "name": "uzg-01*"
      },
      {
        "type": "_slzb-06._tcp.local.",
        "name": "slzb-06*"
      }
    ],
    "is_built_in": true
  },
  "data": {
    "ieee": "**REDACTED**",
    "nwk": 11007,
    "manufacturer": "_TZE204_upagmta9",
    "model": "TS0601",
    "name": "_TZE204_upagmta9 TS0601",
    "quirk_applied": false,
    "quirk_class": "zigpy.device.Device",
    "manufacturer_code": 4417,
    "power_source": "Battery or Unknown",
    "lqi": 192,
    "rssi": -52,
    "last_seen": "2023-11-01T13:15:58",
    "available": true,
    "device_type": "EndDevice",
    "signature": {
      "node_descriptor": "NodeDescriptor(logical_type=<LogicalType.EndDevice: 2>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.AllocateAddress: 128>, manufacturer_code=4417, maximum_buffer_size=66, maximum_incoming_transfer_size=66, server_mask=10752, maximum_outgoing_transfer_size=66, descriptor_capability_field=<DescriptorCapability.NONE: 0>, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=True, *is_full_function_device=False, *is_mains_powered=False, *is_receiver_on_when_idle=False, *is_router=False, *is_security_capable=False)",
      "endpoints": {
        "1": {
          "profile_id": "0x0104",
          "device_type": "0x0051",
          "input_clusters": [
            "0x0000",
            "0x0004",
            "0x0005",
            "0xef00"
          ],
          "output_clusters": [
            "0x000a",
            "0x0019"
          ]
        }
      },
      "manufacturer": "_TZE204_upagmta9",
      "model": "TS0601"
    },
    "active_coordinator": false,
    "entities": [
      {
        "entity_id": "sensor.tze204_upagmta9_ts0601_rssi",
        "name": "_TZE204_upagmta9 TS0601"
      },
      {
        "entity_id": "sensor.tze204_upagmta9_ts0601_lqi",
        "name": "_TZE204_upagmta9 TS0601"
      }
    ],
    "neighbors": [],
    "routes": [],
    "endpoint_names": [
      {
        "name": "SMART_PLUG"
      }
    ],
    "user_given_name": null,
    "device_reg_id": "f617a18abfa66229233f67c4d981d85f",
    "area_id": null,
    "cluster_details": {
      "1": {
        "device_type": {
          "name": "SMART_PLUG",
          "id": 81
        },
        "profile_id": 260,
        "in_clusters": {
          "0x0004": {
            "endpoint_attribute": "groups",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0x0005": {
            "endpoint_attribute": "scenes",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0xef00": {
            "endpoint_attribute": null,
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0x0000": {
            "endpoint_attribute": "basic",
            "attributes": {
              "0x0001": {
                "attribute_name": "app_version",
                "value": 73
              },
              "0x0004": {
                "attribute_name": "manufacturer",
                "value": "_TZE204_upagmta9"
              },
              "0x0005": {
                "attribute_name": "model",
                "value": "TS0601"
              }
            },
            "unsupported_attributes": {}
          }
        },
        "out_clusters": {
          "0x0019": {
            "endpoint_attribute": "ota",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0x000a": {
            "endpoint_attribute": "time",
            "attributes": {},
            "unsupported_attributes": {}
          }
        }
      }
    }
  }
}

Logs

Logs
Logger: zigpy.zcl
Source: runner.py:186
First occurred: 13:05:38 (5 occurrences)
Last logged: 13:13:56

[0x2AFF:1:0xef00] Unknown cluster command 17 b'\x00\x03@'

Custom quirk

Custom quirk
[Paste your custom quirk here]

Additional information

https://www.aliexpress.com/item/1005005627336725.html
Zigbee Version
I tried some quirks but with no help.
Can someone help me?

@TheJulianJES TheJulianJES added the Tuya Request/PR regarding a Tuya device label Nov 1, 2023
@benoitm974
Copy link

It seems not the be working either on zigbeeMQTT, there might be some aspect of the protocol missing at pairing, trying to get element from snifing protocol here : Koenkk/zigbee2mqtt#19137

@raven4is
Copy link
Author

raven4is commented Nov 3, 2023

@benoitm974 Seems lit a batch that beside the problems with zigbee information transmission, they have huge problems with battery time, or maybe because it tries to send information to gateway to often, the battery just goes dead in 12h.

@benoitm974
Copy link

No in fact the device uses tuya specific protocol, the device works well when use with their gateway and Tuya app and don't have battery issue. The problem exists in both zigbee2mqtt and ZHA where the current code doesn't follow the tuya protocol after pairing the device stay "locked" in a waiting for answer state where it doesn't update the screen info nor send any data and consume all the battery in 12 to 24h...
In the zigbee2mqtt forum I attached a capture of the tuya sequence, where we can see:

  • the tuya send a "reset" command at pairing
  • also send a command 3 and 10 to the device
  • and lastly reply wuccess to device command 11, which seems to be the expected command for the sensors to go to sleep and start updateing screen and sending zigbee values

@darknessblade
Copy link

I have a similar issue with a device that has the same specification/ID

_TZE204_upagmta9 TS0601
Aliexpress Item page [ordered the item trough the 3=5.99$ sale]
https://aliexpress.com/item/1005006030373016.html?

For me it does not show ANY entities at all

@raven4is
Copy link
Author

Hello! For this sensors as a temporary sollution i added a wifi zigbee gateway and used tuya integration for them.

They do eat batteries if not communicating good with ha integration.

I wait for news when they cand be integrated locally. :(

@darknessblade
Copy link

Hello! For this sensors as a temporary sollution i added a wifi zigbee gateway and used tuya integration for them.

They do eat batteries if not communicating good with ha integration.

I wait for news when they cand be integrated locally. :(

Soo they are worse than "for example"
https://aliexpress.com/item/1005005352101380.html?
If all you would need is the temperature+ humidity

I bought one as a test, but might return/see if I can get a refund for it, if there is no probable fix in the next few days.

Since its a choice store getting a refund is quite easy.

@raven4is
Copy link
Author

I wanted with display, i suppose will be a while until this model will be added to the fully supported devices,
I saw some people had luck with zigbee2mqtt. So they are not worse, they are not yet supported but they have the capability to be as good.

@thubalek
Copy link

It looks like devs from zigbee2mqtt made it working (Koenkk/zigbee2mqtt#19137 (comment))

@benoitm974
Copy link

Indeed after sniffing zigbee traffic and debuging @Koenkk found the race condition preventi the 0xef00 / 0x03 command sent just after the sensors join the network which was keeping the device in a loop mode... If any one with experience on zha code can point in the right directtion for sending command when sensor joint I'm open to try/look into it.

@dhruvinsh
Copy link

dhruvinsh commented Nov 16, 2023

I manage to get something on dashboard for ZTH05

If any one with experience on zha code can point in the right directtion for sending command when sensor joint I'm open to try/look into it.

correct file path would be, zhaquirks/tuya/ts0601_sensor.py, more specifically line 248 code. Not entirely sure, everything is fairly new for me.

image

@benoitm974
Copy link

The question is not which definition to use, since either V03 or V04 would work, the issue is how to have ZHA to send a custom tuya command on joining to get the sensor to start sending data on regular interval and to sleep in between.

@phormix
Copy link

phormix commented Nov 22, 2023

Sounds like I should just pull the battery from mine until this is resolved.

Can anyone recommend a temperature sensor that does work properly?

@benoitm974
Copy link

I use these working ok but no screen, and you need to provide the 2 AAA batteries.
https://fr.aliexpress.com/item/1005006022905558.html?spm=a2g0o.order_list.order_list_main.97.21ef5e5bIqwGzC&gatewayAdapt=glo2fra

@tokkeherfst
Copy link

I also have a couple of these that are quite useless in ZHA... is anyone working on a fix please?

@slimninja
Copy link

slimninja commented Dec 15, 2023

Adding my support to merge the same fix from zigbee2mqtt which looks like it will be deployed Jan 1st:
Koenkk/zigbee2mqtt#19137

@SmarthomeBot
Copy link

Anyone please? Would be nice to have them in ZHA because they are cheap, have a display and natively have zigbee. The people who buy these are mostly the ones who have bricked a LYWSD03MMC and are looking for something with native zigbee.

@sapstar
Copy link

sapstar commented Jan 15, 2024

I have the same one and can't get it working.

@eddietheeagle7
Copy link

Same for me, can't get it working.

@VitalyKVV
Copy link

Same for me. I have such devices and they don't work with ZHA.

@marcoaureliovaz
Copy link

Hello! The correct model for this device seems to be ZTH05
317738231-751844634

I'm having same issues. Identified as a different device and no entities.

Screenshot_20240121-212037

@RoboKaren
Copy link

Hello! The correct model for this device seems to be ZTH05 317738231-751844634

I'm having same issues. Identified as a different device and no entities.

Screenshot_20240121-212037

I suppose the question is whether there is a way to force the real identity onto devices that list a fake identity.

@sweetpants
Copy link

@marcoaureliovaz, i'm seeinig the exact same on my ZHA installation

@marcoaureliovaz
Copy link

Screenshot_20240123-104301

I tried some time with ZHA but it didn't work and the "pairing" seemed not to conclude... (After pairing, the logs were always bringing new messages and at the device, low battery icon active)

ZigBee2MQTT
Then I flashed my Sonoff Dongle-E to MultiPAN with that Webflasher, installed Mosquitto, Z2M Edge and now it's correctly recognized and working great.
Frequent updates during increase/decrease of temperature/humidity. Battery info is reliable.

@TheJulianJES
Copy link
Collaborator

TheJulianJES commented Jan 30, 2024

With the next HA version 2024.2.0 beta (releasing 2024/01/31), you can try to send the "Tuya query data" command through the clusters menu UI if the manufacturer cluster is added using a quirk.

Copying my answer from Discord:
#2940 and #2888 added support for the "query data" command (0x03).
So, with the next HA version, it should be relatively simple to make a quirk for that device. You can likely use zigpy/quirk-generator to generate a stub quirk, replace CustomDevice with the Tuya EnchantedDevice implementation.
That'll send Tuya specific commands during pairing. But you'll also need to set tuya_spell_data_query = True to send the new 0x03 / query data command (like seen in #2940) during pairing/reconfiguration (and then pair/reconfigure).

That way, no manual command sending would be involved.

@benoitm974
Copy link

With the next HA version 2024.2.0 beta (releasing 2024/01/31), you can try to send the "Tuya query data" command through the clusters menu UI if the manufacturer cluster is added using a quirk.

Copying my answer from Discord: #2940 and #2888 added support for the "query data" command (0x03). So, with the next HA version, it should be relatively simple to make a quirk for that device. You can likely use zigpy/quirk-generator to generate a stub quirk, replace CustomDevice with the Tuya EnchantedDevice implementation. That'll send Tuya specific commands during pairing. But you'll also need to set tuya_spell_data_query = True to send the new 0x03 / query data command (like seen in #2940) during pairing/reconfiguration (and then pair/reconfigure).

That way, no manual command sending would be involved.

Thanks @TheJulianJES so much!
So it means from the existing quirks https://github.com/zigpy/zha-device-handlers/blob/dev/zhaquirks/tuya/ts0601_sensor.py

We could on create a new 05 variation and then

A Add the import "EnchantedDevice"
-> from zhaquirks.tuya.mcu import DPToAttributeMapping, TuyaMCUCluster, EnchantedDevice

B Add the variation this way`

`
class TuyaTempHumiditySensorVar05(EnchantedDevice):
"""Tuya temp and humidity sensor (variation 05)."""
tuya_spell_data_query = True

signature = {
    # "profile_id": 260,
    # "device_type": "0x0051",
    # "in_clusters": ["0x0000","0x0004","0x0005","0xef00"],
    # "out_clusters": ["0x000a","0x0019"]
    MODELS_INFO: [
        ("_TZE204_upagmta9", "TS0601"),
    ],
    ENDPOINTS: {
        1: {
            PROFILE_ID: zha.PROFILE_ID,
            DEVICE_TYPE: zha.DeviceType.SMART_PLUG,
            INPUT_CLUSTERS: [
                Basic.cluster_id,
                Groups.cluster_id,
                Scenes.cluster_id,
                TemperatureHumidityManufCluster.cluster_id,
            ],
            OUTPUT_CLUSTERS: [Ota.cluster_id, Time.cluster_id],
        }
    },
}

replacement = {
    SKIP_CONFIGURATION: True,
    ENDPOINTS: {
        1: {
            DEVICE_TYPE: zha.DeviceType.TEMPERATURE_SENSOR,
            INPUT_CLUSTERS: [
                Basic.cluster_id,
                Groups.cluster_id,
                Scenes.cluster_id,
                TemperatureHumidityBatteryStatesManufCluster,
                TuyaTemperatureMeasurement,
                TuyaRelativeHumidity,
                TuyaPowerConfigurationCluster2AAA,
            ],
            OUTPUT_CLUSTERS: [Ota.cluster_id, Time.cluster_id],
        }
    },
}`

@domusonline
Copy link

With the next HA version 2024.2.0 beta (releasing 2024/01/31), you can try to send the "Tuya query data" command through the clusters menu UI if the manufacturer cluster is added using a quirk.
Copying my answer from Discord: #2940 and #2888 added support for the "query data" command (0x03). So, with the next HA version, it should be relatively simple to make a quirk for that device. You can likely use zigpy/quirk-generator to generate a stub quirk, replace CustomDevice with the Tuya EnchantedDevice implementation. That'll send Tuya specific commands during pairing. But you'll also need to set tuya_spell_data_query = True to send the new 0x03 / query data command (like seen in #2940) during pairing/reconfiguration (and then pair/reconfigure).
That way, no manual command sending would be involved.

Thanks @TheJulianJES so much! So it means from the existing quirks https://github.com/zigpy/zha-device-handlers/blob/dev/zhaquirks/tuya/ts0601_sensor.py

We could on create a new 05 variation and then

A Add the import "EnchantedDevice" -> from zhaquirks.tuya.mcu import DPToAttributeMapping, TuyaMCUCluster, EnchantedDevice

B Add the variation this way`

Sorry.... But I have the same issue and after looking at this thread I got the quirk indicated and made the suggested changes. It picked up that quirk and I get the identities for humidity and temperature which I didn't have before. But they have no values.
Am I missing some step or will this just work in the upcoming versions?

Thank you.

@benoitm974
Copy link

With the next HA version 2024.2.0 beta (releasing 2024/01/31), you can try to send the "Tuya query data" command through the clusters menu UI if the manufacturer cluster is added using a quirk.
Copying my answer from Discord: #2940 and #2888 added support for the "query data" command (0x03). So, with the next HA version, it should be relatively simple to make a quirk for that device. You can likely use zigpy/quirk-generator to generate a stub quirk, replace CustomDevice with the Tuya EnchantedDevice implementation. That'll send Tuya specific commands during pairing. But you'll also need to set tuya_spell_data_query = True to send the new 0x03 / query data command (like seen in #2940) during pairing/reconfiguration (and then pair/reconfigure).
That way, no manual command sending would be involved.

Thanks @TheJulianJES so much! So it means from the existing quirks https://github.com/zigpy/zha-device-handlers/blob/dev/zhaquirks/tuya/ts0601_sensor.py
We could on create a new 05 variation and then
A Add the import "EnchantedDevice" -> from zhaquirks.tuya.mcu import DPToAttributeMapping, TuyaMCUCluster, EnchantedDevice
B Add the variation this way`

Sorry.... But I have the same issue and after looking at this thread I got the quirk indicated and made the suggested changes. It picked up that quirk and I get the identities for humidity and temperature which I didn't have before. But they have no values. Am I missing some step or will this just work in the upcoming versions?

Thank you.

Only changing the quirk will not be enough until this is relaeased or you ensure to get the beta version install and test the new quirk...

@domusonline
Copy link

Only changing the quirk will not be enough until this is relaeased or you ensure to get the beta version install and test the new quirk...

Thank you very much for the promptly reply. I'll wait until this is changed... I don't usually install beta versions of HA because I don't have a "test" system. But I'll keep an eye on this.
Regards.

@Peketr
Copy link

Peketr commented Nov 6, 2024

As this quirk seems to work, @Peketr do you want to create a pull request? Then this fix could find its way into HA by default. Over in #2854 it also seems to work.

Well I was thinking about cleaning it up for a PR but 2024.11.0 changes how the ts0601_sensors are handled(YAY), and I have no idea how to hack it into that implementation.
For anyone looking I have updated the file so the quirk file works again, but I'm not sure I have the capacity to make it "mergeable"

@WeterPeter
Copy link

As this quirk seems to work, @Peketr do you want to create a pull request? Then this fix could find its way into HA by default. Over in #2854 it also seems to work.

Well I was thinking about cleaning it up for a PR but 2024.11.0 changes how the ts0601_sensors are handled(YAY), and I have no idea how to hack it into that implementation. For anyone looking I have updated the file so the quirk file works again, but I'm not sure I have the capacity to make it "mergeable"

And this got them working again after my HA 11.0 update. 😀

Thank you! 👍🏻

@delyriand
Copy link

delyriand commented Nov 14, 2024

Hi @Peketr,

Your script for Tuya works for temperature sensor but not humidity sensor on my side.
and, for another sensor, I don't have any of the temperature and humidity sensors
Do you know why?

Anyway, thanks for the work!

--

Edit: after restarting HA again, I have the 2 sensors. Thanks for the work @Peketr

@Bhoft
Copy link

Bhoft commented Nov 21, 2024

@Peketr the quirk works perfectly on my ZTH05.
All sensors can be read out (temperature, pressure and battery).

edit: i have to add this remark,
I always have to restart HA after adding the device. Without the restart the device don't have the additional sensors. Don't know if this has something to do that a quirk is used and this will be fixed when the change request is done in the source files.

@dn-gt
Copy link

dn-gt commented Dec 2, 2024

I have ordered this device from Ali Express, identifying as TS0601 / _TZE200_qrztc3ev and tried to implement the quirk. However, it didn't bring any benefit and I was also not seeing the quirk has been considered, so I checked it and TZE200_qrztc3ev was missing in the file. I tried to add it, restarted HA, tried to add the device again in ZHA and now I'm getting valid temperature information but wrong humidity (5.4% instead of 50%).

image

Could it be that I added it to the wrong section in the quirk file? Which is the right one?

image

@tkkost
Copy link

tkkost commented Dec 10, 2024

TS0601 / _TZE200_qrztc3ev

Were you able to find a solution for this sensor? I received the same one the other day. And I don't receive any information from it.

@Mape24
Copy link

Mape24 commented Dec 11, 2024

@atus42 - Your patch works for my TS0601 / _TZE204_upagmta9 with friendly name "ZTH05".
configuration.yaml:

zha:
  enable_quirks: true
  custom_quirks_path: /config/custom_zha_quirks/

Thank you so much!

@ulipo
Copy link

ulipo commented Dec 12, 2024

Also working here with ts0601_sensor.TuyaTempHumiditySensorVar05, at the beginning there were no sensors, just needed to restart HA once after pairing to get them to show.

immagine

@FranzTen
Copy link

FranzTen commented Dec 13, 2024

Hello
haven t tried it a long time, just read the mails ;-)
today i searched how to use a quirk
i found this here what helped me
https://community.home-assistant.io/t/how-to-setup-local-zha-quirks/341226
The steps as I understand them:

Create a custom quirk dir in HA, e.g., /config/custom_zha_quirks
In configuration.yaml, point to this directory:

zha:
custom_quirks_path: /config/custom_zha_quirks/

in this directory, create the python file with content of the quirk

ok i have changed my configuration.yaml
like this here:
zha:
enable_quirks: true
custom_quirks_path: /config/custom_zha_quirks/

this is the new quirks file to copy
https://github.com/Peketr/zha-device-handlers/blob/Peketr-patch-zht05/zhaquirks/tuya/ts0601_sensor.py

in this folder, after i have made them?!
zhaquirks/tuya/ts0601_sensor.py

but this folder is different to
config/custom_zha_quirks/

so i copied the file ts0601_sensor.py
into the folder custom_zha_quirks/ts0601_sensor.py

after this all other zha tools doesn t exist any more
for the moment too difficult for me, have to read some more, no video in the web?

@prairiesnpr
Copy link
Collaborator

prairiesnpr commented Dec 13, 2024

Well I was thinking about cleaning it up for a PR but 2024.11.0 changes how the ts0601_sensors are handled(YAY), and I have no idea how to hack it into that implementation.

You just need to create a subclass of TuyaQuirkBuilder and then override add_to_registry, replacing TuyaMCUCluster with your version. See

def add_to_registry(self) -> QuirksV2RegistryEntry:

I don't know how often this pattern shows up, if it's often enough, we could just add it as a parameter to add_to_registry.

@FranzTen
Copy link

sorry, i don t understand what i have to do now,
i am 63 and not a programmer,
i have model ZTH05

i thought i change my configuration.yaml
and copy the quirk: ts0601_sensor.py to a special folder

i have changed my configuration.yaml

zha:
enable_quirks: true
custom_quirks_path: /config/custom_zha_quirks/

i have build the folder
/config/custom_zha_quirks/
and put in the file
ts0601_sensor.py

/config/custom_zha_quirks/ts0601_sensor.py

@Mape24
Copy link

Mape24 commented Dec 14, 2024

Hi @FranzTen yes, that's what I did, and it works for me. The name of the folder doesn't matter - it has to match the definition in config.yaml

I think your next steps would be checking the log files and diagnosis data. Possibly you don't have _TZE204_upagmta9 but anything else inside.

@prairiesnpr
Copy link
Collaborator

Without being able to test, this is what I think this could look like with a custom v2 quirk. https://gist.github.com/prairiesnpr/0b7bf1a63da6224ad9b3147ead120109

We can probably just update TuyaMCUCluster to add the mcu_version_response if we were to PR it.

@dn-gt
Copy link

dn-gt commented Dec 14, 2024

TS0601 / _TZE200_qrztc3ev

Were you able to find a solution for this sensor? I received the same one the other day. And I don't receive any information from it.

No, unfortuantely no solution. As mentioned, I modified the Phython script by adding the text in the red square to the file (see screenshot) but I can only get the temperature (after a restart of HomeAssistant), not the humidity (humidity entity is shown but with wrong values).

@prairiesnpr
Copy link
Collaborator

(humidity entity is shown but with wrong values).

As in the scaling is wrong, e.g., off by a factor of ten, or it's completely wrong and likely on the wrong DP?

@dn-gt
Copy link

dn-gt commented Dec 14, 2024

E.g. 5.4% instead of 52% shown on the display at the same time

@FabTangi
Copy link

FabTangi commented Jan 8, 2025

Thanks for all the explanation. I added this quirk https://github.com/Peketr/zha-device-handlers/blob/Peketr-patch-zht05/zhaquirks/tuya/ts0601_sensor.py and it works. Battery level is changing from 25% to 50%, I'll monitor in the next days.

@prairiesnpr
Copy link
Collaborator

@FabTangi can you test https://gist.github.com/prairiesnpr/0b7bf1a63da6224ad9b3147ead120109 and let me know if it works the same?

@JKGHPO
Copy link

JKGHPO commented Jan 12, 2025

Can confirm, that I also have the same model

        ("_TZE200_qrztc3ev", "TS0601"), 

I used:

https://github.com/Peketr/zha-device-handlers/blob/Peketr-patch-zht05/zhaquirks/tuya/ts0601_sensor.py

and I could also recreate what @dn-gt saw

image

If I add it to this line, the good news is the sensors finally show up,

  • temperature seems to update 1:1 perfectly
  • humidity seems to be out by a contant factor of 10, (e.g. HA shows 6.2%, but the lcd screen shows 62%)

But then I was going through the python code, and I noticed this line was commented out, which seems to remove the humidity values being multiply by 10, so I moved the comment along, to put the 10x multiply back in, and now it works!

CleanShot 2025-01-12 at 16 28 34

I'm new to this git hub thing, and so not sure why @Peketr removed that 10x multiplier in his code, maybe to get it to work for a different sensor?

So not sure how to combine / add the change that @dn-gt suggseted, along with re-instanting the 10 multiplier, so everyone can benefit?

@prairiesnpr
Copy link
Collaborator

@JKGHPO Just use the built in quirk here. see

TuyaQuirkBuilder("_TZE200_bjawzodf", "TS0601")

So your custom quirk is simply.

from zhaquirks.tuya.builder import TuyaQuirkBuilder

(
    TuyaQuirkBuilder("_TZE200_qrztc3ev", "TS0601")
    .tuya_temperature(dp_id=1, scale=10)
    .tuya_humidity(dp_id=2, scale=10)
    .tuya_battery(dp_id=4)
    .skip_configuration()
    .add_to_registry()
)

@puyopsy
Copy link

puyopsy commented Jan 12, 2025

Can confirm, that I also have the same model

        ("_TZE200_qrztc3ev", "TS0601"), 

I used:

https://github.com/Peketr/zha-device-handlers/blob/Peketr-patch-zht05/zhaquirks/tuya/ts0601_sensor.py

and I could also recreate what @dn-gt saw

image

If I add it to this line, the good news is the sensors finally show up,

  • temperature seems to update 1:1 perfectly
  • humidity seems to be out by a contant factor of 10, (e.g. HA shows 6.2%, but the lcd screen shows 62%)

But then I was going through the python code, and I noticed this line was commented out, which seems to remove the humidity values being multiply by 10, so I moved the comment along, to put the 10x multiply back in, and now it works!

CleanShot 2025-01-12 at 16 28 34

I'm new to this git hub thing, and so not sure why @Peketr removed that 10x multiplier in his code, maybe to get it to work for a different sensor?

So not sure how to combine / add the change that @dn-gt suggseted, along with re-instanting the 10 multiplier, so everyone can benefit?

I have tried to do the same:
Capture_d'écran_011225_093808_PM

But somehow, it still doesn't work for me:
Capture_d'écran_011225_093858_PM

I try to check if the custom quirk is really applied but can't find how:
Capture_d'écran_011225_094006_PM

I have already try to reboot HA, as well as removed/added the device, multiple times .

@puyopsy
Copy link

puyopsy commented Jan 12, 2025

@JKGHPO Just use the built in quirk here. see

TuyaQuirkBuilder("_TZE200_bjawzodf", "TS0601")

So your custom quirk is simply.

from zhaquirks.tuya.builder import TuyaQuirkBuilder

(
    TuyaQuirkBuilder("_TZE200_qrztc3ev", "TS0601")
    .tuya_temperature(dp_id=1, scale=10)
    .tuya_humidity(dp_id=2, scale=10)
    .tuya_battery(dp_id=4)
    .skip_configuration()
    .add_to_registry()
)

Using this method I can see the custom quirk being applied, but again, the humidity and temperature sensor do not seem to report:
Capture_d'écran_011225_102148_PM

here is the quirk:
Capture_d'écran_011225_102221_PM

@prairiesnpr
Copy link
Collaborator

prairiesnpr commented Jan 12, 2025

Turn on debug logging, make sure it's sent some reports, and post it. Should see something along the lines of dp=1, dp=2, etc. That said, let's move this to its own request, it's not related to _TZE204_upagmta9

@puyopsy
Copy link

puyopsy commented Jan 12, 2025

Alright, here is the new ticket #3710, thanks

@webserviceXXL
Copy link

I have the device named TS0601 by _TZE200_qrztc3ev. This one is already in the list of the respective file in this repo here https://github.com/zigpy/zha-device-handlers/blob/dev/zhaquirks/tuya/ts0601_sensor.py

But it's not working however. The connection is working but I don't get any temperature or humidity. It's always 0. Since I own a lot of these kind of devices I tried to find any difference. And the only thing that i noticed is the new device that's not working have a cluster that the other don't have.

Screenshot-Einstellungen – Home Assistant-Arc-20250113_1122@2x

Maybe there is a polling setting missing? Does someone have a similar device? Any idea how to get this device running?

@puyopsy
Copy link

puyopsy commented Jan 13, 2025

@webserviceXXL : I have created a new issue dedicated to _TZE200_qrztc3ev here : #3710
I have the same device 3 times too. And for me I have the same problem. From the logs I also suspect that the quirk is not working because of a missing cluster.

@dn-gt
Copy link

dn-gt commented Jan 17, 2025

Changing RH_MULTIPLIER from 10 to 100 and waiting for the next update of the device solved the humidity issue for me.

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Tuya Request/PR regarding a Tuya device
Projects
None yet
Development

Successfully merging a pull request may close this issue.