Tuya Smoke sensor with temperature and humidity

Hi, there is Tuya Smoke sensor, which has also temerature and humidity sensors in category “ywbj”. I would like to have these information also available in Home Assistant.

Device normal info

  • Brand: unknown
  • Model: WIFI Smoke detector with temp and humidity sensor

Device info

{
      "active_time": 1690391461,
      "biz_type": 18,
      "category": "ywbj",
      "create_time": 1690391461,
      "icon": "smart/icon/ay15427647462366edzT/13e5f1cb7df593e6b812947b9566d939.png",
      "id": "bf7ac46e4576493b73586z",
      "ip": "***",
      "lat": "***",
      "local_key": "***",
      "lon": "***",
      "model": "",
      "name": "Smoke sensor",
      "online": true,
      "owner_id": "153986064",
      "product_id": "fzb5up2iehjcrnqy",
      "product_name": "WIFI TH&Smoke sensor",
      "status": [
        {
          "code": "smoke_sensor_state",
          "value": "normal"
        },
        {
          "code": "battery_percentage",
          "value": 100
        },
        {
          "code": "muffling",
          "value": false
        },
        {
          "code": "temp_current",
          "value": 247
        },
        {
          "code": "humidity_value",
          "value": 63
        },
        {
          "code": "self_test",
          "value": true
        },
        {
          "code": "temp_alarm",
          "value": "cancel"
        }
      ],
      "sub": false,
      "time_zone": "+02:00",
      "uid": "***",
      "update_time": 1690752245,
      "uuid": "7326d42ff642b61f"
    }

Device specifications

2023-07-31 00:16:20.515 DEBUG (SyncWorker_0) [tuya_iot] Response: {
  "result": {
    "category": "ywbj",
    "functions": [
      {
        "code": "muffling",
        "type": "Boolean",
        "values": "{}"
      }
    ],
    "status": [
      {
        "code": "smoke_sensor_state",
        "type": "Enum",
        "values": "{\"range\":[\"alarm\",\"normal\"]}"
      },
      {
        "code": "battery_percentage",
        "type": "Integer",
        "values": "{\"unit\":\"%\",\"min\":0,\"max\":100,\"scale\":0,\"step\":1}"
      },
      {
        "code": "muffling",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "temp_current",
        "type": "Integer",
        "values": "{\"unit\":\"℃\",\"min\":-100,\"max\":1000,\"scale\":1,\"step\":1}"
      },
      {
        "code": "humidity_value",
        "type": "Integer",
        "values": "{\"unit\":\"%\",\"min\":1,\"max\":100,\"scale\":0,\"step\":1}"
      },
      {
        "code": "self_test",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "temp_alarm",
        "type": "Enum",
        "values": "{\"range\":[\"loweralarm\",\"upperalarm\",\"cancel\"]}"
      }
    ]
  },
  "success": true,
  "t": 1690755360426,
  "tid": "aa1794bb2f2611eea260e28454ac584b"
}

I have tried to edit sensors.py myself, but I’m probably doing something incorrectly as the entities are not added in Home Assistant

--- sensor.py_orig
+++ sensor.py
@@ -737,0 +738,12 @@
+        TuyaSensorEntityDescription(
+            key=DPCode.TEMP_CURRENT,
+            translation_key="temperature",
+            device_class=SensorDeviceClass.TEMPERATURE,
+            state_class=SensorStateClass.MEASUREMENT,
+        ),
+        TuyaSensorEntityDescription(
+            key=DPCode.HUMIDITY_VALUE,
+            translation_key="humidity",
+            device_class=SensorDeviceClass.HUMIDITY,
+            state_class=SensorStateClass.MEASUREMENT,
+        ),

It would be nice to see this work were did you find sensor.py files i also think it is dead of tuya side, the make a integration it work then it is done. I don’t think it should be hard because they have a temperature and humidity sensor stand alone that work. So i hope i see same action

The filie is located here: /usr/src/homeassistant/homeassistant/components/tuya/sensor.py in docker version. But I’m not sure if it is the correct one to edit, since it made no change in my case. I have also tried to delete __pycache__ folder with compiled python files. It gets recreated (which was expected) but I had no luck in getting new entities.
Footnote: I have never programmed anything in python.

I’m not sure why, but I’m not getting the temp and humidity information even in logs. I have checked on Tuya developer page again, that all DPs are there and I have even set the device to DP instruction set, but no luck yet.

For info, this is my log:

  "data": {
    "endpoint": "https://apigw.tuyaeu.com",
    "terminal_id": "###################",
    "mqtt_connected": true,
    "disabled_by": null,
    "disabled_polling": false,
    "id": "######################",
    "name": "Smoke sensor",
    "category": "ywbj",
    "product_id": "################",
    "product_name": "WIFI TH&Smoke sensor",
    "online": true,
    "sub": false,
    "time_zone": "+01:00",
    "active_time": "2025-01-19T22:25:14+00:00",
    "create_time": "2025-01-19T22:25:14+00:00",
    "update_time": "2025-01-19T22:25:14+00:00",
    "function": {
      "muffling": {
        "type": "Boolean",
        "value": {}
      }
    },
    "status_range": {
      "smoke_sensor_status": {
        "type": "Enum",
        "value": {
          "range": [
            "alarm",
            "normal"
          ]
        }
      },
      "battery_percentage": {
        "type": "Integer",
        "value": {
          "unit": "%",
          "min": 0,
          "max": 100,
          "scale": 0,
          "step": 1
        }
      },
      "muffling": {
        "type": "Boolean",
        "value": {}
      }
    },
    "status": {
      "smoke_sensor_status": "normal",
      "battery_percentage": 14,
      "muffling": false
    },
    "home_assistant": {
      "name": "Smoke sensor",
      "name_by_user": null,
      "disabled": false,
      "disabled_by": null,
      "entities": [
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": null,
          "device_class": null,
          "original_device_class": "smoke",
          "icon": null,
          "original_icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "binary_sensor.smoke_sensor_kour",
            "state": "off",
            "attributes": {
              "device_class": "smoke",
              "friendly_name": "Smoke sensor Kou\u0159"
            },
            "last_changed": "2025-01-26T21:01:18.476836+00:00",
            "last_reported": "2025-01-26T21:01:18.476836+00:00",
            "last_updated": "2025-01-26T21:01:18.476836+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "diagnostic",
          "device_class": null,
          "original_device_class": "battery",
          "icon": null,
          "original_icon": null,
          "unit_of_measurement": "%",
          "state": {
            "entity_id": "sensor.smoke_sensor_baterie",
            "state": "14.0",
            "attributes": {
              "state_class": "measurement",
              "unit_of_measurement": "%",
              "device_class": "battery",
              "friendly_name": "Smoke sensor Baterie"
            },
            "last_changed": "2025-01-26T21:01:20.494476+00:00",
            "last_reported": "2025-01-26T21:01:20.494476+00:00",
            "last_updated": "2025-01-26T21:01:20.494476+00:00"
          }
        }
      ]
    },
    "set_up": true,
    "support_local": true
  }
}

I have try to locate these files but so far no luck i find ever component except for tuya i have search my hole disk of the server no tuya map r anything to find and still my smoke detection work. My installation type is Home assistant OS on my NUC also on my test version PI no tuya be found but on both servers they work. Only PI is down after a update say errors in my configuration.yaml this is the second update in a row give me errors also funny. But saw on Home Assistant github ppl ask tuya items for temperature and humanity sensors on all kinds of items and they even see it in there logs it is been used. But also see on Tuya github that this project is dead for 3 years already so if it ever happend idk but already strange i can’t find the files at all

This part i also saw it is in there but not on HA server files i think

Tuya github might be dead as theintegration is now part of Home Assistant Core. It is strange, that you can’t find the filo on your system. Deffinitely shall be there.