make-all / tuya-local

Local support for Tuya devices in Home Assistant
MIT License
1.07k stars 435 forks source link

Request support for Zigbee Water leak sensor - onenuo 898wz #1912

Open dimasibs92 opened 1 month ago

dimasibs92 commented 1 month ago

Log Message

2024-05-12 21:57:44.540 WARNING (MainThread) [custom_components.tuya_local.config_flow] Device matches pir_sensor with quality of 100%. DPS: {"updated_at": 1715525857.8740737, "1": "normal", "4": 100} 2024-05-12 21:57:44.540 WARNING (MainThread) [custom_components.tuya_local.config_flow] Report this to https://github.com/make-all/tuya-local/issues/

Information about DPS mappings

{
  "result": {
    "model": "{\"modelId\":\"000003e0m2\",\"services\":[{\"actions\":[],\"code\":\"\",\"description\":\"\",\"events\":[],\"name\":\"默认服务\",\"properties\":[
{\"abilityId\":1,\"accessMode\":\"ro\",\"code\":\"watersensor_state\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-a_water\",\"attribute\":\"768\",\"trigger\":\"direct\"},\"name\":\"水浸检测状态\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"alarm\",\"normal\"]}},
{\"abilityId\":4,\"accessMode\":\"ro\",\"code\":\"battery_percentage\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_battery\",\"attribute\":\"640\",\"trigger\":\"direct\"},\"name\":\"电池电量\",\"typeSpec\":{\"type\":\"value\",\"max\":100,\"min\":0,\"scale\":0,\"step\":1,\"unit\":\"%\"}}]}]}"
  },
  "success": true,
  "t": 1715532551530,
  "tid": "8ec5fdfe107f11efa19236780218d147"
}

Product ID

"product_name": "Water leak sensor", "product_id": "upgcbody"

Information about how the device functions

https://zigbee.blakadder.com/Tuya_WL-898WZ.html

After reboot zigbee gateway while adding this device dps "1" is not shown. But when status on device is changed to "alarm" or "normal" dps "1" is available in log while adding.

dimasibs92 commented 1 month ago

YAML file for this device works correctly on this release

name: Water leak sensor
products:
  - id: upgcbody
    name: Zigbee Waterleak
primary_entity:
    entity: binary_sensor
    class: moisture
    dps:
      - id: 1
        type: string
        name: sensor
        optional: true
        persist: false
        mapping:
        - dps_val: "alarm"
          value: on
        - dps_val: "normal"
          value: off
          default: true
        - dps_val: null
          value: off
secondary_entities:
    - entity: sensor
      class: battery
      category: diagnostic
      dps:
        - id: 4
          type: integer
          name: sensor
          unit: "%"
          optional: true