make-all / tuya-local

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

Request support for SOP10 Water Sprinkler #1964

Open FreemanJD opened 1 month ago

FreemanJD commented 1 month ago

Log Message

Logger: custom_components.tuya_local.config_flow
Source: custom_components/tuya_local/config_flow.py:460
integration: Tuya Local ([documentation](https://github.com/make-all/tuya-local), [issues](https://github.com/make-all/tuya-local/issues))
First occurred: 3:45:44 PM (1 occurrences)
Last logged: 3:45:44 PM

Device matches simple_switch_timer with quality of 50%. DPS: {"updated_at": 1717047939.9828355, "1": false, "7": 43, "9": 141982, "10": "48h", "11": 419, "12": "idle", "14": true, "15": 6}

Information about DPS mappings

{
  "result": {
    "properties": [
      {
        "code": "switch",
        "custom_name": "",
        "dp_id": 1,
        "time": 1717046630834,
        "value": false
      },
      {
        "code": "fault",
        "custom_name": "",
        "dp_id": 4,
        "time": 1673502702018,
        "value": 0
      },
      {
        "code": "battery_percentage",
        "custom_name": "",
        "dp_id": 7,
        "time": 1717047449635,
        "value": 43
      },
      {
        "code": "time_use",
        "custom_name": "",
        "dp_id": 9,
        "time": 1717046630831,
        "value": 141982
      },
      {
        "code": "weather_delay",
        "custom_name": "",
        "dp_id": 10,
        "time": 1717042447000,
        "value": "48h"
      },
      {
        "code": "countdown",
        "custom_name": "",
        "dp_id": 11,
        "time": 1717048354339,
        "value": 0
      },
      {
        "code": "work_state",
        "custom_name": "",
        "dp_id": 12,
        "time": 1717046630832,
        "value": "idle"
      },
      {
        "code": "smart_weather",
        "custom_name": "",
        "dp_id": 13,
        "time": 1673502702018,
        "value": "sunny"
      },
      {
        "code": "switch_weather",
        "custom_name": "",
        "dp_id": 14,
        "time": 1717042447000,
        "value": true
      },
      {
        "code": "use_time_one",
        "custom_name": "",
        "dp_id": 15,
        "time": 1717046628000,
        "value": 6
      },
      {
        "code": "cycle_timing",
        "custom_name": "",
        "dp_id": 16,
        "time": 1717047449934,
        "value": "AA=="
      },
      {
        "code": "timer",
        "custom_name": "",
        "dp_id": 17,
        "time": 1717047450342,
        "value": "AAACAwAORGQAAAAAAAA="
      }
    ]
  },
  "success": true,
  "t": 1717048667001,
  "tid": "8a0b9a2a1e4911ef93a836b97fb7f5f7"
}

Product ID

"result": [ { "active_time": 1673502702, "bind_space_id": "42410714", "category": "sfkzq", "create_time": 1673502702, "custom_name": "Sprinkler", "icon": "smart/icon/ay1501578980436KOuNc/f922fa59436bd4ac23527b9a062b4365.png", "id": "##", "ip": "", "is_online": true, "lat": "-34.0623", "local_key": "##", "lon": "150.7338", "model": "SOP10", "name": "Smart Water Timer", "product_id": "nxquc5lb", "product_name": "一出一水阀(网关+BLE)", "sub": true, "time_zone": "+11:00", "update_time": 1696150035, "uuid": “##"

Sprinkler has basic function support under "switch with timer." However timer function does not work properly. Proper function including battery percentage would greatly assist.

make-all commented 1 month ago

Timer functions can only be made to work properly if you provide the full information from QueryThingsDataModel (/v2.0/cloud/thing/DEVICE_ID/model) which will include details like range, scale, step for those numeric values, and list of possible values for enum types like weather_delay.

FreemanJD commented 1 month ago

Sorry is this what you need?

switch Boolean "{true,false}" battery_percentage Integer { "unit": "%", "min": 0, "max": 100, "scale": 0, "step": 1 } time_use Integer { "unit": "s", "min": 0, "max": 2592000, "scale": 0, "step": 1 } weather_delay Enum
{ "range": [ "cancel", "24h", "48h", "72h" ] } countdown Integer { "unit": "s", "min": 0, "max": 86400, "scale": 0, "step": 1 } work_state Enum
{ "range": [ "auto", "manual", "idle" ] } smart_weather Enum
{ "range": [ "sunny", "cloudy", "rainy" ] } use_time_one Integer { "unit": "s", "min": 0, "max": 86400, "scale": 0, "step": 1 }

This is from the API - Query Things Data Model:

{ "result": { "model": "{\"modelId\":\"00000208kg\",\"services\":[{\"actions\":[],\"code\":\"\",\"description\":\"\",\"events\":[],\"name\":\"默认服务\",\"properties\":[{\"abilityId\":1,\"accessMode\":\"rw\",\"code\":\"switch\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_power\",\"attribute\":\"640\"},\"name\":\"阀门开关\",\"typeSpec\":{\"type\":\"bool\"}},{\"abilityId\":4,\"accessMode\":\"ro\",\"code\":\"fault\",\"description\":\"\",\"extensions\":{\"attribute\":\"128\"},\"name\":\"故障上报\",\"typeSpec\":{\"type\":\"bitmap\",\"label\":[\"low_battery\",\"fault\",\"lack_water\",\"sensor_fault\",\"motor_fault\"],\"maxlen\":5}},{\"abilityId\":7,\"accessMode\":\"ro\",\"code\":\"battery_percentage\",\"description\":\"\",\"extensions\":{\"attribute\":\"192\"},\"name\":\"电池电量\",\"typeSpec\":{\"type\":\"value\",\"max\":100,\"min\":0,\"scale\":0,\"step\":1,\"unit\":\"%\"}},{\"abilityId\":9,\"accessMode\":\"rw\",\"code\":\"time_use\",\"description\":\"\",\"extensions\":{\"attribute\":\"640\"},\"name\":\"累计使用时间\",\"typeSpec\":{\"type\":\"value\",\"max\":2592000,\"min\":0,\"scale\":0,\"step\":1,\"unit\":\"s\"}},{\"abilityId\":10,\"accessMode\":\"rw\",\"code\":\"weather_delay\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-shidu\",\"attribute\":\"640\"},\"name\":\"天气延时\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"cancel\",\"24h\",\"48h\",\"72h\"]}},{\"abilityId\":11,\"accessMode\":\"rw\",\"code\":\"countdown\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-timer1\",\"attribute\":\"640\"},\"name\":\"灌溉时间\",\"typeSpec\":{\"type\":\"value\",\"max\":86400,\"min\":0,\"scale\":0,\"step\":1,\"unit\":\"s\"}},{\"abilityId\":12,\"accessMode\":\"ro\",\"code\":\"work_state\",\"description\":\"\",\"extensions\":{\"attribute\":\"640\"},\"name\":\"工作状态\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"auto\",\"manual\",\"idle\"]}},{\"abilityId\":13,\"accessMode\":\"rw\",\"code\":\"smart_weather\",\"description\":\"\",\"extensions\":{\"attribute\":\"128\"},\"name\":\"智能天气\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"sunny\",\"cloudy\",\"rainy\",\"snowy\"]}},{\"abilityId\":14,\"accessMode\":\"rw\",\"code\":\"switch_weather\",\"description\":\"\",\"extensions\":{\"attribute\":\"640\"},\"name\":\"智能天气\",\"typeSpec\":{\"type\":\"bool\"}},{\"abilityId\":15,\"accessMode\":\"ro\",\"code\":\"use_time_one\",\"description\":\"\",\"extensions\":{\"attribute\":\"128\"},\"name\":\"单次使用时间\",\"typeSpec\":{\"type\":\"value\",\"max\":86400,\"min\":0,\"scale\":0,\"step\":1,\"unit\":\"s\"}},{\"abilityId\":16,\"accessMode\":\"rw\",\"code\":\"cycle_timing\",\"description\":\"\",\"extensions\":{\"attribute\":\"128\"},\"name\":\"循环定时\",\"typeSpec\":{\"type\":\"raw\",\"maxlen\":128}},{\"abilityId\":17,\"accessMode\":\"rw\",\"code\":\"timer\",\"description\":\"可按要求自定义时间完成阀门开启/关闭、以及灌溉时间,可自定义多组,支持周循环、奇偶日、隔天循环定时。\",\"extensions\":{\"attribute\":\"128\"},\"name\":\"定时\",\"typeSpec\":{\"type\":\"raw\",\"maxlen\":128}}]}]}" }, "success": true, "t": 1717112947867, "tid": "34663bd21edf11efb9a3028d4a92b5f0" }

Hope that can help.

make-all commented 1 month ago

Yes, that is the info, thanks.