Repository: home-assistant/core
Pull request #138542: Fix Tuya unsupported Temperature & Humidity Sensors (with or without external probe)
Author: login: maghiel
Labels: name: cla-signed
name: new-feature
name: integration: tuya
name: bugfix
name: Quality Scale: No score
Created: 2025-02-14T16:35:11Z | Merged: 2025-03-02T13:25:19Z

<!--
  You are amazing! Thanks for contributing to our project!
  Please, DO NOT DELETE ANY TEXT from this template! (unless instructed).
-->

## Proposed change
<!--
  Describe the big picture of your changes here to communicate to the
  maintainers why we should accept this pull request. If it fixes a bug
  or resolves a feature request, be sure to link to that issue in the
  additional information section.
-->

Tuya changed the category for some Temperature & Humidity Sensors from "wsdcg" to "qxj", yet again without announcement and not documented anywhere, very much like  #136960, It's possible they've created this new category for Temperature & Humidity Sensors with External Probe.

This PR fixes #136472 by adding the "qxj" category and adding the TEMP_CURRENT_EXTERNAL Data Point Code.
Because of that, I concider this PR partly bugfix/partly new feature (but mostly a bugfix).
Multiple users facing the issue have tested out the change and are fond with it (see the issue). 

Note: I'm getting some test-failures on missing translations. These are unrelated to my changes and were probably already existant. I've filed an issue, #138543 

## Type of change
<!--
  What type of change does your PR introduce to Home Assistant?
  NOTE: Please, check only 1! box!
  If your PR requires multiple boxes to be checked, you'll most likely need to
  split it into multiple PRs. This makes things easier and faster to code review.
-->

- [ ] Dependency upgrade
- [x] Bugfix (non-breaking change which fixes an issue)
- [ ] New integration (thank you!)
- [x] New feature (which adds functionality to an existing integration)
- [ ] Deprecation (breaking change to happen in the future)
- [ ] Breaking change (fix/feature causing existing functionality to break)
- [ ] Code quality improvements to existing code or addition of tests

## Additional information
<!--
  Details are important, and help maintainers processing your PR.
  Please be sure to fill out additional details, if applicable.
-->

- This PR fixes or closes issue: fixes #136472
- This PR is related to issue: #132844 
- Link to documentation pull request: 
- Link to developer documentation pull request: 
- Link to frontend pull request: 

## Checklist
<!--
  Put an `x` in the boxes that apply. You can also fill these out after
  creating the PR. If you're unsure about any of them, don't hesitate to ask.
  We're here to help! This is simply a reminder of what we are going to look
  for before merging your code.
-->

- [x] The code change is tested and works locally.
- [x] Local tests pass. **Your PR cannot be merged unless tests pass**
- [x] There is no commented out code in this PR.
- [x] I have followed the [development checklist][dev-checklist]
- [x] I have followed the [perfect PR recommendations][perfect-pr]
- [x] The code has been formatted using Ruff (`ruff format homeassistant tests`)
- [ ] Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

- [ ] Documentation added/updated for [www.home-assistant.io][docs-repository]

If the code communicates with devices, web services, or third-party tools:

- [ ] The [manifest file][manifest-docs] has all fields filled out correctly.  
      Updated and included derived files by running: `python3 -m script.hassfest`.
- [ ] New or updated dependencies have been added to `requirements_all.txt`.  
      Updated by running `python3 -m script.gen_requirements_all`.
- [ ] For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.

<!--
  This project is very active and we have a high turnover of pull requests.

  Unfortunately, the number of incoming pull requests is higher than what our
  reviewers can review and merge so there is a long backlog of pull requests
  waiting for review. You can help here!
  
  By reviewing another pull request, you will help raise the code quality of
  that pull request and the final review will be faster. This way the general
  pace of pull request reviews will go up and your wait time will go down.
  
  When picking a pull request to review, try to choose one that hasn't yet
  been reviewed.

  Thanks for helping out!
-->

To help with the load of incoming pull requests:

- [ ] I have reviewed two other [open pull requests][prs] in this repository.

[prs]: https://github.com/home-assistant/core/pulls?q=is%3Aopen+is%3Apr+-author%3A%40me+-draft%3Atrue+-label%3Awaiting-for-upstream+sort%3Acreated-desc+review%3Anone+-status%3Afailure

<!--
  Thank you for contributing <3

  Below, some useful links you could explore:
-->
[dev-checklist]: https://developers.home-assistant.io/docs/development_checklist/
[manifest-docs]: https://developers.home-assistant.io/docs/creating_integration_manifest/
[quality-scale]: https://developers.home-assistant.io/docs/integration_quality_scale_index/
[docs-repository]: https://github.com/home-assistant/home-assistant.io
[perfect-pr]: https://developers.home-assistant.io/docs/review-process/#creating-the-perfect-pr


Linked issue #136472: Tuya unsupported device
### The problem

Hi,

Geeting the " T & H Sensor (unsupported) "
issue again.

Hope somebody can help.
Thanks  and greetings

Below the info that was shared in the past by someone who had the same issue.

Device Information
Product Name WIFI温湿度
Device ID ___
Product Category wsdcg
Device Status Online
Activated At 2025-01-24 18:53:32



[
  {
    "code": "temp_unit_convert"
  },
  {
    "code": "maxtemp_set",
    "value": -200
  },
  {
    "code": "minitemp_set",
    "value": -200
  },
  {
    "code": "maxhum_set",
    "value": 0
  },
  {
    "code": "minihum_set",
    "value": 0
  },
  {
    "code": "temp_periodic_report",
    "value": 1
  },
  {
    "code": "hum_periodic_report",
    "value": 1
  },
  {
    "code": "temp_sensitivity",
    "value": 3
  },
  {
    "code": "hum_sensitivity",
    "value": 3
  }
]

### What version of Home Assistant Core has the issue?
core-2025.1.4

### What was the last working version of Home Assistant Core?
not known

### What type of installation are you running?

Home Assistant OS

### Integration causing the issue

Tuya

### Link to integration documentation on our website

https://www.home-assistant.io/integrations/tuya/

### Diagnostics information

_No response_

### Example YAML snippet

```yaml

```

### Anything in the logs that might be useful for us?

```txt

```

### Additional information

_No response_
Linked issue comments: user: login: home-assistant[bot]
created_at: 2025-01-24T18:54:39Z
body: 
Hey there @tuya, @zlinoliver, mind taking a look at this issue as it has been labeled with an integration (`tuya`) you are listed as a [code owner](https://github.com/home-assistant/core/blob/dev/CODEOWNERS#L1586) for? Thanks!

<details>
<summary>Code owner commands</summary>


Code owners of `tuya` can trigger bot actions by commenting:

- `@home-assistant close` Closes the issue.
- `@home-assistant rename Awesome new title` Renames the issue.
- `@home-assistant reopen` Reopen the issue.
- `@home-assistant unassign tuya` Removes the current integration label and assignees on the issue, add the integration domain after the command.
- `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
- `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

</details>


<sub><sup>(message by CodeOwnersMention)</sup></sub>

---

[tuya documentation](https://www.home-assistant.io/integrations/tuya)
[tuya source](https://github.com/home-assistant/core/tree/dev/homeassistant/components/tuya)
<sub><sup>(message by IssueLinks)</sup></sub>
author_association: CONTRIBUTOR
user: login: MrZaibot
created_at: 2025-01-27T15:42:29Z
body: I have the same problem. Works without issue in Tuya.

Including diagnostics

[tuya-7b4422a6dbfc734e96de7ec1b76b31ec-Frysen-f10a70d3a12c86068dd2e3fb52076e43.json](https://github.com/user-attachments/files/18560500/tuya-7b4422a6dbfc734e96de7ec1b76b31ec-Frysen-f10a70d3a12c86068dd2e3fb52076e43.json)
author_association: NONE
user: login: bieniu
created_at: 2025-01-27T19:13:10Z
body: Feature requests should be open here https://community.home-assistant.io/c/feature-requests/13
author_association: MEMBER
user: login: mkstalen
created_at: 2025-02-04T08:51:21Z
body: I'm having the same issue with a T & H Sensor with external probe. No sensors or entities listed, but works fine in Tuya Smart.

You can see data returned:
 "temp_current": 254,
 "humidity_value": 61,
 "battery_state": "high",
 "temp_current_external": 247

>  "data": {
    "endpoint": "https://apigw.tuyaeu.com",
    "terminal_id": "1738302676881CSo85c",
    "mqtt_connected": true,
    "disabled_by": null,
    "disabled_polling": false,
    "id": "bffacd4c23666139d0dkzs",
    "name": "T & H Sensor with external probe",
    "category": "qxj",
    "product_id": "ht4lbfiiadnhvbds",
    "product_name": "T & H Sensor with external probe",
    "online": true,
    "sub": false,
    "time_zone": "+11:00",
    "active_time": "2025-01-31T04:51:05+00:00",
    "create_time": "2025-01-31T04:51:05+00:00",
    "update_time": "2025-01-31T04:51:05+00:00",
    "function": {},
    "status_range": {
      "temp_current": {
        "type": "Integer",
        "value": {
          "unit": "\u2103",
          "min": -99,
          "max": 600,
          "scale": 1,
          "step": 1
        }
      },
      "humidity_value": {
        "type": "Integer",
        "value": {
          "unit": "%",
          "min": 0,
          "max": 100,
          "scale": 0,
          "step": 1
        }
      },
      "battery_state": {
        "type": "Enum",
        "value": {
          "range": [
            "low",
            "middle",
            "high"
          ]
        }
      },
      "temp_current_external": {
        "type": "Integer",
        "value": {
          "unit": "\u2103",
          "min": -400,
          "max": 1200,
          "scale": 1,
          "step": 1
        }
      }
    },
    "status": {
      "temp_current": 254,
      "humidity_value": 61,
      "battery_state": "high",
      "temp_current_external": 247
    },
    "home_assistant": {
      "name": "T & H Sensor with external probe",
      "name_by_user": null,
      "disabled": false,
      "disabled_by": null,
      "entities": []
    },
    "set_up": false,
    "support_local": true
  }

author_association: NONE
user: login: EACourts
created_at: 2025-02-04T19:56:27Z
body: Same device, same issue. 
author_association: NONE
user: login: delboydell
created_at: 2025-02-06T14:29:45Z
body: I have 3 types of devices hat work within the Tuya app, they are added to HA if the Intergration is reloaded, but they dont show any avalible controls.
They are a plant moisture sensor, outdoor PIR sensor with internal relay and a RGBW flush light.

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2025.1.4",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.13.1",
    "docker": true,
    "arch": "aarch64",
    "timezone": "Europe/Stockholm",
    "os_name": "Linux",
    "os_version": "6.6.66-haos",
    "supervisor": "2024.12.3",
    "host_os": "Home Assistant OS 14.1",
    "docker_version": "27.2.0",
    "chassis": "embedded",
    "run_as_root": true
  },
  "custom_components": {
    "open_epaper_link": {
      "documentation": "https://github.com/jonasniesner/open_epaper_link_homeassistant",
      "version": "1.0.0",
      "requirements": [
        "qrcode[pil]==7.4.2",
        "requests_toolbelt==1.0.0",
        "websocket-client==1.7.0"
      ]
    },
    "hacs": {
      "documentation": "https://hacs.xyz/docs/use/",
      "version": "2.0.3",
      "requirements": [
        "aiogithubapi>=22.10.1"
      ]
    },
    "uniled": {
      "documentation": "https://github.com/monty68/uniled",
      "version": "2.2.6",
      "requirements": [
        "pycryptodome>=3.17",
        "cryptography"
      ]
    },
    "feedparser": {
      "documentation": "https://github.com/custom-components/feedparser/blob/master/README.md",
      "version": "0.1.12",
      "requirements": [
        "feedparser==6.0.11"
      ]
    },
author_association: NONE
user: login: thorstensd
created_at: 2025-02-07T14:45:22Z
body: Same at here - unsuported device, no entitys available
author_association: NONE
user: login: maghiel
created_at: 2025-02-13T19:30:01Z
body: This seems to be yet another unannounced, undocumented category change by Tuya. (See #132844)

The category is supposed to be "wsdcg" from @darnoldser information, which is "Temperature and humidity sensor" according to [Tuya Developer Platform](https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq)
However, the diagnostics by @mkstalen clearly show "qxj" as category.

I don't have the device to test it out myself, but I'm almost sure it's easily resolved as with the camera issue. I'll release a custom component with a fix I have in mind. If you would be so kind to test it for me, and we find it works perfectly, I can proceed with a PR. 


author_association: CONTRIBUTOR
user: login: maghiel
created_at: 2025-02-13T20:34:56Z
body: Done. Can you install the custom compontent [/maghiel/tuya-lsc_camera_fix ](https://github.com/maghiel/tuya-lsc_camera_fix) and test it for me? 
When downloading from HACS, make sure to choose __Need a different version__ and select the 1.0.1-alpha01 release.
author_association: CONTRIBUTOR
user: login: mkstalen
created_at: 2025-02-13T22:24:55Z
body: I'm going to need a little help. Still a bit new to this.
I've added the custom repository, and downloaded the alpha release, when I go to add the integration it asks me for the "User Code" which I put in without any issues.
It then pops up a QR code, which I presume is to authenticate at the Tuya backend, but when I scan it with my phone I don't get a FQDN, just the following text:
"tuyaSmart--qrLogin?token=blahblahblahxxxxxxxx"

And I can't see what to do next as there's nowhere in the HA integration config to put the token ID.
author_association: NONE
user: login: maghiel
created_at: 2025-02-13T23:46:20Z
body: > I'm going to need a little help. Still a bit new to this. I've added the custom repository, and downloaded the alpha release, when I go to add the integration it asks me for the "User Code" which I put in without any issues. It then pops up a QR code, which I presume is to authenticate at the Tuya backend, but when I scan it with my phone I don't get a FQDN, just the following text: "tuyaSmart--qrLogin?token=blahblahblahxxxxxxxx"
> 
> And I can't see what to do next as there's nowhere in the HA integration config to put the token ID.

It's configured the same way the official Tuya integration is as it's just a clone with some fixes. 

You have to scan the QR with the Tuya/SmartLife/WhateverOEM app you are using (and where you got your userid from), not with your camera app.
author_association: CONTRIBUTOR
user: login: mkstalen
created_at: 2025-02-13T23:59:11Z
body: OK. That's kind of worked for my device, but not completely.
It's picking up some of the sensors, now. But my device has, 1 humidity, 1 battery and 2 temperature sensors.
The json diag output shows "temp_current", "humidity_value", "battery_state" and "temp_current_external"
So I can see entities for humidity, battery and one of the temperature figures. But not the other temperature figure.

![Image](https://github.com/user-attachments/assets/8bbfc1fa-9198-4f97-8a83-4cd33bddfd2b)

Full json output is:

>   "integration_manifest": {
    "domain": "tuya-lsc_camera_fix",
    "name": "Tuya LSC Camera Fix",
    "version": "0.9.0.0",
    "codeowners": [
      "maghiel"
    ],
    "config_flow": true,
    "dependencies": [
      "ffmpeg"
    ],
    "dhcp": [
      {
        "macaddress": "105A17*"
      },
      {
        "macaddress": "10D561*"
      },
      {
        "macaddress": "1869D8*"
      },
      {
        "macaddress": "381F8D*"
      },
      {
        "macaddress": "508A06*"
      },
      {
        "macaddress": "68572D*"
      },
      {
        "macaddress": "708976*"
      },
      {
        "macaddress": "7CF666*"
      },
      {
        "macaddress": "84E342*"
      },
      {
        "macaddress": "D4A651*"
      },
      {
        "macaddress": "D81F12*"
      }
    ],
    "documentation": "https://www.home-assistant.io/integrations/tuya",
    "integration_type": "hub",
    "iot_class": "cloud_push",
    "loggers": [
      "tuya_iot"
    ],
    "requirements": [
      "tuya-device-sharing-sdk==0.2.1"
    ],
    "is_built_in": false,
    "overwrites_built_in": false
  },
  "setup_times": {},
  "data": {
    "endpoint": "https://apigw.tuyaeu.com",
    "terminal_id": "1739490490225ROd7LZ",
    "mqtt_connected": true,
    "disabled_by": null,
    "disabled_polling": false,
    "id": "bffacd4c23666139d0dkzs",
    "name": "T & H Sensor with external probe",
    "category": "qxj",
    "product_id": "ht4lbfiiadnhvbds",
    "product_name": "T & H Sensor with external probe",
    "online": true,
    "sub": false,
    "time_zone": "+11:00",
    "active_time": "2025-01-31T04:51:05+00:00",
    "create_time": "2025-01-31T04:51:05+00:00",
    "update_time": "2025-01-31T04:51:05+00:00",
    "function": {},
    "status_range": {
      "temp_current": {
        "type": "Integer",
        "value": {
          "unit": "\u2103",
          "min": -99,
          "max": 600,
          "scale": 1,
          "step": 1
        }
      },
      "humidity_value": {
        "type": "Integer",
        "value": {
          "unit": "%",
          "min": 0,
          "max": 100,
          "scale": 0,
          "step": 1
        }
      },
      "battery_state": {
        "type": "Enum",
        "value": {
          "range": [
            "low",
            "middle",
            "high"
          ]
        }
      },
      "temp_current_external": {
        "type": "Integer",
        "value": {
          "unit": "\u2103",
          "min": -400,
          "max": 1200,
          "scale": 1,
          "step": 1
        }
      }
    },
    "status": {
      "temp_current": 236,
      "humidity_value": 85,
      "battery_state": "high",
      "temp_current_external": 230
    },
    "home_assistant": {
      "name": "T & H Sensor with external probe",
      "name_by_user": null,
      "disabled": false,
      "disabled_by": null,
      "entities": [
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": null,
          "device_class": null,
          "original_device_class": "temperature",
          "icon": null,
          "original_icon": null,
          "unit_of_measurement": "\u00b0C",
          "state": {
            "entity_id": "sensor.t_h_sensor_with_external_probe_temperature",
            "state": "23.6",
            "attributes": {
              "state_class": "measurement",
              "unit_of_measurement": "\u00b0C",
              "device_class": "temperature",
              "friendly_name": "T & H Sensor with external probe Temperature"
            },
            "last_changed": "2025-02-13T23:48:25.540878+00:00",
            "last_reported": "2025-02-13T23:48:25.541547+00:00",
            "last_updated": "2025-02-13T23:48:25.540878+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": null,
          "device_class": null,
          "original_device_class": "humidity",
          "icon": null,
          "original_icon": null,
          "unit_of_measurement": "%",
          "state": {
            "entity_id": "sensor.t_h_sensor_with_external_probe_humidity",
            "state": "85.0",
            "attributes": {
              "state_class": "measurement",
              "unit_of_measurement": "%",
              "device_class": "humidity",
              "friendly_name": "T & H Sensor with external probe Humidity"
            },
            "last_changed": "2025-02-13T23:48:25.543168+00:00",
            "last_reported": "2025-02-13T23:48:25.543772+00:00",
            "last_updated": "2025-02-13T23:48:25.543168+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "diagnostic",
          "device_class": null,
          "original_device_class": null,
          "icon": null,
          "original_icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "sensor.t_h_sensor_with_external_probe_none",
            "state": "high",
            "attributes": {
              "friendly_name": "T & H Sensor with external probe None"
            },
            "last_changed": "2025-02-13T23:48:25.548038+00:00",
            "last_reported": "2025-02-13T23:48:25.548819+00:00",
            "last_updated": "2025-02-13T23:48:25.548038+00:00"
          }
        }
      ]
    },
    "set_up": true,
    "support_local": true
  }
author_association: NONE
user: login: maghiel
created_at: 2025-02-14T00:13:36Z
body: Thank you! Something to work off. 
It's reporting all sensors:

> "temp_current": 236,
"humidity_value": 85,
"battery_state": "high",
"temp_current_external": 230

And I see another issue, the battery sensor shows up as None. 

I'm off for bed now, thanks for testing! 
author_association: CONTRIBUTOR
user: login: maghiel
created_at: 2025-02-14T00:50:11Z
body: @mkstalen I couldn't leave it alone. Could you test 1.0.1-alpha02 to see if the external temperature sensor shows up? 
author_association: CONTRIBUTOR
user: login: mkstalen
created_at: 2025-02-14T00:58:34Z
body: Winner winner!

![Image](https://github.com/user-attachments/assets/78e1a941-fcf2-4e3c-8ec1-f0b3401f3909)

The 2nd one is the probe.
So will this fix get rolled up into the standard Tuya integration?

Thanks!
author_association: NONE
user: login: thorstensd
created_at: 2025-02-14T10:23:01Z
body: > [@mkstalen](https://github.com/mkstalen) I couldn't leave it alone. Could you test 1.0.1-alpha02 to see if the external temperature sensor shows up?

I can also confirm - it is working fine in 1.0.1 -alpha02. Perfekt now for my fish tank and pool temperatur if summer ist coming.

Thank you very much.

BR
author_association: NONE
user: login: EACourts
created_at: 2025-02-14T14:08:25Z
body: The new integration works for me too! - THANK YOU!
author_association: NONE
user: login: maghiel
created_at: 2025-02-14T16:44:04Z
body: Happy to hear you are happy with it! 

> The new integration works for me too! - THANK YOU!

Please don't consider the custom component as a new integration. I've intended it as a temporary fix until (if) the PR get's merged and is included in a new release. There's nothing wrong with using it besides/instead of the current Tuya integration though; it's exactly the same plus some fixes. 

Btw: you could all help out by reviewing the pr
author_association: CONTRIBUTOR
user: login: Acid-Way
created_at: 2025-02-16T14:56:25Z
body: I have the same problem, but the device type for me is "tdq" (but it should be a temperature sensor)
author_association: NONE
user: login: maghiel
created_at: 2025-02-16T15:02:00Z
body: > I have the same problem, but the device type for me is "tdq" (but it should be a temperature sensor)

Is your device a Temperature Sensor or a Temperature and Humidity Sensor? If the first is the case, can you file a separate issue for that with a diagnostics file? If it's the latter, can you supply a diagnostics file here? 
author_association: CONTRIBUTOR
user: login: Acid-Way
created_at: 2025-02-16T15:12:08Z
body: Temperature and Humidity Sensor ! 


  "integration_manifest": {
    "Domäne": "tuya",
    "Name": "Tuya",
    "Codebesitzer": [
      "Tuja",
      "zlinoliver"
    ],
    "config_flow": wahr,
    "Abhängigkeiten": [
      "ffmpeg"
    ],
    "dhcp": [
      {
        "macaddress": "105A17*"
      },
      {
        "macaddress": "10D561*"
      },
      {
        "macaddress": "1869D8*"
      },
      {
        "macaddress": "381F8D*"
      },
      {
        "macaddress": "508A06*"
      },
      {
        "macaddress": "68572D*"
      },
      {
        "macaddress": "708976*"
      },
      {
        "macaddress": "7CF666*"
      },
      {
        "macaddress": "84E342*"
      },
      {
        "macaddress": "D4A651*"
      },
      {
        "macaddress": "D81F12*"
      }
    ],
    "Dokumentation": "https://www.home-assistant.io/integrations/tuya",
    "Integrationstyp": "Hub",
    "iot_class": "cloud_push",
    "Logger": [
      "tuya_iot"
    ],
    "Anforderungen": [
      „tuya-device-sharing-sdk==0.2.1“
    ],
    "ist_eingebaut": wahr,
    "overwrites_built-in": falsch
  },
  "setup_times": {
    "null": {
      "Einrichtung": 0,00010255200000131026
    },
    "d114979dfbcf75b0865dcf15db221c24": {
      "wait_import_platforms": -6,594599825000003,
      "config_entry_setup": 9.627742190999996
    }
  },
  "Daten": {
    "Endpunkt": "https://apigw.tuyaeu.com",
    "terminal_id": "17396546008479vezxJ",
    "mqtt_connected": wahr,
    "disabled_by": null,
    "disabled_polling": falsch,
    "id": "bf4a99b087b30ac856meeo",
    "Name": "T & H-Sensor 3",
    "Kategorie": "tdq",
    "Produkt-ID": "x3o8epevyeo3z3oa",
    "Produktname": "T & H-Sensor",
    "online": wahr,
    "sub": falsch,
    "Zeitzone": "+01:00",
    "aktive_zeit": "2025-02-16T14:09:44+00:00",
    "Erstellungszeit": "2025-02-16T14:09:44+00:00",
    "update_time": "2025-02-16T14:09:44+00:00",
    "Funktion": {},
    "status_range": {},
    "Status": {},
    "Heimassistent": {
      "Name": "T & H-Sensor 3",
      "name_by_user": null,
      "deaktiviert": falsch,
      "disabled_by": null,
      "Entitäten": []
    },
    "set_up": falsch,
    "support_local": wahr
  }
}
author_association: NONE
user: login: maghiel
created_at: 2025-02-16T17:24:05Z
body: @Acid-Way I'm afraid this issue is a bit more complicated and a different issue altogether. In the code "tdq" is listed as both as a duplicate of a light dimmer and an undocumented IoT switch (with a question mark). Simply making changes might potentially break other other devices. 
@frenck are you completely completely done with Tuya or maybe, if I'm very kind, can you give me a hint? :) (I can totally see why you are fed up). Is "tdq" being a duplicate of "tgq" an assumption? 
author_association: CONTRIBUTOR
user: login: luccio8686
created_at: 2025-02-16T17:50:13Z
body: I have the samil @Acid-Way issue for Temperature and Humidity sensor not recongnized. The category is always "tdq".
author_association: NONE
user: login: maghiel
created_at: 2025-02-17T10:51:40Z
body: @Acid-Way, @luccio8686, could you test https://github.com/maghiel/tuya-lsc_camera_fix release 1.0.2-alpha01? 

author_association: CONTRIBUTOR
user: login: Acid-Way
created_at: 2025-02-17T12:00:11Z
body: Unfortunately it doesn't work either.


"integration_manifest": {
    "Domäne": "tuya-lsc_camera_fix",
    "Name": "Tuya LSC Kamera Fix",
    "version": "1.0.1",
    "Codebesitzer": [
      "Magie"
    ],
    "config_flow": wahr,
    "Abhängigkeiten": [
      "ffmpeg"
    ],
    "dhcp": [
      {
        "macaddress": "105A17*"
      },
      {
        "macaddress": "10D561*"
      },
      {
        "macaddress": "1869D8*"
      },
      {
        "macaddress": "381F8D*"
      },
      {
        "macaddress": "508A06*"
      },
      {
        "macaddress": "68572D*"
      },
      {
        "macaddress": "708976*"
      },
      {
        "macaddress": "7CF666*"
      },
      {
        "macaddress": "84E342*"
      },
      {
        "macaddress": "D4A651*"
      },
      {
        "macaddress": "D81F12*"
      }
    ],
    "Dokumentation": "https://www.home-assistant.io/integrations/tuya",
    "Integrationstyp": "Hub",
    "iot_class": "cloud_push",
    "Logger": [
      "tuya_iot"
    ],
    "Anforderungen": [
      „tuya-device-sharing-sdk==0.2.1“
    ],
    "ist_eingebaut": falsch,
    "overwrites_built-in": falsch
  },
  "setup_times": {},
  "Daten": {
    "Endpunkt": "https://apigw.tuyaeu.com",
    "terminal_id": "1739793271491B9YPEx",
    "mqtt_connected": wahr,
    "disabled_by": null,
    "disabled_polling": falsch,
    "id": "bf4a99b087b30ac856meeo",
    "Name": "T & H-Sensor 3",
    "Kategorie": "tdq",
    "Produkt-ID": "x3o8epevyeo3z3oa",
    "Produktname": "T & H-Sensor",
    "online": wahr,
    "sub": falsch,
    "Zeitzone": "+01:00",
    "aktive_zeit": "2025-02-16T14:09:44+00:00",
    "Erstellungszeit": "2025-02-16T14:09:44+00:00",
    "update_time": "2025-02-16T14:09:44+00:00",
    "Funktion": {},
    "status_range": {},
    "Status": {},
    "Heimassistent": {
      "Name": "T & H-Sensor 3",
      "name_by_user": null,
      "deaktiviert": falsch,
      "disabled_by": null,
      "Entitäten": []
    },
    "set_up": falsch,
    "support_local": wahr
  }
}
author_association: NONE
user: login: maghiel
created_at: 2025-02-17T17:50:43Z
body: @Acid-Way can you try 1.0.2-alpha02? 
author_association: CONTRIBUTOR
user: login: Acid-Way
created_at: 2025-02-17T18:35:29Z
body: still unchanged, 1.0.2-alpha02 😓
author_association: NONE
user: login: mawasile
created_at: 2025-02-19T11:06:51Z
body: @maghiel tested on 1.0.2-alpha04. Same issue, I also have `tdq` category. Maybe you could point us to a temporary workaround and give configuration values to localtuya integration? 

```json
 "integration_manifest": {
    "domain": "tuya-lsc_camera_fix",
    "name": "Tuya LSC Camera Fix",
    "version": "1.0.1",
    "codeowners": [
      "maghiel"
    ],
    "config_flow": true,
    "dependencies": [
      "ffmpeg"
    ],
    "dhcp": [
      {
        "macaddress": "105A17*"
      },
      {
        "macaddress": "10D561*"
      },
      {
        "macaddress": "1869D8*"
      },
      {
        "macaddress": "381F8D*"
      },
      {
        "macaddress": "508A06*"
      },
      {
        "macaddress": "68572D*"
      },
      {
        "macaddress": "708976*"
      },
      {
        "macaddress": "7CF666*"
      },
      {
        "macaddress": "84E342*"
      },
      {
        "macaddress": "D4A651*"
      },
      {
        "macaddress": "D81F12*"
      }
    ],
    "documentation": "https://www.home-assistant.io/integrations/tuya",
    "integration_type": "hub",
    "iot_class": "cloud_push",
    "loggers": [
      "tuya_iot"
    ],
    "requirements": [
      "tuya-device-sharing-sdk==0.2.1"
    ],
    "is_built_in": false,
    "overwrites_built_in": false
  },
  "setup_times": {},
  "data": {
    "endpoint": "https://apigw.tuyaeu.com",
    "terminal_id": "17399627358519r2LcO",
    "mqtt_connected": true,
    "disabled_by": null,
    "disabled_polling": false,
    "id": "bf4b1c09f92f5e2e0bh7xz",
    "name": "Sensor Temperatury 1",
    "category": "tdq",
    "product_id": "x3o8epevyeo3z3oa",
    "product_name": "T & H Sensor",
    "online": true,
    "sub": false,
    "time_zone": "+01:00",
    "active_time": "2025-02-09T17:02:42+00:00",
    "create_time": "2025-02-09T17:02:42+00:00",
    "update_time": "2025-02-09T17:02:42+00:00",
    "function": {},
    "status_range": {},
    "status": {},
    "home_assistant": {
      "name": "Sensor Temperatury 1",
      "name_by_user": null,
      "disabled": false,
      "disabled_by": null,
      "entities": []
    },
    "set_up": false,
    "support_local": true
  }
```
author_association: NONE
user: login: maghiel
created_at: 2025-02-19T19:14:42Z
body: @mawasile sorry for the confusement, 1.0.2-alpha04 had changes unrelated to your issues. 
This custom component _is_ the workaround I have in mind, I'll try to find some time soon for another workaround/fix I have in mind. 
For now my focus is on the official integration, not localtuya. Sorry. 
author_association: CONTRIBUTOR

Diff:
diff --git a/homeassistant/components/tuya/binary_sensor.py b/homeassistant/components/tuya/binary_sensor.py
index 1e13f10111072c..486dd6e1387de2 100644
--- a/homeassistant/components/tuya/binary_sensor.py
+++ b/homeassistant/components/tuya/binary_sensor.py
@@ -291,6 +291,9 @@ class TuyaBinarySensorEntityDescription(BinarySensorEntityDescription):
     # Temperature and Humidity Sensor
     # https://developer.tuya.com/en/docs/iot/categorywsdcg?id=Kaiuz3hinij34
     "wsdcg": (TAMPER_BINARY_SENSOR,),
+    # Temperature and Humidity Sensor with External Probe
+    # New undocumented category qxj, see https://github.com/home-assistant/core/issues/136472
+    "qxj": (TAMPER_BINARY_SENSOR,),
     # Pressure Sensor
     # https://developer.tuya.com/en/docs/iot/categoryylcg?id=Kaiuz3kc2e4gm
     "ylcg": (
diff --git a/homeassistant/components/tuya/const.py b/homeassistant/components/tuya/const.py
index 08bdef474efb7b..a40260ed787060 100644
--- a/homeassistant/components/tuya/const.py
+++ b/homeassistant/components/tuya/const.py
@@ -333,6 +333,12 @@ class DPCode(StrEnum):
     TEMP_CONTROLLER = "temp_controller"
     TEMP_CURRENT = "temp_current"  # Current temperature in °C
     TEMP_CURRENT_F = "temp_current_f"  # Current temperature in °F
+    TEMP_CURRENT_EXTERNAL = (
+        "temp_current_external"  # Current external temperature in Celsius
+    )
+    TEMP_CURRENT_EXTERNAL_F = (
+        "temp_current_external_f"  # Current external temperature in Fahrenheit
+    )
     TEMP_INDOOR = "temp_indoor"  # Indoor temperature in °C
     TEMP_SET = "temp_set"  # Set the temperature in °C
     TEMP_SET_F = "temp_set_f"  # Set the temperature in °F
diff --git a/homeassistant/components/tuya/sensor.py b/homeassistant/components/tuya/sensor.py
index 073202bed942cc..b1150be306a78f 100644
--- a/homeassistant/components/tuya/sensor.py
+++ b/homeassistant/components/tuya/sensor.py
@@ -715,6 +715,47 @@ class TuyaSensorEntityDescription(SensorEntityDescription):
         ),
         *BATTERY_SENSORS,
     ),
+    # Temperature and Humidity Sensor with External Probe
+    # New undocumented category qxj, see https://github.com/home-assistant/core/issues/136472
+    "qxj": (
+        TuyaSensorEntityDescription(
+            key=DPCode.VA_TEMPERATURE,
+            translation_key="temperature",
+            device_class=SensorDeviceClass.TEMPERATURE,
+            state_class=SensorStateClass.MEASUREMENT,
+        ),
+        TuyaSensorEntityDescription(
+            key=DPCode.TEMP_CURRENT,
+            translation_key="temperature",
+            device_class=SensorDeviceClass.TEMPERATURE,
+            state_class=SensorStateClass.MEASUREMENT,
+        ),
+        TuyaSensorEntityDescription(
+            key=DPCode.TEMP_CURRENT_EXTERNAL,
+            translation_key="temperature_external",
+            device_class=SensorDeviceClass.TEMPERATURE,
+            state_class=SensorStateClass.MEASUREMENT,
+        ),
+        TuyaSensorEntityDescription(
+            key=DPCode.VA_HUMIDITY,
+            translation_key="humidity",
+            device_class=SensorDeviceClass.HUMIDITY,
+            state_class=SensorStateClass.MEASUREMENT,
+        ),
+        TuyaSensorEntityDescription(
+            key=DPCode.HUMIDITY_VALUE,
+            translation_key="humidity",
+            device_class=SensorDeviceClass.HUMIDITY,
+            state_class=SensorStateClass.MEASUREMENT,
+        ),
+        TuyaSensorEntityDescription(
+            key=DPCode.BRIGHT_VALUE,
+            translation_key="illuminance",
+            device_class=SensorDeviceClass.ILLUMINANCE,
+            state_class=SensorStateClass.MEASUREMENT,
+        ),
+        *BATTERY_SENSORS,
+    ),
     # Pressure Sensor
     # https://developer.tuya.com/en/docs/iot/categoryylcg?id=Kaiuz3kc2e4gm
     "ylcg": (
diff --git a/homeassistant/components/tuya/strings.json b/homeassistant/components/tuya/strings.json
index 8ec61cc8aa51d2..83847d32fb528c 100644
--- a/homeassistant/components/tuya/strings.json
+++ b/homeassistant/components/tuya/strings.json
@@ -469,6 +469,9 @@
       "temperature": {
         "name": "[%key:component::sensor::entity_component::temperature::name%]"
       },
+      "temperature_external": {
+        "name": "Probe temperature"
+      },
       "humidity": {
         "name": "[%key:component::sensor::entity_component::humidity::name%]"
       },
diff --git a/homeassistant/components/tuya/switch.py b/homeassistant/components/tuya/switch.py
index 76d8b481a90609..4000e8d9b24912 100644
--- a/homeassistant/components/tuya/switch.py
+++ b/homeassistant/components/tuya/switch.py
@@ -612,6 +612,15 @@
             device_class=SwitchDeviceClass.OUTLET,
         ),
     ),
+    # SIREN: Siren (switch) with Temperature and Humidity Sensor with External Probe
+    # New undocumented category qxj, see https://github.com/home-assistant/core/issues/136472
+    "qxj": (
+        SwitchEntityDescription(
+            key=DPCode.SWITCH,
+            translation_key="switch",
+            device_class=SwitchDeviceClass.OUTLET,
+        ),
+    ),
     # Ceiling Light
     # https://developer.tuya.com/en/docs/iot/ceiling-light?id=Kaiuz03xxfc4r
     "xdd": (


Reviews:
user: login: Dangerdangerau
state: APPROVED
author_association: NONE
submitted_at: 2025-02-15T22:02:49Z
user: login: frenck
state: CHANGES_REQUESTED
author_association: MEMBER
submitted_at: 2025-03-01T19:18:45Z
user: login: maghiel
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-02T00:13:28Z
user: login: maghiel
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-02T00:16:23Z
user: login: frenck
body: Make sense! Thanks, @maghiel 👍 

../Frenck
state: APPROVED
author_association: MEMBER
submitted_at: 2025-03-02T13:25:11Z

Review comments:
diff_hunk: @@ -715,6 +715,47 @@ class TuyaSensorEntityDescription(SensorEntityDescription):
         ),
         *BATTERY_SENSORS,
     ),
+    # Temperature and Humidity Sensor with External Probe
+    # New undocumented category qxj, see https://github.com/home-assistant/core/issues/136472
+    "qxj": (
+        TuyaSensorEntityDescription(
+            key=DPCode.VA_TEMPERATURE,
+            translation_key="temperature",
+            device_class=SensorDeviceClass.TEMPERATURE,
+            state_class=SensorStateClass.MEASUREMENT,
+        ),
+        TuyaSensorEntityDescription(
+            key=DPCode.TEMP_CURRENT,
+            translation_key="temperature",
+            device_class=SensorDeviceClass.TEMPERATURE,
+            state_class=SensorStateClass.MEASUREMENT,
+        ),
+        TuyaSensorEntityDescription(
+            key=DPCode.TEMP_CURRENT_EXTERNAL,
+            translation_key="temperature",
+            device_class=SensorDeviceClass.TEMPERATURE,
+            state_class=SensorStateClass.MEASUREMENT,
+        ),
path: homeassistant/components/tuya/sensor.py
user: login: frenck
body: If these all have the same translation key, how would you know the difference between them?
Or is this always one of these?
created_at: 2025-03-01T19:18:12Z
author_association: MEMBER
diff_hunk: @@ -715,6 +715,47 @@ class TuyaSensorEntityDescription(SensorEntityDescription):
         ),
         *BATTERY_SENSORS,
     ),
+    # Temperature and Humidity Sensor with External Probe
+    # New undocumented category qxj, see https://github.com/home-assistant/core/issues/136472
+    "qxj": (
+        TuyaSensorEntityDescription(
+            key=DPCode.VA_TEMPERATURE,
+            translation_key="temperature",
+            device_class=SensorDeviceClass.TEMPERATURE,
+            state_class=SensorStateClass.MEASUREMENT,
+        ),
+        TuyaSensorEntityDescription(
+            key=DPCode.TEMP_CURRENT,
+            translation_key="temperature",
+            device_class=SensorDeviceClass.TEMPERATURE,
+            state_class=SensorStateClass.MEASUREMENT,
+        ),
+        TuyaSensorEntityDescription(
+            key=DPCode.TEMP_CURRENT_EXTERNAL,
+            translation_key="temperature",
+            device_class=SensorDeviceClass.TEMPERATURE,
+            state_class=SensorStateClass.MEASUREMENT,
+        ),
+        TuyaSensorEntityDescription(
+            key=DPCode.VA_HUMIDITY,
+            translation_key="humidity",
+            device_class=SensorDeviceClass.HUMIDITY,
+            state_class=SensorStateClass.MEASUREMENT,
+        ),
+        TuyaSensorEntityDescription(
+            key=DPCode.HUMIDITY_VALUE,
+            translation_key="humidity",
+            device_class=SensorDeviceClass.HUMIDITY,
+            state_class=SensorStateClass.MEASUREMENT,
+        ),
path: homeassistant/components/tuya/sensor.py
user: login: frenck
body: Same.
created_at: 2025-03-01T19:18:25Z
author_association: MEMBER
diff_hunk: @@ -715,6 +715,47 @@ class TuyaSensorEntityDescription(SensorEntityDescription):
         ),
         *BATTERY_SENSORS,
     ),
+    # Temperature and Humidity Sensor with External Probe
+    # New undocumented category qxj, see https://github.com/home-assistant/core/issues/136472
+    "qxj": (
+        TuyaSensorEntityDescription(
+            key=DPCode.VA_TEMPERATURE,
+            translation_key="temperature",
+            device_class=SensorDeviceClass.TEMPERATURE,
+            state_class=SensorStateClass.MEASUREMENT,
+        ),
+        TuyaSensorEntityDescription(
+            key=DPCode.TEMP_CURRENT,
+            translation_key="temperature",
+            device_class=SensorDeviceClass.TEMPERATURE,
+            state_class=SensorStateClass.MEASUREMENT,
+        ),
+        TuyaSensorEntityDescription(
+            key=DPCode.TEMP_CURRENT_EXTERNAL,
+            translation_key="temperature",
+            device_class=SensorDeviceClass.TEMPERATURE,
+            state_class=SensorStateClass.MEASUREMENT,
+        ),
path: homeassistant/components/tuya/sensor.py
user: login: maghiel
body: > If these all have the same translation key, how would you know the difference between them? Or is this always one of these?

I've added a translation key for the external probe. I'm hesitant to add it to the sensor component strings, but as always, please correct me. 

For VA_TEMPERATURE and TEMP_CURRENT I'm pretty sure it's always one of those, wsdcg does the same. However, the components strings *does* already have a translation key "current_temperature". I can "fix" both, but won't that be outside the scope of this pr? 

Thanks again, sensei ;) 
created_at: 2025-03-02T00:13:28Z
author_association: CONTRIBUTOR
diff_hunk: @@ -715,6 +715,47 @@ class TuyaSensorEntityDescription(SensorEntityDescription):
         ),
         *BATTERY_SENSORS,
     ),
+    # Temperature and Humidity Sensor with External Probe
+    # New undocumented category qxj, see https://github.com/home-assistant/core/issues/136472
+    "qxj": (
+        TuyaSensorEntityDescription(
+            key=DPCode.VA_TEMPERATURE,
+            translation_key="temperature",
+            device_class=SensorDeviceClass.TEMPERATURE,
+            state_class=SensorStateClass.MEASUREMENT,
+        ),
+        TuyaSensorEntityDescription(
+            key=DPCode.TEMP_CURRENT,
+            translation_key="temperature",
+            device_class=SensorDeviceClass.TEMPERATURE,
+            state_class=SensorStateClass.MEASUREMENT,
+        ),
+        TuyaSensorEntityDescription(
+            key=DPCode.TEMP_CURRENT_EXTERNAL,
+            translation_key="temperature",
+            device_class=SensorDeviceClass.TEMPERATURE,
+            state_class=SensorStateClass.MEASUREMENT,
+        ),
+        TuyaSensorEntityDescription(
+            key=DPCode.VA_HUMIDITY,
+            translation_key="humidity",
+            device_class=SensorDeviceClass.HUMIDITY,
+            state_class=SensorStateClass.MEASUREMENT,
+        ),
+        TuyaSensorEntityDescription(
+            key=DPCode.HUMIDITY_VALUE,
+            translation_key="humidity",
+            device_class=SensorDeviceClass.HUMIDITY,
+            state_class=SensorStateClass.MEASUREMENT,
+        ),
path: homeassistant/components/tuya/sensor.py
user: login: maghiel
body: > Same.

Same as my remarks on VA_TEMPERATURE and TEMP_CURRENT. 

created_at: 2025-03-02T00:16:22Z
author_association: CONTRIBUTOR

PR comments:
user: login: home-assistant[bot]
created_at: 2025-02-14T16:35:19Z
body: 
Hey there @tuya, @zlinoliver, mind taking a look at this pull request as it has been labeled with an integration (`tuya`) you are listed as a [code owner](https://github.com/home-assistant/core/blob/dev/CODEOWNERS#L1596) for? Thanks!

<details>
<summary>Code owner commands</summary>


Code owners of `tuya` can trigger bot actions by commenting:

- `@home-assistant close` Closes the pull request.
- `@home-assistant rename Awesome new title` Renames the pull request.
- `@home-assistant reopen` Reopen the pull request.
- `@home-assistant unassign tuya` Removes the current integration label and assignees on the pull request, add the integration domain after the command.
- `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
- `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

</details>


author_association: CONTRIBUTOR
user: login: frenck
created_at: 2025-03-01T12:25:27Z
body: Oh hi there @maghiel 👋 

Is there any reason this pull request is currently in draft?

../Frenck
author_association: MEMBER
user: login: maghiel
created_at: 2025-03-01T13:06:32Z
body: > Oh hi there @maghiel 👋
> 
> Is there any reason this pull request is currently in draft?
> 
> ../Frenck

Hi @frenck! 
After my tuya camera fix I wanted to recheck this pr for duplication as well, that's why I reverted it to draft. Didn't have the time to look at it yet. 

Looking at it now there's not much duplicate code as it adds an externel temperature sensor.

I'll mark it ready for review :) (and ofcourse, suggestions/remarks/etc are welcome!)

author_association: CONTRIBUTOR
user: login: home-assistant[bot]
created_at: 2025-03-01T19:18:47Z
body: <!-- ReviewDrafterComment -->
Please take a look at the requested changes, and use the **Ready for review** button when you are done, thanks :+1:

[_Learn more about our pull request process._](https://developers.home-assistant.io/docs/review-process#prs-are-being-drafted-when-changes-are-needed)

author_association: CONTRIBUTOR