Skip to content

Add humidity_value support for climate sensors#4

Open
evaldnet wants to merge 1 commit intoDrenso:mainfrom
evaldnet:add-humidity-value-support
Open

Add humidity_value support for climate sensors#4
evaldnet wants to merge 1 commit intoDrenso:mainfrom
evaldnet:add-humidity-value-support

Conversation

@evaldnet
Copy link
Copy Markdown

Summary

  • Added humidity_value as an alternative Tuya status code for humidity (maps to measure_humidity)
  • Some Tuya climate sensors report humidity using humidity_value instead of va_humidity
  • Added corresponding scaling setting for devices that need it

Device tested

  • Device: T & H Sensor
  • Product ID: 7akwzwfwhukkdsib
  • Category: wsdcg

Device status codes:

{ "code": "va_temperature", "value": 183 },
{ "code": "humidity_value", "value": 56 },
{ "code": "temp_unit_convert", "value": "c" }

Changes

  • TuyaClimateSensorConstants.ts: Added humidity_value to capabilities and mapping
  • driver.settings.compose.json: Added scaling setting for humidity_value

🤖 Generated with Claude Code

@bobvandevijver
Copy link
Copy Markdown
Member

We will need the device specification to be able to verify this change; you can use https://github.com/Drenso/com.tuya2/blob/main/docs/device-request.md to see how to retrieve the specification.

As is, it will add a duplicate setting, which is undesirable as it makes the interaction completely unclear for the user. We will need some additional alias mapping for tuyaCapability -> scalingSetting. We will look into this.

@evaldnet
Copy link
Copy Markdown
Author

Here is the device specification for my T & H Sensor:

{
  "device": {
    "category": "wsdcg",
    "product_id": "7akwzwfwhukkdsib",
    "product_name": "T & H Sensor",
    "name": "T & H Sensor",
    "online": true,
    "status": [
      { "code": "va_temperature", "value": 183 },
      { "code": "humidity_value", "value": 56 },
      { "code": "temp_unit_convert", "value": "c" }
    ]
  },
  "specifications": {
    "category": "wsdcg",
    "functions": [
      {
        "code": "temp_unit_convert",
        "type": "Enum",
        "values": "{\"range\":[\"c\",\"f\"]}"
      }
    ],
    "status": [
      {
        "code": "va_temperature",
        "type": "Integer",
        "values": "{\"unit\":\"\",\"min\":-200,\"max\":600,\"scale\":1,\"step\":1}"
      },
      {
        "code": "humidity_value",
        "type": "Integer",
        "values": "{\"unit\":\"%\",\"min\":0,\"max\":100,\"scale\":0,\"step\":1}"
      },
      {
        "code": "temp_unit_convert",
        "type": "Enum",
        "values": "{\"range\":[\"c\",\"f\"]}"
      }
    ]
  }
}

Note: humidity_value has scale: 0 (no decimal adjustment needed), while va_temperature has scale: 1.

Regarding the duplicate setting concern - I understand. Happy to update the PR if you'd like me to implement the alias mapping, or I can wait for your guidance on the preferred approach.

@evaldnet
Copy link
Copy Markdown
Author

Apologies, here is the full device specification from Homey (my.homey.app → Device Settings → Device Specification):

{
  "device": {
    "active_time": 1713609335,
    "biz_type": 0,
    "category": "wsdcg",
    "create_time": 1713609335,
    "icon": "smart/icon/ay1525749833414yotNt/60d869bb20b0e1b0f0347a9fd8781a3c.png",
    "id": "<redacted>",
    "ip": "<redacted>",
    "lat": "<redacted>",
    "local_key": "<redacted>",
    "lon": "<redacted>",
    "name": "T & H Sensor",
    "online": true,
    "owner_id": "<redacted>",
    "product_id": "7akwzwfwhukkdsib",
    "product_name": "T & H Sensor",
    "status": [
      { "code": "va_temperature", "value": 183 },
      { "code": "humidity_value", "value": 56 },
      { "code": "temp_unit_convert", "value": "c" }
    ],
    "sub": false,
    "time_zone": "+02:00",
    "uid": "<redacted>",
    "update_time": 1713609335,
    "uuid": "<redacted>"
  },
  "specifications": {
    "category": "wsdcg",
    "functions": [
      {
        "code": "temp_unit_convert",
        "type": "Enum",
        "values": "{\"range\":[\"c\",\"f\"]}"
      }
    ],
    "status": [
      {
        "code": "va_temperature",
        "type": "Integer",
        "values": "{\"unit\":\"\",\"min\":-200,\"max\":600,\"scale\":1,\"step\":1}"
      },
      {
        "code": "humidity_value",
        "type": "Integer",
        "values": "{\"unit\":\"%\",\"min\":0,\"max\":100,\"scale\":0,\"step\":1}"
      },
      {
        "code": "temp_unit_convert",
        "type": "Enum",
        "values": "{\"range\":[\"c\",\"f\"]}"
      }
    ]
  },
  "data_points": "<not available>"
}

Some Tuya climate sensors report humidity using the 'humidity_value'
status code instead of 'va_humidity'. This adds support for both codes
by mapping humidity_value to measure_humidity capability.

Tested with T & H Sensor (product_id: 7akwzwfwhukkdsib).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@evaldnet evaldnet force-pushed the add-humidity-value-support branch from d5ca1b3 to 3872bfe Compare January 13, 2026 19:04
@bobvandevijver
Copy link
Copy Markdown
Member

Thank you for the specification. We have put this on our internal backlog for review as soon as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants