Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request support for SMART WATER VALVE #2852

Open
Enrica-r opened this issue Jan 25, 2025 · 3 comments
Open

Request support for SMART WATER VALVE #2852

Enrica-r opened this issue Jan 25, 2025 · 3 comments
Labels
full_info All info needed was provided new device Unsupported device

Comments

@Enrica-r
Copy link

Enrica-r commented Jan 25, 2025

At the bottom after the description section, I have a working device config yaml, which works for me.

Log message

2025-01-25 14:38:44.448 DEBUG (SyncWorker_6) [custom_components.tuya_local.helpers.device_config] Loaded device config 1tuya_smart_water_vale.yaml
2025-01-25 14:38:44.450 DEBUG (SyncWorker_3) [custom_components.tuya_local.helpers.device_config] Loaded device config 1tuya_smart_water_vale.yaml
2025-01-25 14:38:44.451 DEBUG (SyncWorker_2) [custom_components.tuya_local.helpers.device_config] Loaded device config 1tuya_smart_water_vale.yaml
2025-01-25 14:38:44.451 DEBUG (MainThread) [custom_components.tuya_local.helpers.config] Adding number for number_flow_min_rate_set
2025-01-25 14:38:44.451 DEBUG (MainThread) [custom_components.tuya_local.helpers.config] Adding number for number_flow_max_rate_set
2025-01-25 14:38:44.452 DEBUG (MainThread) [custom_components.tuya_local.helpers.config] Adding switch for switch_valve_open
2025-01-25 14:38:44.452 DEBUG (MainThread) [custom_components.tuya_local.helpers.config] Adding select for select_flow_rate_unit
2025-01-25 14:38:44.476 DEBUG (MainThread) [custom_components.tuya_local.device] Tuya Smart Water Valve received {"1": false, "5": 0, "6": 523, "102": 1440, "108": 800, "109": 1310, "116": "3", "121": "0", "123": false, "124": true, "125": 0, "126": "on", "127": "on", "full_poll": true}
2025-01-25 14:38:44.476 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Tuya Smart Water Valve: Mapped dps 5 value from 0 to 0.0
2025-01-25 14:38:44.476 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Tuya Smart Water Valve: Mapped dps 5 value from 0 to 0.0
2025-01-25 14:38:44.477 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Tuya Smart Water Valve: Mapped dps 5 value from 0 to 0.0
2025-01-25 14:38:44.477 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Tuya Smart Water Valve: Mapped dps 5 value from 0 to 0.0
2025-01-25 14:38:44.477 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Tuya Smart Water Valve: Mapped dps 6 value from 523 to 197.97857440284665
2025-01-25 14:38:44.477 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Tuya Smart Water Valve: Mapped dps 6 value from 523 to 197.97857440284665
2025-01-25 14:38:44.477 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Tuya Smart Water Valve: Mapped dps 6 value from 523 to 52.3
2025-01-25 14:38:44.477 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Tuya Smart Water Valve: Mapped dps 6 value from 523 to 52.3
2025-01-25 14:38:44.477 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Tuya Smart Water Valve: Mapped dps 125 value from 0 to 0.0
2025-01-25 14:38:44.477 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Tuya Smart Water Valve: Mapped dps 125 value from 0 to 0.0
2025-01-25 14:38:44.477 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Tuya Smart Water Valve: Mapped dps 126 value from on to True
2025-01-25 14:38:44.477 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Tuya Smart Water Valve: Mapped dps 126 value from on to True
2025-01-25 14:38:44.477 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Tuya Smart Water Valve: Mapped dps 127 value from on to True
2025-01-25 14:38:44.477 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Tuya Smart Water Valve: Mapped dps 127 value from on to True
2025-01-25 14:38:44.477 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Tuya Smart Water Valve: Mapped dps 116 value from 3 to L
2025-01-25 14:38:44.477 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Tuya Smart Water Valve: Mapped dps 116 value from 3 to L
2025-01-25 14:38:44.738 DEBUG (MainThread) [custom_components.tuya_local.device] Tuya Smart Water Valve persistant connection set to True

Product ID

7lpbjkvri3bnpny2

Product Name

Tuya Smart Water Valve

DPS information

I can describe the dp_id's.

dp_id readable name code type Unit scale
1 Tap open switch boolean none
5 Current flow rate water_once integer gal/h 10
6 Water consumption water_total integer gal 10
102 Duration of single water use time_use_one integer min
108 Flow limit minimum Flowrater_min_set integer gal/h
109 Flow limit maximum Flowrater_max_set integer gal/h
116 Flow Units G_m string 1=gal/h, 2= m3/h, 3=L/h
123 Flow alarm switch total_switch boolean none
124 Reset total flow reset_switch boolean none
125 Water total per hour water_total_h integer gal 10
126 Flow High Alarm linkage flowrater_max_gang string "on", "off"
127 Flow Low Alarm linkage flowrater_min_gang string "on", "off"
{
"result": {
"properties": [
{
"code": "switch",
"custom_name": "",
"dp_id": 1,
"time": 1734097493790,
"type": "bool",
"value": false
},
{
"code": "water_once",
"custom_name": "",
"dp_id": 5,
"time": 1734097504546,
"type": "value",
"value": 0
},
{
"code": "water_total",
"custom_name": "",
"dp_id": 6,
"time": 1734097501626,
"type": "value",
"value": 255
},
{
"code": "time_use",
"custom_name": "",
"dp_id": 9,
"time": 1732712622991,
"type": "value",
"value": 0
},
{
"code": "weather_delay",
"custom_name": "",
"dp_id": 10,
"time": 1732712622991,
"type": "enum",
"value": "cancel"
},
{
"code": "countdown",
"custom_name": "",
"dp_id": 11,
"time": 1732712622991,
"type": "value",
"value": 0
},
{
"code": "work_state",
"custom_name": "",
"dp_id": 12,
"time": 1732712622991,
"type": "enum",
"value": "auto"
},
{
"code": "cycle_time",
"custom_name": "",
"dp_id": 13,
"time": 1732712622991,
"type": "string",
"value": ""
},
{
"code": "switch_weather",
"custom_name": "",
"dp_id": 15,
"time": 1732712622991,
"type": "bool",
"value": false
},
{
"code": "time_use_one",
"custom_name": "",
"dp_id": 102,
"time": 1734094277937,
"type": "value",
"value": 1
},
{
"code": "Flowrater_min_set",
"custom_name": "",
"dp_id": 108,
"time": 1734015495688,
"type": "value",
"value": 1200
},
{
"code": "Flowrater_max_set",
"custom_name": "",
"dp_id": 109,
"time": 1734015495688,
"type": "value",
"value": 1800
},
{
"code": "G_m",
"custom_name": "",
"dp_id": 116,
"time": 1734094283159,
"type": "enum",
"value": "1"
},
{
"code": "total_state",
"custom_name": "",
"dp_id": 121,
"time": 1734097504559,
"type": "enum",
"value": "0"
},
{
"code": "total_switch",
"custom_name": "",
"dp_id": 123,
"time": 1734098999660,
"type": "bool",
"value": false
},
{
"code": "reset_switch",
"custom_name": "",
"dp_id": 124,
"time": 1732712687979,
"type": "bool",
"value": true
},
{
"code": "water_total_h",
"custom_name": "",
"dp_id": 125,
"time": 1734097504640,
"type": "value",
"value": 0
},
{
"code": "flowrater_max_gang",
"custom_name": "",
"dp_id": 126,
"time": 1734096242153,
"type": "enum",
"value": "on"
},
{
"code": "flowrater_min_gang",
"custom_name": "",
"dp_id": 127,
"time": 1734095877089,
"type": "enum",
"value": "on"
}
]
},
"success": true,
"t": 1734099944086,
"tid": "2320446cb95e11efaf84fe4c51833753"
}

Diagnostic from Home Assistant:

Supported protcol version is 3.4

"data": {
"mqtt_connected": null,
"disabled_by": null,
"disabled_polling": false,
"id": "bf184a420c2ce8ffd05thm",
"name": "Wellness Pool Ventil",
"category": "sfkzq",
"local_key": "xxxxxxx",
"product_id": "7lpbjkvri3bnpny2",
"product_name": "Valve Controller",
"online": true,
"sub": false,
"time_zone": "+01:00",
"active_time": "2024-12-12T14:58:03+00:00",
"create_time": "2024-12-12T14:58:03+00:00",
"update_time": "2024-12-12T14:58:03+00:00",
"function": {
"switch": {
"type": "Boolean",
"value": {},
"property_update": false,
"accessMode": null,
"dpId": 1
},
"time_use": {
"type": "Integer",
"value": {
"unit": "h",
"min": 0,
"max": 999999999,
"scale": 0,
"step": 1
},
"property_update": false,
"accessMode": null,
"dpId": 9
},
"weather_delay": {
"type": "Enum",
"value": {
"range": [
"cancel",
"24h",
"48h",
"72h"
]
},
"property_update": false,
"accessMode": null,
"dpId": 10
},
"countdown": {
"type": "Integer",
"value": {
"unit": "s",
"min": 0,
"max": 86400,
"scale": 0,
"step": 1
},
"property_update": false,
"accessMode": null,
"dpId": 11
},
"cycle_time": {
"type": "String",
"value": {},
"property_update": null,
"accessMode": null,
"dpId": null
}
},
"status_range": {
"switch": {
"type": "Boolean",
"value": {},
"property_update": false,
"access_mode": null,
"dpId": 1
},
"water_once": {
"type": "Integer",
"value": {
"unit": "gal/h",
"min": 0,
"max": 12000,
"scale": 1,
"step": 1
},
"property_update": false,
"access_mode": null,
"dpId": 5
},
"water_total": {
"type": "Integer",
"value": {
"unit": "gal",
"min": 0,
"max": 999999999,
"scale": 1,
"step": 1
},
"property_update": false,
"access_mode": null,
"dpId": 6
},
"time_use": {
"type": "Integer",
"value": {
"unit": "h",
"min": 0,
"max": 999999999,
"scale": 0,
"step": 1
},
"property_update": false,
"access_mode": null,
"dpId": 9
},
"weather_delay": {
"type": "Enum",
"value": {
"range": [
"cancel",
"24h",
"48h",
"72h"
]
},
"property_update": false,
"access_mode": null,
"dpId": 10
},
"countdown": {
"type": "Integer",
"value": {
"unit": "s",
"min": 0,
"max": 86400,
"scale": 0,
"step": 1
},
"property_update": false,
"access_mode": null,
"dpId": 11
},
"work_state": {
"type": "Enum",
"value": {
"range": [
"auto",
"manual",
"idle"
]
},
"property_update": false,
"access_mode": null,
"dpId": 12
}
},
"status": {
"switch": false,
"water_once": 0,
"water_total": 255,
"time_use": 0,
"weather_delay": "cancel",
"countdown": 0,
"work_state": "auto"
},
"local_strategy": {
"1": {
"value_convert": "default",
"status_code": "switch",
"config_item": {
"statusFormat": "{"switch": "$"}",
"valueDesc": "{}",
"valueType": "Boolean",
"enumMappingMap": {},
"pid": "7lpbjkvri3bnpny2"
},
"status_code_alias": [],
"property_update": false,
"use_open_api": false
},
"5": {
"value_convert": "default",
"status_code": "water_once",
"config_item": {
"statusFormat": "{"water_once": "$"}",
"valueDesc": "{"unit": "gal/h", "min": 0, "max": 12000, "scale": 1, "step": 1}",
"valueType": "Integer",
"enumMappingMap": {},
"pid": "7lpbjkvri3bnpny2"
},
"status_code_alias": [],
"property_update": false,
"use_open_api": false
},
"6": {
"value_convert": "default",
"status_code": "water_total",
"config_item": {
"statusFormat": "{"water_total": "$"}",
"valueDesc": "{"unit": "gal", "min": 0, "max": 999999999, "scale": 1, "step": 1}",
"valueType": "Integer",
"enumMappingMap": {},
"pid": "7lpbjkvri3bnpny2"
},
"status_code_alias": [],
"property_update": false,
"use_open_api": false
},
"9": {
"value_convert": "default",
"status_code": "time_use",
"config_item": {
"statusFormat": "{"time_use": "$"}",
"valueDesc": "{"unit": "h", "min": 0, "max": 999999999, "scale": 0, "step": 1}",
"valueType": "Integer",
"enumMappingMap": {},
"pid": "7lpbjkvri3bnpny2"
},
"status_code_alias": [],
"property_update": false,
"use_open_api": false
},
"10": {
"value_convert": "default",
"status_code": "weather_delay",
"config_item": {
"statusFormat": "{"weather_delay": "$"}",
"valueDesc": "{"range": ["cancel", "24h", "48h", "72h"]}",
"valueType": "Enum",
"enumMappingMap": {},
"pid": "7lpbjkvri3bnpny2"
},
"status_code_alias": [],
"property_update": false,
"use_open_api": false
},
"11": {
"value_convert": "default",
"status_code": "countdown",
"config_item": {
"statusFormat": "{"countdown": "$"}",
"valueDesc": "{"unit": "s", "min": 0, "max": 86400, "scale": 0, "step": 1}",
"valueType": "Integer",
"enumMappingMap": {},
"pid": "7lpbjkvri3bnpny2"
},
"status_code_alias": [],
"property_update": false,
"use_open_api": false
},
"12": {
"value_convert": "default",
"status_code": "work_state",
"config_item": {
"statusFormat": "{"work_state": "$"}",
"valueDesc": "{"range": ["auto", "manual", "idle"]}",
"valueType": "Enum",
"enumMappingMap": {},
"pid": "7lpbjkvri3bnpny2"
},
"status_code_alias": [],
"property_update": false,
"use_open_api": false
}
},
"home_assistant": {
"name": "Wellness Pool Ventil",
"name_by_user": null,
"disabled": false,
"disabled_by": null,
"entities": [
{
"disabled": false,
"disabled_by": null,
"entity_category": "config",
"device_class": null,
"original_device_class": null,
"icon": null,
"original_icon": null,
"unit_of_measurement": null,
"state": {
"entity_id": "select.wellness_pool_ventil_wetterverzogerung",
"state": "cancel",
"attributes": {
"options": [
"cancel",
"24h",
"48h",
"72h"
],
"friendly_name": "Wellness Pool Ventil Wetterverz\u00f6gerung"
},
"last_changed": "2024-12-13T14:45:12.092212+00:00",
"last_reported": "2024-12-13T14:45:12.092270+00:00",
"last_updated": "2024-12-13T14:45:12.092212+00:00"
}
},
{
"disabled": false,
"disabled_by": null,
"entity_category": "diagnostic",
"device_class": null,
"original_device_class": null,
"icon": null,
"original_icon": null,
"unit_of_measurement": "h",
"state": {
"entity_id": "sensor.wellness_pool_ventil_bewasserungszeit_insgesamt",
"state": "0.0",
"attributes": {
"state_class": "total_increasing",
"unit_of_measurement": "h",
"friendly_name": "Wellness Pool Ventil Bew\u00e4sserungszeit insgesamt"
},
"last_changed": "2024-12-13T14:45:12.127804+00:00",
"last_reported": "2024-12-13T14:45:12.127859+00:00",
"last_updated": "2024-12-13T14:45:12.127804+00:00"
}
},
{
"disabled": false,
"disabled_by": null,
"entity_category": null,
"device_class": null,
"original_device_class": null,
"icon": null,
"original_icon": null,
"unit_of_measurement": null,
"state": {
"entity_id": "switch.wellness_pool_ventil_schalter",
"state": "off",
"attributes": {
"friendly_name": "Wellness Pool Ventil Schalter"
},
"last_changed": "2024-12-13T14:45:12.132765+00:00",
"last_reported": "2024-12-13T14:45:12.132808+00:00",
"last_updated": "2024-12-13T14:45:12.132765+00:00"
}
}
]
},
"set_up": true,
"support_local": true,
"data_model": ""

Information about how the device functions

The Tuya product Smart Water Valve isn't supported by Home Assistant core nor with xtend Tuya.

Here is the link to this product: Smart Water Valve

In Tuya Smart following properies are available:

Status of valve

  • Flow rate in units gal/h, m3/h or L/h

  • High traffic flow rate alarm linkage

  • Low traffic flow rate alarm linkage

  • Flow rate alarm on/off

Actions:

  • Open/close Valve

Here are two screen shots of Tuya App:
Image

Image

Device YAML config

I have created an own device YAML file which work in my Home Assistant almost perfectly. I produce two attributes for "flow per hour" one in gal/hand one in L/h. Unfortunately I can't round the value in mapping statement to two decimal places. Here is my definition:

name: Tuya Smart Water Valve
products:
  - id: 7lpbjkvri3bnpny2
    name: Tuya Smart Water Valve
primary_entity:
  entity: switch
  name: Valve open
  icon: "mdi:water-pump"
  dps:
    - id: 1
      type: boolean
      name: switch
secondary_entities:
  - entity: sensor
    name: Current flow rate
    category: diagnostic
    icon: "mdi:waves-arrow-right"
    dps:
      - id: 5
        name: sensor
        type: integer
        unit: gal/h
        class: measurement
        mapping:
          - scale: 10
  - entity: sensor
    name: Current flow rate in l
    category: diagnostic
    icon: "mdi:waves-arrow-right"
    dps:
      - id: 5
        name: sensor
        type: integer
        unit: L/h
        class: measurement
        mapping:
          - scale: 2.6417
  - entity: sensor
    name: Water consumption in l
    category: diagnostic
    icon: "mdi:cup-water"
    dps:
      - id: 6
        name: sensor
        type: integer
        unit: L
        class: total
        mapping:
          - scale: 2.6417
  - entity: sensor
    name: Water consumption
    category: diagnostic
    icon: "mdi:cup-water"
    dps:
      - id: 6
        name: sensor
        type: integer
        unit: gal
        class: total
        mapping:
          - scale: 10
  - entity: sensor
    name: Duration sing water use
    category: diagnostic
    dps:
      - id: 102
        name: sensor
        type: integer
        unit: min
        class: duration
  - entity: sensor
    name: Water total per hour
    category: diagnostic
    dps:
      - id: 125
        name: sensor
        type: integer
        unit: gal
        mapping:
          - scale: 10
  - entity: number
    name: "Flow min rate set"
    class: volume_flow_rate
    category: config
    dps:
      - id: 108
        name: value
        type: integer
        unit: gal/h
        range:
          min: 0
          max: 4000
  - entity: number
    name: "Flow max rate set"
    class: volume_flow_rate
    category: config
    dps:
      - id: 109
        name: value
        type: integer
        unit: gal/h
        range:
          min: 0
          max: 4000
  - entity: select
    name: Flow Rate Unit
    class: water
    category: config
    dps:
      - id: 116
        name: option
        type: string
        mapping:
          - dps_val: "1"
            value: gal/h
          - dps_val: "2"
            value: m3/h
          - dps_val: "3"
            value: L
  - entity: sensor
    name: water_total_per_hour
    category: diagnostic
    dps:
      - id: 125
        name: sensor
        type: integer
        unit: gal
        mapping:
          - scale: 10
  - entity: sensor
    name: High Flow Alarm
    category: diagnostic
    dps:
      - id: 126
        name: sensor
        type: string
        mapping:
          - dps_val: "on"
            value: true
          - dps_val: "off"
            value: false
  - entity: sensor
    name: Low Flow Alarm
    category: diagnostic
    dps:
      - id: 127
        name: sensor
        type: string
        mapping:
          - dps_val: "on"
            value: true
          - dps_val: "off"
            value: false

Could you check the code if it's enough for your quality and put it into the repo officially.

Thank you very much.

@Enrica-r Enrica-r added the new device Unsupported device label Jan 25, 2025
@make-all make-all added the full_info All info needed was provided label Jan 25, 2025
@make-all make-all moved this to 🔖 Ready in Tuya Local Jan 25, 2025
@louispires
Copy link

I just got this same device installed today! Very nice bit of kit, would be amazing to have this supported.

@Enrica-r
Copy link
Author

@louispires You could open file editor or Studio Code Server and create a file like 1tuya_smart_water_valve.yaml in path Config/custom_components/tuya_local/devices/. Copy/paste the content of the yaml definition above.

Be aware that the file will be overwritten after each update. That's why this request solves this.

@louispires
Copy link

Thank you @Enrica-r , got it working 10 minutes after commenting on here!

Working great thanks, I wonder how hard it would be to add this permanently to the Repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
full_info All info needed was provided new device Unsupported device
Projects
Status: 🔖 Ready
Development

No branches or pull requests

3 participants