tuya / tuya-home-assistant

Home Assistant integration for controlling Powered by Tuya (PBT) devices using Tuya Open API, maintained by the Home Assistant Community and Tuya Developer Team.
MIT License
868 stars 206 forks source link

Add support for smart water quality meter Yieryi YY-W9909 #890

Open sleepingsparrow opened 1 year ago

sleepingsparrow commented 1 year ago

Please add support for smart water quality meter Yieryi YY-W9909. It currently only shows water temperature and I wish it would also show pH, TDS, EC, Salinity, and Proportion (specific gravity).

Data shows up in the Tuya IOT platform Device Debugging

image

The tuya integeration data diagnostics shows the following:

"data": { "endpoint": "https://openapi.tuyaus.com", "auth_type": 0, "country_code": "1", "app_type": "tuyaSmart", "mqtt_connected": true, "disabled_by": null, "disabled_polling": false, "devices": [ { "name": "FishTank", "model": "YY-9909", "category": "dgnbj", "product_id": "5ok0wq7drlqyo2hb", "product_name": "YY-9909", "online": true, "sub": false, "time_zone": "-06:00", "active_time": "2022-09-19T18:52:33+00:00", "create_time": "2022-09-19T18:45:50+00:00", "update_time": "2022-09-19T18:56:55+00:00", "function": { "ph_warn_max": { "type": "Integer", "value": { "unit": "", "min": 0, "max": 1500, "scale": 2, "step": 1 } }, "ph_warn_min": { "type": "Integer", "value": { "unit": "", "min": 0, "max": 1500, "scale": 2, "step": 1 } }, "temp_warn_max": { "type": "Integer", "value": { "unit": "\u2103", "min": -100, "max": 1100, "scale": 1, "step": 1 } }, "temp_warn_min": { "type": "Integer", "value": { "unit": "\u2103", "min": -100, "max": 1100, "scale": 1, "step": 1 } }, "tds_warn_max": { "type": "Integer", "value": { "unit": "ppm", "min": 0, "max": 199999, "scale": 0, "step": 1 } }, "tds_warn_min": { "type": "Integer", "value": { "unit": "ppm", "min": 0, "max": 199999, "scale": 0, "step": 1 } }, "ec_warn_max": { "type": "Integer", "value": { "unit": "us", "min": 0, "max": 199999, "scale": 0, "step": 1 } }, "ec_warn_min": { "type": "Integer", "value": { "unit": "us", "min": 0, "max": 199999, "scale": 0, "step": 1 } }, "salinity_warn_max": { "type": "Integer", "value": { "unit": "ppm", "min": 0, "max": 199999, "scale": 0, "step": 1 } }, "salinity_warn_min": { "type": "Integer", "value": { "unit": "ppm", "min": 0, "max": 199999, "scale": 0, "step": 1 } }, "pro_warn_max": { "type": "Integer", "value": { "unit": "S.G", "min": 500, "max": 2000, "scale": 3, "step": 1 } }, "pro_warn_min": { "type": "Integer", "value": { "unit": "S.G", "min": 500, "max": 2000, "scale": 3, "step": 1 } }, "orp_warn_max": { "type": "Integer", "value": { "unit": "mV", "min": -2000, "max": 2000, "scale": 0, "step": 1 } }, "orp_warn_min": { "type": "Integer", "value": { "unit": "mV", "min": -2000, "max": 2000, "scale": 0, "step": 1 } }, "cf_warn_max": { "type": "Integer", "value": { "unit": "CF", "min": 0, "max": 199999, "scale": 2, "step": 1 } }, "cf_warn_min": { "type": "Integer", "value": { "unit": "CF", "min": 1, "max": 199999, "scale": 2, "step": 1 } }, "rh_warn_max": { "type": "Integer", "value": { "unit": "%", "min": 0, "max": 100, "scale": 0, "step": 1 } }, "rh_warn_min": { "type": "Integer", "value": { "unit": "%", "min": 0, "max": 100, "scale": 0, "step": 1 } } }, "status_range": { "temp_current": { "type": "Integer", "value": { "unit": "\u2103", "min": -100, "max": 1100, "scale": 1, "step": 1 } }, "sensor_list": { "type": "Raw", "value": {} }, "ph_current": { "type": "Integer", "value": { "unit": "", "min": 0, "max": 1500, "scale": 2, "step": 1 } }, "ph_warn_max": { "type": "Integer", "value": { "unit": "", "min": 0, "max": 1500, "scale": 2, "step": 1 } }, "ph_warn_min": { "type": "Integer", "value": { "unit": "", "min": 0, "max": 1500, "scale": 2, "step": 1 } }, "temp_warn_max": { "type": "Integer", "value": { "unit": "\u2103", "min": -100, "max": 1100, "scale": 1, "step": 1 } }, "temp_warn_min": { "type": "Integer", "value": { "unit": "\u2103", "min": -100, "max": 1100, "scale": 1, "step": 1 } }, "tds_current": { "type": "Integer", "value": { "unit": "ppm", "min": 0, "max": 199999, "scale": 0, "step": 1 } }, "tds_warn_max": { "type": "Integer", "value": { "unit": "ppm", "min": 0, "max": 199999, "scale": 0, "step": 1 } }, "tds_warn_min": { "type": "Integer", "value": { "unit": "ppm", "min": 0, "max": 199999, "scale": 0, "step": 1 } }, "ec_current": { "type": "Integer", "value": { "unit": "us", "min": 0, "max": 199999, "scale": 0, "step": 1 } }, "ec_warn_max": { "type": "Integer", "value": { "unit": "us", "min": 0, "max": 199999, "scale": 0, "step": 1 } }, "ec_warn_min": { "type": "Integer", "value": { "unit": "us", "min": 0, "max": 199999, "scale": 0, "step": 1 } }, "salinity_current": { "type": "Integer", "value": { "unit": "ppm", "min": 0, "max": 199999, "scale": 0, "step": 1 } }, "salinity_warn_max": { "type": "Integer", "value": { "unit": "ppm", "min": 0, "max": 199999, "scale": 0, "step": 1 } }, "salinity_warn_min": { "type": "Integer", "value": { "unit": "ppm", "min": 0, "max": 199999, "scale": 0, "step": 1 } }, "pro_current": { "type": "Integer", "value": { "unit": "S.G", "min": 500, "max": 2000, "scale": 3, "step": 1 } }, "pro_warn_max": { "type": "Integer", "value": { "unit": "S.G", "min": 500, "max": 2000, "scale": 3, "step": 1 } }, "pro_warn_min": { "type": "Integer", "value": { "unit": "S.G", "min": 500, "max": 2000, "scale": 3, "step": 1 } }, "orp_current": { "type": "Integer", "value": { "unit": "mV", "min": -2000, "max": 2000, "scale": 0, "step": 1 } }, "orp_warn_max": { "type": "Integer", "value": { "unit": "mV", "min": -2000, "max": 2000, "scale": 0, "step": 1 } }, "orp_warn_min": { "type": "Integer", "value": { "unit": "mV", "min": -2000, "max": 2000, "scale": 0, "step": 1 } }, "cf_current": { "type": "Integer", "value": { "unit": "CF", "min": 0, "max": 199999, "scale": 2, "step": 1 } }, "cf_warn_max": { "type": "Integer", "value": { "unit": "CF", "min": 0, "max": 199999, "scale": 2, "step": 1 } }, "cf_warn_min": { "type": "Integer", "value": { "unit": "CF", "min": 1, "max": 199999, "scale": 2, "step": 1 } }, "rh_current": { "type": "Integer", "value": { "unit": "%", "min": 0, "max": 100, "scale": 0, "step": 1 } }, "rh_warn_max": { "type": "Integer", "value": { "unit": "%", "min": 0, "max": 100, "scale": 0, "step": 1 } }, "rh_warn_min": { "type": "Integer", "value": { "unit": "%", "min": 0, "max": 100, "scale": 0, "step": 1 } } }, "status": { "temp_current": 240, "sensor_list": "AQEBAQEBAA==", "ph_current": 864, "ph_warn_max": 0, "ph_warn_min": 0, "temp_warn_max": 315, "temp_warn_min": -100, "tds_current": 266, "tds_warn_max": 0, "tds_warn_min": 0, "ec_current": 532, "ec_warn_max": 0, "ec_warn_min": 0, "salinity_current": 310, "salinity_warn_max": 0, "salinity_warn_min": 0, "pro_current": 984, "pro_warn_max": 500, "pro_warn_min": 500, "orp_current": 0, "orp_warn_max": -2000, "orp_warn_min": -2000 }, "home_assistant": { "name": "FishTank", "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": "\u00b0F", "state": { "entity_id": "sensor.fishtank_temperature", "state": "75.2", "attributes": { "state_class": "measurement", "unit_of_measurement": "\u00b0F", "device_class": "temperature", "friendly_name": "FishTank Temperature" }, "last_changed": "2022-12-22T21:54:06.684172+00:00", "last_updated": "2022-12-22T21:54:06.684172+00:00" } } ] } }

Device specifications (please complete the following information, which can be found in log): Same device's id, like this: [2021-07-01 10:18:01,351] [tuya-openapi] Request: method = GET, url = https://openapi.tuyacn.com/v1.0/devices/aaaaaaaaaaa/specifications, params = None, body = None, headers = {'client_id': 'xxxxxxxxxxxx', 'sign': 'xxxxxxxxxxxx', 'sign_method': 'HMAC-SHA256', 'access_token': '213e2d4af5e8d217abc0b104462a9f72', 't': '1625105881351', 'lang': 'en'} 2021-07-01 10:18:01 DEBUG (SyncWorker_1) [tuya iot] Response: { "result": { "category": "cz", "functions": [ { "code": "countdown_1", "type": "Integer", "values": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}" }, { "code": "switch", "type": "Boolean", "values": "{}" } ], "status": [ { "code": "cur_voltage", "type": "Integer", "values": "{\"unit\":\"V\",\"min\":0,\"max\":2500,\"scale\":0,\"step\":1}" }, { "code": "cur_current", "type": "Integer", "values": "{\"unit\":\"mA\",\"min\":0,\"max\":30000,\"scale\":0,\"step\":1}" }, { "code": "switch", "type": "Boolean", "values": "{}" }, { "code": "cur_power", "type": "Integer", "values": "{\"unit\":\"W\",\"min\":0,\"max\":50000,\"scale\":0,\"step\":1}" }, { "code": "countdown_1", "type": "Integer", "values": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}" } ] }, "success": true, "t": 1625105881348 }

Device specifications (please complete the following information, which can be found in log): Same device's id, like this: [2021-07-01 10:18:01,351] [tuya-openapi] Request: method = GET, url = https://openapi.tuyacn.com/v1.0/devices/aaaaaaaaaaa/specifications, params = None, body = None, headers = {'client_id': 'xxxxxxxxxxxx', 'sign': 'xxxxxxxxxxxx', 'sign_method': 'HMAC-SHA256', 'access_token': '213e2d4af5e8d217abc0b104462a9f72', 't': '1625105881351', 'lang': 'en'} 2021-07-01 10:18:01 DEBUG (SyncWorker_1) [tuya iot] Response: {

{ "result": [ { "code": "temp_current", "value": 240 }, { "code": "sensor_list", "value": "AQEBAQEBAA==" }, { "code": "ph_current", "value": 863 }, { "code": "ph_warn_max", "value": 0 }, { "code": "ph_warn_min", "value": 0 }, { "code": "temp_warn_max", "value": 315 }, { "code": "temp_warn_min", "value": -100 }, { "code": "tds_current", "value": 268 }, { "code": "tds_warn_max", "value": 0 }, { "code": "tds_warn_min", "value": 0 }, { "code": "ec_current", "value": 536 }, { "code": "ec_warn_max", "value": 0 }, { "code": "ec_warn_min", "value": 0 }, { "code": "salinity_current", "value": 312 }, { "code": "salinity_warn_max", "value": 0 }, { "code": "salinity_warn_min", "value": 0 }, { "code": "pro_current", "value": 984 }, { "code": "pro_warn_max", "value": 500 }, { "code": "pro_warn_min", "value": 500 }, { "code": "orp_current", "value": 0 }, { "code": "orp_warn_max", "value": -2000 }, { "code": "orp_warn_min", "value": -2000 } ], "success": true, "t": 1671743814900, "tid": "f5dbf708823d11edb95a32baeb959352" }

granthamana commented 1 year ago

This would be an awesome enhancement.

RodolfoDomingues commented 1 year ago

Estou exatamente com o mesmo problema. comprei o modelo PH-W218 (8 in 1) e não estou conseguindo extrair os dados de PH e demais dados (apenas temperatura). e gostria muito de ajuda para integrar em meu HA.

ctrl78 commented 1 year ago

Hello I m also interested in the feature, I try to look at the code to do de PR but not sure to understand. Maybe can someone point me a commit or help me 😀

granthamana commented 1 year ago

I think we need to add it here and upvote it:

https://github.com/tuya/tuya-home-assistant/discussions/86

MattiasBiri commented 1 year ago

I am also interested in this device's support.

Rhinomcd commented 1 year ago

~~I'm trying to get this to work as well. If I have time I'll try and see what I can do in the next few weeks to add support if nobody beats me to it. ~~

Edit: my sensor completely broke so I ended up scrapping this idea. Sorry!

Drun555 commented 1 year ago

I'm interested in this too

MoonshineSG commented 1 year ago

mine's a "YINMIK Water Quality Tester" shown "unsupported" in HASSIO ... 😭 works well with SmartLife

Tony0727 commented 1 year ago

I just bought the YY-9909. How to integrate it into HA? THANKS

borodaaaaa commented 1 year ago

Any updates? Have anyone manged to get it working?

supersebbo commented 1 year ago

+1 on this! Just got one of these and would love to integrate it

misaipatah commented 1 year ago

Hi any one manage to integrate it?

otobcn commented 1 year ago

+1k on this! Just got one of these and would love to integrate it! just bought YINMIK Water Quality Tester with tuya integration

FancyNerd92 commented 1 year ago

Same here with mine.... Please guys fix it!! Screenshot 2023-06-13 171225

bandikahmv111 commented 1 year ago

Please add to PH value...

FancyNerd92 commented 1 year ago

@MoonshineSG why thunps down? What's your problem?

borodaaaaa commented 1 year ago

+1 to add support as that sensor is so awesome and would be great to use it in home assistant to automate pool and watertank

MoonshineSG commented 1 year ago

@MoonshineSG why thunps down? What's your problem?

exactly.

FancyNerd92 commented 1 year ago

FYI i fix it mine with LocalTuya and it works perfectly!

borodaaaaa commented 1 year ago

Please let me know how to

borodaaaaa commented 1 year ago

When i try to add it to local tuya it say no data point found …

RMLReis commented 1 year ago

It works with tuya local.

scottsperry commented 1 year ago

Tuya Local works for me too. YINMIK Water Quality Tester

"data": { "endpoint": "https://openapi.tuyaus.com", "auth_type": 0, "country_code": "1", "app_type": "tuyaSmart", "mqtt_connected": true, "disabled_by": null, "disabled_polling": false, "name": "YINMIK Water Quality Tester", "model": "WF-3188", "category": "szjcy", "product_id": "u5xgcpcngk3pfxb4", "product_name": "YINMIK Water Quality Tester", "online": true, "sub": false, "time_zone": "-04:00", "active_time": "2023-08-19T07:39:35+00:00", "create_time": "2023-08-19T07:39:35+00:00", "update_time": "2023-08-19T07:39:38+00:00", "function": {}, "status_range": { "tds_in": { "type": "Integer", "value": { "unit": "ppm", "min": 0, "max": 9999, "scale": 0, "step": 1 } }, "temp_current": { "type": "Integer", "value": { "unit": "\u2103", "min": 0, "max": 800, "scale": 1, "step": 1 } }, "battery_percentage": { "type": "Integer", "value": { "unit": "%", "min": 0, "max": 100, "scale": 0, "step": 1 } } }, "status": { "tds_in": 0, "temp_current": 226, "battery_percentage": 1 }, "home_assistant": { "name": "YINMIK Water Quality Tester", "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": "\u00b0F", "state": { "entity_id": "sensor.yinmik_water_quality_tester_temperature", "state": "72.7", "attributes": { "state_class": "measurement", "unit_of_measurement": "\u00b0F", "device_class": "temperature", "friendly_name": "YINMIK Water Quality Tester Temperature" }, "last_changed": "2023-08-23T04:18:27.275691+00:00", "last_updated": "2023-08-23T04:18:27.275691+00:00" } } ] } } }

borodaaaaa commented 1 year ago

How did you get it working? Added it but cannot see tds, was able to find temp humidity, orp and ph sensors i had to manually add each sensor and to guess which id does what … looking at the web portal data point id 1 must be tds but does not pop up as others if i add it manually it shows as unavailable

scottsperry commented 1 year ago

For me I ran the tinytuya wizard (python -m tinytuya wizard). It does it's thing and (re)builds devices.json. I then go to HA tuya_local integration, click Add Device and fill in Device ID and Local Key from the devices.json. From there it just works, all sensors are discovered.

Here's what I get in devices.json from the wizard: `` { "name": "water 3", "id": "XXredacted", "key": "XXredacted", "mac": "a8:...:26:2e", "uuid": "1e1..627", "sn": "10..46", "category": "szjcy", "product_name": "YINMIK Water Quality Tester", "product_id": "u5xgcpcngk3pfxb4", "biz_type": 0, "model": "WF-3188", "sub": false, "icon": "https://images.tuyaus.com/smart/icon/bay164497620449560Pe/3c680798e8af1b8ed29218a14427936d.jpg", "mapping": { "1": { "code": "tds_in", "type": "Integer", "values": { "unit": "ppm", "min": 0, "max": 9999, "scale": 0, "step": 1 } }, "2": { "code": "temp_current", "type": "Integer", "values": { "unit": "\u00b0C", "min": 0, "max": 800, "scale": 1, "step": 1 } }, "7": { "code": "battery_percentage", "type": "Integer", "values": { "unit": "%", "min": 0, "max": 100, "scale": 0, "step": 1 } } }, "ip": "192.168.1.171", "version": "3.3" },

syakircomel commented 5 months ago

how to configure this sensor so that it will show ec value and ph value...how to do it

projectgreenharmony commented 3 months ago

YY-W9909

That is very good. Would you share with us how you did it? Thank you very much