tuya-home-assistant icon indicating copy to clipboard operation
tuya-home-assistant copied to clipboard

Add support for smart water quality meter Yieryi YY-W9909

Open sleepingsparrow opened this issue 2 years ago • 27 comments

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" }

sleepingsparrow avatar Dec 22 '22 22:12 sleepingsparrow

This would be an awesome enhancement.

granthamana avatar Jan 03 '23 14:01 granthamana

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.

RodolfoDomingues avatar Jan 30 '23 20:01 RodolfoDomingues

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 😀

ctrl78 avatar Feb 01 '23 09:02 ctrl78

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

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

granthamana avatar Feb 03 '23 15:02 granthamana

I am also interested in this device's support.

MattiasBiri avatar Feb 04 '23 12:02 MattiasBiri

~~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!

Rhinomcd avatar Feb 20 '23 05:02 Rhinomcd

I'm interested in this too

Drun555 avatar Mar 13 '23 16:03 Drun555

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

MoonshineSG avatar Mar 22 '23 02:03 MoonshineSG

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

Tony0727 avatar Apr 08 '23 20:04 Tony0727

Any updates? Have anyone manged to get it working?

borodaaaaa avatar Apr 19 '23 20:04 borodaaaaa

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

supersebbo avatar May 22 '23 10:05 supersebbo

Hi any one manage to integrate it?

misaipatah avatar May 23 '23 12:05 misaipatah

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

otobcn avatar Jun 12 '23 18:06 otobcn

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

FancyNerd92 avatar Jun 13 '23 14:06 FancyNerd92

Please add to PH value...

bandikahmv111 avatar Jun 14 '23 10:06 bandikahmv111

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

FancyNerd92 avatar Jul 08 '23 23:07 FancyNerd92

+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

borodaaaaa avatar Jul 09 '23 00:07 borodaaaaa

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

exactly.

MoonshineSG avatar Jul 09 '23 05:07 MoonshineSG

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

FancyNerd92 avatar Jul 17 '23 14:07 FancyNerd92

Please let me know how to

borodaaaaa avatar Jul 17 '23 17:07 borodaaaaa

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

borodaaaaa avatar Jul 20 '23 01:07 borodaaaaa

It works with tuya local.

RMLReis avatar Aug 23 '23 08:08 RMLReis

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" } } ] } } }

scottsperry avatar Aug 25 '23 18:08 scottsperry

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

borodaaaaa avatar Aug 29 '23 08:08 borodaaaaa

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" },

scottsperry avatar Aug 29 '23 23:08 scottsperry

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

syakircomel avatar Mar 20 '24 05:03 syakircomel

YY-W9909

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

projectgreenharmony avatar May 27 '24 10:05 projectgreenharmony