tuya/tuya-home-assistant

Tuya Wireless (bluetooth) Temp & Humidity Sensor (TH05)

Open

#932 geöffnet am 5. Juni 2023

Auf GitHub ansehen
 (15 Kommentare) (11 Reaktionen) (0 zugewiesene Personen) (206 Forks)github user discovery
enhancementhelp wanted

Repository-Metriken

Stars
 (960 Stars)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

Device normal info

  • Tuya Wireless (bluetooth) Temp & Humidity Sensor
  • TH05

Note it properly reads the status of the device

    "status": {
      "va_temperature": 227,
      "va_humidity": 39,
      "battery_percentage": 100,
      "temp_unit_convert": "c"
    }

but can't map it to the home assistant sensor values and shows them as unavailable, look at full device logs info below

Device info:

 "data": {
    "endpoint": "https://openapi.tuyaeu.com",
    "auth_type": 0,
    "country_code": "380",
    "app_type": "smartlife",
    "mqtt_connected": true,
    "disabled_by": null,
    "disabled_polling": false,
    "name": "THS",
    "model": "TH05",
    "category": "wsdcg",
    "product_id": "vyfoip9h",
    "product_name": "Temp & Humidity Sensor",
    "online": false,
    "sub": false,
    "time_zone": "+03:00",
    "active_time": "2023-06-05T10:31:39+00:00",
    "create_time": "2023-06-05T09:27:44+00:00",
    "update_time": "2023-06-05T10:31:40+00:00",
    "function": {
      "temp_unit_convert": {
        "type": "Enum",
        "value": {
          "range": [
            "c",
            "f"
          ]
        }
      }
    },
    "status_range": {
      "va_temperature": {
        "type": "Integer",
        "value": {
          "unit": "\u2103",
          "min": -100,
          "max": 600,
          "scale": 1,
          "step": 1
        }
      },
      "va_humidity": {
        "type": "Integer",
        "value": {
          "unit": "%",
          "min": 0,
          "max": 100,
          "scale": 0,
          "step": 1
        }
      },
      "battery_percentage": {
        "type": "Integer",
        "value": {
          "unit": "%",
          "min": 0,
          "max": 100,
          "scale": 0,
          "step": 1
        }
      },
      "temp_unit_convert": {
        "type": "Enum",
        "value": {
          "range": [
            "c",
            "f"
          ]
        }
      }
    },
    "status": {
      "va_temperature": 227,
      "va_humidity": 39,
      "battery_percentage": 100,
      "temp_unit_convert": "c"
    },
    "home_assistant": {
      "name": "THS",
      "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.ths_temperature",
            "state": "unavailable",
            "attributes": {
              "state_class": "measurement",
              "unit_of_measurement": "\u00b0C",
              "device_class": "temperature",
              "friendly_name": "THS Temperature"
            },
            "last_changed": "2023-06-05T11:25:54.438667+00:00",
            "last_updated": "2023-06-05T11:25:54.438667+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.ths_humidity",
            "state": "unavailable",
            "attributes": {
              "state_class": "measurement",
              "unit_of_measurement": "%",
              "device_class": "humidity",
              "friendly_name": "THS Humidity"
            },
            "last_changed": "2023-06-05T11:25:54.439983+00:00",
            "last_updated": "2023-06-05T11:25:54.439983+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.ths_battery",
            "state": "unavailable",
            "attributes": {
              "state_class": "measurement",
              "unit_of_measurement": "%",
              "device_class": "battery",
              "friendly_name": "THS Battery"
            },
            "last_changed": "2023-06-05T11:25:54.444551+00:00",
            "last_updated": "2023-06-05T11:25:54.444551+00:00"
          }
        }
      ]
    }
  }

Device specifications:

{
  "result": {
    "category": "wsdcg",
    "functions": [
      {
        "code": "temp_unit_convert",
        "lang_config": {
          "c": "℃",
          "f": "℉"
        },
        "name": "Unit convert",
        "type": "Enum",
        "values": "{\"range\":[\"c\",\"f\"]}"
      }
    ],
    "status": [
      {
        "code": "va_temperature",
        "lang_config": {
          "unit": "℃"
        },
        "name": "Temperature",
        "type": "Integer",
        "values": "{\"unit\":\"℃\",\"min\":-100,\"max\":600,\"scale\":1,\"step\":1}"
      },
      {
        "code": "va_humidity",
        "lang_config": {
          "unit": "%"
        },
        "name": "Humidity",
        "type": "Integer",
        "values": "{\"unit\":\"%\",\"min\":0,\"max\":100,\"scale\":0,\"step\":1}"
      },
      {
        "code": "battery_percentage",
        "lang_config": {
          "unit": "%"
        },
        "name": "Battery level",
        "type": "Integer",
        "values": "{\"unit\":\"%\",\"min\":0,\"max\":100,\"scale\":0,\"step\":1}"
      },
      {
        "code": "temp_unit_convert",
        "lang_config": {
          "c": "℃",
          "f": "℉"
        },
        "name": "Unit convert",
        "type": "Enum",
        "values": "{\"range\":[\"c\",\"f\"]}"
      }
    ]
  },
  "success": true,
  "t": 1685965033187,
  "tid": "508578ff039511eebfbfa24bf1d21c99"
}

Contributor Guide