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

[New device support]: Zigbee Chlorine Meter PH ORP EC TDS Salinity Temp CL- _TZE200_v1jqz5cy #18704

Open
cloudbr34k84 opened this issue Aug 23, 2023 · 130 comments
Labels
new device support New device support request

Comments

@cloudbr34k84
Copy link

Link

https://www.aliexpress.com/item/1005005575336871.html?spm=a2g0o.order_list.order_list_main.11.28e31802Wxn6Wl

Database entry

{"id":115,"type":"EndDevice","ieeeAddr":"0xe0798dfffeb87446","nwkAddr":42479,"manufId":4098,"manufName":"_TZE200_v1jqz5cy","powerSource":"Battery","modelId":"TS0601","epList":[1],"endpoints":{"1":{"profId":260,"epId":1,"devId":81,"inClusterList":[0,4,5,61184],"outClusterList":[25,10],"clusters":{"genBasic":{"attributes":{"65503":"\u00195y,f\u00195y,\u0012\u001a5y,\u0012\u001e5y,\u0011"5y,\u0011","65506":31,"65508":0,"appVersion":65,"modelId":"TS0601","manufacturerName":"_TZE200_v1jqz5cy","stackVersion":0,"dateCode":""}}},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":65,"stackVersion":0,"hwVersion":1,"dateCode":"","zclVersion":3,"interviewCompleted":true,"meta":{},"lastSeen":1692789799130,"defaultSendRequestWhen":"immediate"}

Comments

Would someone be willing to make a converter> here are the Data Points

1: TDS
2: temperature
101: ORP
102: CL
7: Battery Percentage
105: backlight Value
10: ph Value
11: EC Value
108: EC Max Value
109: EC Min Value
110: ORP max
111: ORP min
112: CL Max Value
113: CL Min Value
114: PH??
115: EC??
116: ORP??
117: Salt

External converter

No response

Supported color modes

No response

Color temperature range

No response

@cloudbr34k84 cloudbr34k84 added the new device support New device support request label Aug 23, 2023
@cloudbr34k84
Copy link
Author

im giving it a crack

const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const extend = require('zigbee-herdsman-converters/lib/extend');
const e = exposes.presets;
const ea = exposes.access;
const tuya = require('zigbee-herdsman-converters/lib/tuya');

const definition = {
    // Since a lot of TuYa devices use the same modelID, but use different datapoints
    // it's necessary to provide a fingerprint instead of a zigbeeModel
    fingerprint: [
        {
            // The model ID from: Device with modelID 'TS0601' is not supported
            // You may need to add \u0000 at the end of the name in some cases
            modelID: 'BLE-YL01',
            // The manufacturer name from: Device with modelID 'TS0601' is not supported.
            manufacturerName: 'TZE200_v1jqz5cy',
        },
    ],
    model: 'WiFi Chlorine Meter BLE-YL01',
    vendor: 'yieryi',
    description: 'Smart WiFi Zigbee Chlorine Meter PH ORP EC TDS Salinity Temp CL Tester Swimming Pool Water Quality Analyzer USB Solar Powered',
    fromZigbee: [tuya.fz.datapoints, tuya.fz.gateway_connection_status],
    toZigbee: [tuya.tz.datapoints],
    onEvent: tuya.onEventSetTime, // Add this if you are getting no converter for 'commandMcuSyncTime'
    configure: tuya.configureMagicPacket,
    exposes: [
        e.tds(),
        e.temperature()
        e.orp()
        e.cl()
        e.batterypercentage()
        e.backlightvalue()
        e.pHvalue()
        e.ecvalue()
        e.ecmaxvalue()
        e.ecminvalue()
        e.orpmaxvalue()
        e.orpminvalue()
        e.clmaxvalue()
        e.clminvalue()
        e.salt()
        // Here you should put all functionality that your device exposes
    ],
    meta: {
        // All datapoints go in here
        tuyaDatapoints: [
            [1, 'tds', tuya.valueConverter.raw],
            [2, 'temperature', tuya.valueConverter.raw.divideBy10],
            [101, 'orp', tuya.valueConverter.raw],
            [102, 'cl', tuya.valueConverter.raw],
            [7, 'batterypercentage', tuya.valueConverter.raw],
            [105, 'backlightvalue', tuya.valueConverter.raw],
            [10, 'pHvalue', tuya.valueConverter.raw],
            [11, 'ecvalue', tuya.valueConverter.raw],
            [108, 'ecmaxvalue', tuya.valueConverter.raw],
            [109, 'ecminvalue', tuya.valueConverter.raw],
            [110, 'orpmaxvalue', tuya.valueConverter.raw],
            [111, 'orpminvalue', tuya.valueConverter.raw],
            [112, 'clmaxvalue', tuya.valueConverter.raw],
            [113, 'clminvalue', tuya.valueConverter.raw],
            [117, 'salt', tuya.valueConverter.raw],

        ],
    },
};

module.exports = definition;

Gor my first error

[09:44:12] INFO: Preparing to start...
[09:44:13] INFO: Socat not enabled
[09:44:13] INFO: Starting Zigbee2MQTT...
/app/data/extension/externally-loaded.js:30
        e.tds(),
          ^
TypeError: e.tds is not a function
    at /app/data/extension/externally-loaded.js:30:11
    at Script.runInContext (node:vm:141:12)
    at Script.runInNewContext (node:vm:146:17)
    at Object.runInNewContext (node:vm:306:38)
    at loadModuleFromText (/app/lib/util/utils.ts:152:8)
    at loadModuleFromFile (/app/lib/util/utils.ts:159:12)
    at Object.getExternalConvertersDefinitions (/app/lib/util/utils.ts:169:25)
    at getExternalConvertersDefinitions.next (<anonymous>)
    at new ExternalConverters (/app/lib/extension/externalConverters.ts:12:20)
    at new Controller (/app/lib/controller.ts:84:58)

@cloudbr34k84
Copy link
Author

@Koenkk where is a list of the supported datapoints?

@Koenkk
Copy link
Owner

Koenkk commented Aug 25, 2023

Here is a list of all standard exposes, but you can easily create new ones: example

@mochitoju
Copy link

mochitoju commented Sep 1, 2023

Is the device already available in z2m or hast anybody a solution?

@cloudbr34k84
Copy link
Author

no its not, i dont know what im doing lol

@cloudbr34k84
Copy link
Author

Here is a list of all standard exposes, but you can easily create new ones: example

thanks but I don't really know what im looking for

@tschiex
Copy link

tschiex commented Sep 6, 2023

I just got the very same device here, connected to my Home Assistant server, through ZHA.
I would be happy to help here. I can write code, but am a ZigBee/Z2MQTT/ZHA newbie...

@cloudbr34k84 Brad, how did you get the Data Points?

@cloudbr34k84
Copy link
Author

cloudbr34k84 commented Sep 6, 2023 via email

@cloudbr34k84
Copy link
Author

@Koenkk any chance you can help create the converter pls?

@mochitoju
Copy link

Yes, that would bei great!

@Freev4lley
Copy link

That would be great for me too!!!

@Koenkk
Copy link
Owner

Koenkk commented Sep 9, 2023

With the following ext converter, what shows up in the z2m frontend -> device -> state page?

https://gist.github.com/Koenkk/7262a8a36bb84327ff563e0b8256024b

@tschiex
Copy link

tschiex commented Sep 10, 2023

Sorry Koenkk, I don't have Z2M installed on HA, but ZHA. Is it easy to switch back and forth?

BTW, I bought a Tuya Gateway and followed the instructions on Z2M
https://www.zigbee2mqtt.io/advanced/support-new-devices/03_find_tuya_data_points.html

and found more DP Ids:

1: TDS
2: Temperature
101: ORP
102: Chlorine
7: Battery Percentage
103: pH Calibration
104: Backlight
105: Backlight Value
10: pH Value
11: EC Value
106: pH Max Value
107: pH Min Value
108: EC Max Value
109: EC Min Value
110: ORP Max Value
111: ORP Min Value
112: Chlorine Max Value
113: Chlorine Min Value
114: PH Calibration
115: EC Calibration
116: ORP Calibration
117: Salt

(Translation of Chinese by Google Translate camera from Tuya IoT platform website).

There are apparently 2 pH calibration DP Ids (and there are 2 pH calibration standards: Asia uses 6.86/4.00/9.18, EU uses 7/4/10). The two pH calibration DPs could be these 2 maybe?

I was told the device apparently works on deconz: https://forum.phoscon.de/t/tuya-tze200-v1jqz5cy-zigbee-chlorine-meter/3930 (see zigpy/zha-device-handlers#2565).

and here: dresden-elektronik/deconz-rest-plugin#7215

@cloudbr34k84
Copy link
Author

cloudbr34k84 commented Sep 10, 2023

With the following ext converter, what shows up in the z2m frontend -> device -> state page?

https://gist.github.com/Koenkk/7262a8a36bb84327ff563e0b8256024b
Nothing shows except Linkquality
image

info  2023-09-11 09:30:42: Device '**0xdc8e95fffe832b2f**' joined
info  2023-09-11 09:30:43: MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"friendly_name":"**0xdc8e95fffe832b2f**","ieee_address":"**0xdc8e95fffe832b2f**"},"type":"device_joined"}'
info  2023-09-11 09:30:43: MQTT publish: topic 'zigbee2mqtt/**0xdc8e95fffe832b2f**/availability', payload '{"state":"online"}'
info  2023-09-11 09:30:43: Starting interview of '0xdc8e95fffe832b2f'
info  2023-09-11 09:30:43: MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"friendly_name":"**0xdc8e95fffe832b2f**","ieee_address":"0xdc8e95fffe832b2f","status":"started"},"type":"device_interview"}'
info  2023-09-11 09:30:43: MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"friendly_name":"0xdc8e95fffe832b2f","ieee_address":"0xdc8e95fffe832b2f"},"type":"device_announce"}'
info  2023-09-11 09:30:47: MQTT publish: topic 'zigbee2mqtt/Front Patio EM GPO', payload '{"current_left":0,"energy":0,"linkquality":21,"power_left":0,"state_left":"ON","state_right":"ON","voltage_left":246}'
info  2023-09-11 09:30:47: MQTT publish: topic 'zigbee2mqtt/Hot Water System EM Clamp', payload '{"current":2.3,"energy":0.17,"linkquality":83,"power":566.6,"voltage":248.7}'
info  2023-09-11 09:30:47: MQTT publish: topic 'zigbee2mqtt/Garage Door', payload '{"garage_door_contact":true,"linkquality":94,"trigger":false}'
info  2023-09-11 09:30:48: Successfully interviewed '0xdc8e95fffe832b2f', device has successfully been paired
warn  2023-09-11 09:30:48: Device '0xdc8e95fffe832b2f' with Zigbee model 'TS0601' and manufacturer name '_TZE200_v1jqz5cy' is NOT supported, please follow https://www.zigbee2mqtt.io/advanced/support-new-devices/01_support_new_devices.html
info  2023-09-11 09:30:48: MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"definition":null,"friendly_name":"0xdc8e95fffe832b2f","ieee_address":"0xdc8e95fffe832b2f","status":"successful","supported":false},"type":"device_interview"}'
warn  2023-09-11 09:30:48: Received message from unsupported device with Zigbee model 'TS0601' and manufacturer name '_TZE200_v1jqz5cy'
warn  2023-09-11 09:30:48: Please see: https://www.zigbee2mqtt.io/advanced/support-new-devices/01_support_new_devices.html
warn  2023-09-11 09:30:49: Received message from unsupported device with Zigbee model 'TS0601' and manufacturer name '_TZE200_v1jqz5cy'
warn  2023-09-11 09:30:49: Please see: https://www.zigbee2mqtt.io/advanced/support-new-devices/01_support_new_devices.html

@tschiex
Copy link

tschiex commented Sep 11, 2023

Brad,

I'm not a Z2M specialist, but the fact that Z2M says:

warn 2023-09-11 09:30:48: Device '0xdc8e95fffe832b2f' with Zigbee model 'TS0601' and manufacturer name '_TZE200_v1jqz5cy' is NOT supported, please follow https://www.zigbee2mqtt.io/advanced/support-new-devices/01_support_new_devices.html

may be a hint that Koenkk's handler above is not accessible to Zigbee2MQTT in your setup.

@tschiex
Copy link

tschiex commented Sep 11, 2023

Or may be the handler is wrong.... Looking into it, I see:

    fingerprint: [
        {
            // The model ID from: Device with modelID 'TS0601' is not supported
            // You may need to add \u0000 at the end of the name in some cases
            modelID: 'BLE-YL01',
            // The manufacturer name from: Device with modelID 'TS0601' is not supported.
            manufacturerName: 'TZE200_v1jqz5cy',
        },
    ],

I assume the modelId is important for recognizing the device?

Because it reports 'TS0601' not 'BLE-YL01'.

Brad, I suppose you should edit Koenkk's script and replace the

            modelID: 'BLE-YL01',

by

            modelID: 'TS0601',

@BabaIsYou
Copy link

I was told the device apparently works on deconz: https://forum.phoscon.de/t/tuya-tze200-v1jqz5cy-zigbee-chlorine-meter/3930 (see zigpy/zha-device-handlers#2565).

It's a wok in progress ... ;-)

@Koenkk
Copy link
Owner

Koenkk commented Sep 11, 2023

@cloudbr34k84
Copy link
Author

Made a mistake, updated https://gist.github.com/Koenkk/7262a8a36bb84327ff563e0b8256024b

Hey @Koenkk Thanks, its now added correctly, but it has not exposed any entities

info  2023-09-12 07:44:57: Successfully interviewed '0xdc8e95fffe832b2f', device has successfully been paired
info  2023-09-12 07:44:57: Device '0xdc8e95fffe832b2f' is supported, identified as: yieryi Smart WiFi Zigbee Chlorine Meter PH ORP EC TDS Salinity Temp CL Tester Swimming Pool Water Quality Analyzer USB Solar Powered (WiFi Chlorine Meter BLE-YL01)
info  2023-09-12 07:44:57: MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"definition":{"description":"Smart WiFi Zigbee Chlorine Meter PH ORP EC TDS Salinity Temp CL Tester Swimming Pool Water Quality Analyzer USB Solar Powered","exposes":[{"access":1,"description":"Link quality (signal strength)","name":"linkquality","property":"linkquality","type":"numeric","unit":"lqi","value_max":255,"value_min":0}],"model":"WiFi Chlorine Meter BLE-YL01","options":[{"access":2,"description":"Number of digits after decimal point for temperature, takes into effect on next report of device.","name":"temperature_precision","property":"temperature_precision","type":"numeric","value_max":3,"value_min":0},{"access":2,"description":"Calibrates the temperature value (absolute offset), takes into effect on next report of device.","name":"temperature_calibration","property":"temperature_calibration","type":"numeric"}],"supports_ota":false,"vendor":"yieryi"},"friendly_name":"0xdc8e95fffe832b2f","ieee_address":"0xdc8e95fffe832b2f","status":"successful","supported":true},"type":"device_interview"}'
info  2023-09-12 07:44:57: Configuring '0xdc8e95fffe832b2f'
info  2023-09-12 07:44:57: Successfully configured '0xdc8e95fffe832b2f'

@alray31
Copy link

alray31 commented Sep 12, 2023

Made a mistake, updated https://gist.github.com/Koenkk/7262a8a36bb84327ff563e0b8256024b

Hey @Koenkk Thanks, its now added correctly, but it has not exposed any entities

info  2023-09-12 07:44:57: Successfully interviewed '0xdc8e95fffe832b2f', device has successfully been paired
info  2023-09-12 07:44:57: Device '0xdc8e95fffe832b2f' is supported, identified as: yieryi Smart WiFi Zigbee Chlorine Meter PH ORP EC TDS Salinity Temp CL Tester Swimming Pool Water Quality Analyzer USB Solar Powered (WiFi Chlorine Meter BLE-YL01)
info  2023-09-12 07:44:57: MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"definition":{"description":"Smart WiFi Zigbee Chlorine Meter PH ORP EC TDS Salinity Temp CL Tester Swimming Pool Water Quality Analyzer USB Solar Powered","exposes":[{"access":1,"description":"Link quality (signal strength)","name":"linkquality","property":"linkquality","type":"numeric","unit":"lqi","value_max":255,"value_min":0}],"model":"WiFi Chlorine Meter BLE-YL01","options":[{"access":2,"description":"Number of digits after decimal point for temperature, takes into effect on next report of device.","name":"temperature_precision","property":"temperature_precision","type":"numeric","value_max":3,"value_min":0},{"access":2,"description":"Calibrates the temperature value (absolute offset), takes into effect on next report of device.","name":"temperature_calibration","property":"temperature_calibration","type":"numeric"}],"supports_ota":false,"vendor":"yieryi"},"friendly_name":"0xdc8e95fffe832b2f","ieee_address":"0xdc8e95fffe832b2f","status":"successful","supported":true},"type":"device_interview"}'
info  2023-09-12 07:44:57: Configuring '0xdc8e95fffe832b2f'
info  2023-09-12 07:44:57: Successfully configured '0xdc8e95fffe832b2f'

I'm not an expert but if you look at the other tuya converters that are using datapoints in zigbee-herdsman-convert/src/devices/tuya.ts, you also need to add the corresponding entries in the expose section, i.e.: exposes: [e.tds, e.temperature, etc...

example:
image

So maybe try this? :

const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const extend = require('zigbee-herdsman-converters/lib/extend');
const e = exposes.presets;
const ea = exposes.access;
const tuya = require('zigbee-herdsman-converters/lib/tuya');

const definition = {
    // Since a lot of TuYa devices use the same modelID, but use different datapoints
    // it's necessary to provide a fingerprint instead of a zigbeeModel
    fingerprint: [
        {
            // The model ID from: Device with modelID 'TS0601' is not supported
            // You may need to add \u0000 at the end of the name in some cases
            modelID: 'TS0601',
            // The manufacturer name from: Device with modelID 'TS0601' is not supported.
            manufacturerName: '_TZE200_v1jqz5cy',
        },
    ],
    model: 'WiFi Chlorine Meter BLE-YL01',
    vendor: 'yieryi',
    description: 'Smart WiFi Zigbee Chlorine Meter PH ORP EC TDS Salinity Temp CL Tester Swimming Pool Water Quality Analyzer USB Solar Powered',
    fromZigbee: [tuya.fz.datapoints, tuya.fz.gateway_connection_status],
    toZigbee: [tuya.tz.datapoints],
    onEvent: tuya.onEventSetTime, // Add this if you are getting no converter for 'commandMcuSyncTime'
    configure: tuya.configureMagicPacket,
    exposes: [e.tds(), e.temperature(), e.orp(), e.cl(), e.batterypercentage(), e.backlightvalue(), e.pHvalue(), e.ecvalue(), e.ecmaxvalue(), e.orpmaxvalue(), e.orpminvalue(), e.clmaxvalue(), e.clminvalue(), e.salt()],
    meta: {
        // All datapoints go in here
        tuyaDatapoints: [
            [1, 'tds', tuya.valueConverter.raw],
            [2, 'temperature', tuya.valueConverter.raw.divideBy10],
            [101, 'orp', tuya.valueConverter.raw],
            [102, 'cl', tuya.valueConverter.raw],
            [7, 'batterypercentage', tuya.valueConverter.raw],
            [105, 'backlightvalue', tuya.valueConverter.raw],
            [10, 'pHvalue', tuya.valueConverter.raw],
            [11, 'ecvalue', tuya.valueConverter.raw],
            [108, 'ecmaxvalue', tuya.valueConverter.raw],
            [109, 'ecminvalue', tuya.valueConverter.raw],
            [110, 'orpmaxvalue', tuya.valueConverter.raw],
            [111, 'orpminvalue', tuya.valueConverter.raw],
            [112, 'clmaxvalue', tuya.valueConverter.raw],
            [113, 'clminvalue', tuya.valueConverter.raw],
            [117, 'salt', tuya.valueConverter.raw],

        ],
    },
};

module.exports = definition;

@Koenkk
Copy link
Owner

Koenkk commented Sep 13, 2023

Please make a screenshot of the z2m frontend -> device page -> state page?

@cloudbr34k84
Copy link
Author

Please make a screenshot of the z2m frontend -> device page -> state page?

@Koenkk
Screenshot_20230914-044527.png

@Koenkk
Copy link
Owner

Koenkk commented Sep 14, 2023

With the following converter: https://gist.github.com/Koenkk/7262a8a36bb84327ff563e0b8256024b , can you provide the debug log when pairing the device + 5 minutes after this?

See https://www.zigbee2mqtt.io/guide/usage/debug.html on how to enable debug logging.

@cloudbr34k84
Copy link
Author

With the following converter: https://gist.github.com/Koenkk/7262a8a36bb84327ff563e0b8256024b , can you provide the debug log when pairing the device + 5 minutes after this?

See https://www.zigbee2mqtt.io/guide/usage/debug.html on how to enable debug logging.

Hey @Koenkk thanks for helping on this
When I copy the new code and enable debugging and restart I get an error from the converter

[06:33:10] INFO: Preparing to start...
[06:33:10] INFO: Socat not enabled
[06:33:10] INFO: Zigbee Herdsman debug logging enabled
[06:33:10] INFO: Starting Zigbee2MQTT...
/app/data/extension/externally-loaded.js:27
    onEvent: tuya.onEvent(), // Add this if you are getting no converter for 'commandMcuSyncTime'
                  ^
TypeError: tuya.onEvent is not a function
    at /app/data/extension/externally-loaded.js:27:19
    at Script.runInContext (node:vm:141:12)
    at Script.runInNewContext (node:vm:146:17)
    at Object.runInNewContext (node:vm:306:38)
    at loadModuleFromText (/app/lib/util/utils.ts:152:8)
    at loadModuleFromFile (/app/lib/util/utils.ts:159:12)
    at Object.getExternalConvertersDefinitions (/app/lib/util/utils.ts:169:25)
    at getExternalConvertersDefinitions.next (<anonymous>)
    at new ExternalConverters (/app/lib/extension/externalConverters.ts:12:20)
    at new Controller (/app/lib/controller.ts:84:58)

@Koenkk
Copy link
Owner

Koenkk commented Sep 16, 2023

I forgot to mention that this converter only works with the latest-dev branch. (https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html)

@cloudbr34k84
Copy link
Author

cloudbr34k84 commented Sep 16, 2023

I forgot to mention that this converter only works with the latest-dev branch. (https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html)
@Koenkk
Ok so I have updated my Z2M Edge version - Zigbee2MQTT version
1.33.0-dev commit: 0a69bb5
I have deleted and re-added the device
there are no entities in the State Tab except "linkquality": 87
log.txt

@cloudbr34k84
Copy link
Author

Made a mistake, updated https://gist.github.com/Koenkk/7262a8a36bb84327ff563e0b8256024b

Hey @Koenkk Thanks, its now added correctly, but it has not exposed any entities

info  2023-09-12 07:44:57: Successfully interviewed '0xdc8e95fffe832b2f', device has successfully been paired
info  2023-09-12 07:44:57: Device '0xdc8e95fffe832b2f' is supported, identified as: yieryi Smart WiFi Zigbee Chlorine Meter PH ORP EC TDS Salinity Temp CL Tester Swimming Pool Water Quality Analyzer USB Solar Powered (WiFi Chlorine Meter BLE-YL01)
info  2023-09-12 07:44:57: MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"definition":{"description":"Smart WiFi Zigbee Chlorine Meter PH ORP EC TDS Salinity Temp CL Tester Swimming Pool Water Quality Analyzer USB Solar Powered","exposes":[{"access":1,"description":"Link quality (signal strength)","name":"linkquality","property":"linkquality","type":"numeric","unit":"lqi","value_max":255,"value_min":0}],"model":"WiFi Chlorine Meter BLE-YL01","options":[{"access":2,"description":"Number of digits after decimal point for temperature, takes into effect on next report of device.","name":"temperature_precision","property":"temperature_precision","type":"numeric","value_max":3,"value_min":0},{"access":2,"description":"Calibrates the temperature value (absolute offset), takes into effect on next report of device.","name":"temperature_calibration","property":"temperature_calibration","type":"numeric"}],"supports_ota":false,"vendor":"yieryi"},"friendly_name":"0xdc8e95fffe832b2f","ieee_address":"0xdc8e95fffe832b2f","status":"successful","supported":true},"type":"device_interview"}'
info  2023-09-12 07:44:57: Configuring '0xdc8e95fffe832b2f'
info  2023-09-12 07:44:57: Successfully configured '0xdc8e95fffe832b2f'

I'm not an expert but if you look at the other tuya converters that are using datapoints in zigbee-herdsman-convert/src/devices/tuya.ts, you also need to add the corresponding entries in the expose section, i.e.: exposes: [e.tds, e.temperature, etc...

example: image

So maybe try this? :

const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const extend = require('zigbee-herdsman-converters/lib/extend');
const e = exposes.presets;
const ea = exposes.access;
const tuya = require('zigbee-herdsman-converters/lib/tuya');

const definition = {
    // Since a lot of TuYa devices use the same modelID, but use different datapoints
    // it's necessary to provide a fingerprint instead of a zigbeeModel
    fingerprint: [
        {
            // The model ID from: Device with modelID 'TS0601' is not supported
            // You may need to add \u0000 at the end of the name in some cases
            modelID: 'TS0601',
            // The manufacturer name from: Device with modelID 'TS0601' is not supported.
            manufacturerName: '_TZE200_v1jqz5cy',
        },
    ],
    model: 'WiFi Chlorine Meter BLE-YL01',
    vendor: 'yieryi',
    description: 'Smart WiFi Zigbee Chlorine Meter PH ORP EC TDS Salinity Temp CL Tester Swimming Pool Water Quality Analyzer USB Solar Powered',
    fromZigbee: [tuya.fz.datapoints, tuya.fz.gateway_connection_status],
    toZigbee: [tuya.tz.datapoints],
    onEvent: tuya.onEventSetTime, // Add this if you are getting no converter for 'commandMcuSyncTime'
    configure: tuya.configureMagicPacket,
    exposes: [e.tds(), e.temperature(), e.orp(), e.cl(), e.batterypercentage(), e.backlightvalue(), e.pHvalue(), e.ecvalue(), e.ecmaxvalue(), e.orpmaxvalue(), e.orpminvalue(), e.clmaxvalue(), e.clminvalue(), e.salt()],
    meta: {
        // All datapoints go in here
        tuyaDatapoints: [
            [1, 'tds', tuya.valueConverter.raw],
            [2, 'temperature', tuya.valueConverter.raw.divideBy10],
            [101, 'orp', tuya.valueConverter.raw],
            [102, 'cl', tuya.valueConverter.raw],
            [7, 'batterypercentage', tuya.valueConverter.raw],
            [105, 'backlightvalue', tuya.valueConverter.raw],
            [10, 'pHvalue', tuya.valueConverter.raw],
            [11, 'ecvalue', tuya.valueConverter.raw],
            [108, 'ecmaxvalue', tuya.valueConverter.raw],
            [109, 'ecminvalue', tuya.valueConverter.raw],
            [110, 'orpmaxvalue', tuya.valueConverter.raw],
            [111, 'orpminvalue', tuya.valueConverter.raw],
            [112, 'clmaxvalue', tuya.valueConverter.raw],
            [113, 'clminvalue', tuya.valueConverter.raw],
            [117, 'salt', tuya.valueConverter.raw],

        ],
    },
};

module.exports = definition;

tried this, same issue as when I attempted. i don't understand how to create a new function

[08:30:22] INFO: Preparing to start... [08:30:22] INFO: Socat not enabled [08:30:23] INFO: Zigbee Herdsman debug logging enabled [08:30:23] INFO: Starting Zigbee2MQTT... /app/data/extension/externally-loaded.js:29 exposes: [e.tds(), e.temperature(), e.orp(), e.cl(), e.batterypercentage(), e.backlightvalue(), e.pHvalue(), e.ecvalue(), e.ecmaxvalue(), e.orpmaxvalue(), e.orpminvalue(), e.clmaxvalue(), e.clminvalue(), e.salt()], ^ TypeError: e.tds is not a function at /app/data/extension/externally-loaded.js:29:17 at Script.runInContext (node:vm:141:12) at Script.runInNewContext (node:vm:146:17) at Object.runInNewContext (node:vm:306:38) at loadModuleFromText (/app/lib/util/utils.ts:152:8) at loadModuleFromFile (/app/lib/util/utils.ts:159:12) at Object.getExternalConvertersDefinitions (/app/lib/util/utils.ts:169:25) at getExternalConvertersDefinitions.next (<anonymous>) at new ExternalConverters (/app/lib/extension/externalConverters.ts:12:20) at new Controller (/app/lib/controller.ts:84:58)

@cloudbr34k84
Copy link
Author

@Koenkk
not sure if this is helping but I added the exposes entities

const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const extend = require('zigbee-herdsman-converters/lib/extend');
const e = exposes.presets;
const ea = exposes.access;
const tuya = require('zigbee-herdsman-converters/lib/tuya');

const definition = {
    // Since a lot of TuYa devices use the same modelID, but use different datapoints
    // it's necessary to provide a fingerprint instead of a zigbeeModel
    fingerprint: [
        {
            // The model ID from: Device with modelID 'TS0601' is not supported
            // You may need to add \u0000 at the end of the name in some cases
            modelID: 'TS0601',
            // The manufacturer name from: Device with modelID 'TS0601' is not supported.
            manufacturerName: '_TZE200_v1jqz5cy',
        },
    ],
    model: 'WiFi Chlorine Meter BLE-YL01',
    vendor: 'yieryi',
    description: 'Zigbee Chlorine Meter PH ORP EC TDS Salinity Temp CL Tester Solar Powered',
    fromZigbee: [tuya.fz.datapoints, tuya.fz.gateway_connection_status],
    toZigbee: [tuya.tz.datapoints],
    onEvent: tuya.onEvent(), // Add this if you are getting no converter for 'commandMcuSyncTime'
    configure: tuya.configureMagicPacket,
    exposes: [
        e.numeric('tdsvalue', ea.STATE).withUnit('ppm').withDescription('Total Dissolved Solids Value'),
        e.temperature(),
        e.numeric('orpvalue', ea.STATE).withUnit('mV').withDescription('Oxidation Reduction Potential Value'),
        e.numeric('clvalue', ea.STATE).withUnit('ppm').withDescription('Free Chlorine Value'),
        e.numeric('batterypercentage', ea.STATE).withUnit('%').withDescription('Remaining battery in %, can take up to 24 hours before reported.').withValueMin(0).withValueMax(100),
        // e.backlightvalue(),
        e.numeric('pHvalue', ea.STATE).withUnit('pH').withDescription('pH Value'),
        e.numeric('ecvalue', ea.STATE).withUnit('µS/cm').withDescription('Electrical Conductivity Value'),
        e.numeric('ecmaxvalue', ea.STATE).withUnit('µS/cm').withDescription('Electrical Conductivity Max Value'),
        e.numeric('ecminvalue', ea.STATE).withUnit('µS/cm').withDescription('Electrical Conductivity Min Value'),
        e.numeric('orpmaxvalue', ea.STATE).withUnit('mV').withDescription('Oxidation Reduction Potential Max Value'),
        e.numeric('orpminvalue', ea.STATE).withUnit('mV').withDescription('Oxidation Reduction Potential Min Value'),
        e.numeric('CLmaxvalue', ea.STATE).withUnit('ppm').withDescription('Free Chlorine Max Value'),
        e.numeric('clmaxvalue', ea.STATE).withUnit('ppm').withDescription('Free Chlorine Min Value'),
        e.numeric('saltvalue', ea.STATE).withUnit('µS/cm').withDescription('Salt Value'),
        e.numeric('phmaxvalue', ea.STATE).withUnit('pH').withDescription('pH Max Value'),
        e.numeric('phminvalue', ea.STATE).withUnit('pH').withDescription('pH Min Value')
    ],
    meta: {
        // All datapoints go in here
        tuyaDatapoints: [
            [1, 'tdsvalue', tuya.valueConverter.raw],
            [2, 'temperature', tuya.valueConverter.raw.divideBy10],
            [7, 'batterypercentage', tuya.valueConverter.raw],
            [10, 'pHvalue', tuya.valueConverter.raw],
            [11, 'ecvalue', tuya.valueConverter.raw],
            [101, 'orpvalue', tuya.valueConverter.raw],
            [102, 'clvalue', tuya.valueConverter.raw],
            [105, 'backlightvalue', tuya.valueConverter.raw],
            [106, 'phmaxvalue', tuya.valueConverter.raw],
            [107, 'phminvalue', tuya.valueConverter.raw],
            [108, 'ecmaxvalue', tuya.valueConverter.raw],
            [109, 'ecminvalue', tuya.valueConverter.raw],
            [110, 'orpmaxvalue', tuya.valueConverter.raw],
            [111, 'orpminvalue', tuya.valueConverter.raw],
            [112, 'clmaxvalue', tuya.valueConverter.raw],
            [113, 'clminvalue', tuya.valueConverter.raw],
            [117, 'saltvalue', tuya.valueConverter.raw],

        ],
    },
};

module.exports = definition;

@Hammerhand17
Copy link

@ve1koz111 looks like the device is not reachable, try re-pairing it.

It does work perfectly for me now, being updated correctly.

@alexisml
Copy link

alexisml commented Jan 2, 2024

Update on my side:

  1. Moved to dev image
  2. Re-paired the device -> still nothing on values
  3. Manually triggered a call to cluster 0xEF00, attribute 0x03 -> Invoked '61184.3' with payload '{}'

... and now I got values!!

@ve1koz111
Copy link

Looks like it's updating approximately every 10 minutes for me now.

I guess the only thing left to crack is the calibration

@tschiex
Copy link

tschiex commented Jan 3, 2024 via email

@Koenkk
Copy link
Owner

Koenkk commented Jan 4, 2024

@tschiex I've just added polling, dataQuery is sent every 10 minutes automatically.

@tschiex
Copy link

tschiex commented Jan 5, 2024

Ok. Thanks!

Just a note: the current adapter for this device uses µS/m for Salinity units. But this unit is for electrical conductivity, not Salt concentration. It should be either ppm or mg/L (equivalent for diluted water solutions). The TuYa app uses ppm.

Koenkk added a commit to Koenkk/zigbee-herdsman-converters that referenced this issue Jan 6, 2024
@Koenkk
Copy link
Owner

Koenkk commented Jan 6, 2024

@tschiex fixed!

@swainstm
Copy link

This device is polling and collecting data every 10 minutes pretty reliably now. However, the sensor readings seem to be widely variable and much of the time completely wrong. I don't believe this is anything to do with the z2M / Integration in HA, because I see similar behaviour with the zigbee gateway and Smartlife application.

See my post on https://community.home-assistant.io/t/pool-monitoring-device-yieryi-ble-yl01-zigbee-ph-orp-free-chlorine-salinity-etc/659545/9 on 16/1/2024 for further datails.

Just wondering if people with the same sensor are having the same issue, or is my device faulty?

@cloudbr34k84
Copy link
Author

This is why I gave up on this device

@hsdneo
Copy link

hsdneo commented Apr 10, 2024

Update on my side:

  1. Moved to dev image
  2. Re-paired the device -> still nothing on values
  3. Manually triggered a call to cluster 0xEF00, attribute 0x03 -> Invoked '61184.3' with payload '{}'

... and now I got values!!

Can you describe step 3 little bit more how to trigger the device? Is this via MQTT or directly in Z2M?

Edit: Think that I have found the way to send it out:
image

But still no values visible in Z2M...

Edit 2: Now values are coming up. Is there a way to automize this dev command or is this just an initial thing?
image

@hsdneo
Copy link

hsdneo commented Apr 10, 2024

3. 0x03

Where have you added this automated polling?

@hsdneo
Copy link

hsdneo commented Apr 11, 2024

Edit: With the Z2M Logs I found the suitable command and it is working for me now.

@Mushupm
Copy link

Mushupm commented Apr 13, 2024

Hi,
I just got a BLE-YL01 on April 12, 2024.
It is recognized by Z2M 1.36.1.
Values from the sensors (Entities) are not populated (Temp, PH...)
Using Z2M debug log, I can see this message occuring continuously:

Received Zigbee message from 'Testeur eau de piscine', type 'commandMcuVersionResponse', cluster 'manuSpecificTuya', data '{"seq":8153,"version":79}' from endpoint 1 with groupID 0
debug 2024-04-13 09:43:07No converter available for 'BLE-YL01' with cluster 'manuSpecificTuya' and type 'commandMcuVersionResponse' and data '{"seq":8153,"version":79}'

Could you tell me if I can solve this problem?
I am not a programmer and new to HA.

@PaJaSoft
Copy link

Any idea how to make a calibration of this device just with z2m? Android App for Tuya gateway can't help me in any way, right? z2m supports temperature setting calibration only and this is really something else that pH, ORP etc. calibration.

The reported measurements don't look non-sense completely as some others reported here for my device however based on comparison with more reliable devices, my device needs a bit of tuning...

@Mushupm
Copy link

Mushupm commented Apr 24, 2024

Hi,
I am receiving a tuya gateway during this week and I can follow the Z2M procedure defined to integrate BLE-YL01.
Is there any recommendation or request on what I should focus to capture proper messages between Tuya and BLE-Yl01?

@tschiex
Copy link

tschiex commented Apr 24, 2024

Don't spend time with this. I already recorded (with Wireshark) 2 complete ZigBee sessions of the device with a Tuya gateway (one for binding to the gateway, which is how Koenkk identified the need for a "data query" packet , the other for calibration). They are available, with the corresponding network keys for deciphering, above, in some of my comments. What lacks now is brain.time to analyze the second one (calibration).

See #18704 (comment)

@Mushupm
Copy link

Mushupm commented Apr 24, 2024

Thanks for your reply which gives me the status of this device connection.
Hopng that your brain will not explode during calibration.

@Mushupm
Copy link

Mushupm commented Apr 29, 2024

Hi,

I received a Tuya gateway and Ble-yl01 is working well. Calibration procedure has been used.
I would like to get it working on Z2M and I understand that except calibration, Z2M to BLE-Yl01 connection program should provide values from the sensors.
At least, it is of interest for me to get Temp which is the parameter that I would like to use for filtration duration.
As I said in a previous message, on 1.36.1 BLE-YL01 is recognized but no values from sensors are coming.

Could you please, let me know what are the modifications to do in order to get the DEV status which allows to receive values?

I am also prepared to provide debug information (Logs, traces, ...) to help on getting this BLE-YL01 device integrated.

@an0Nym0us63
Copy link

Hello all

I received one of this device.

Everything IS fine except i have strange orp values. The values are négative.

I bought a tuya gateway to perform calibration. I received it today and i noticed that on the gateway orp values are fine

Si i think there is a wrong conversion for orp values (maybe depending on firmware)

I Can provide any information needed to fix this issue

Regards

@Koenkk

@Hammerhand17
Copy link

Hello all

I received one of this device.

Everything IS fine except i have strange orp values. The values are négative.

I bought a tuya gateway to perform calibration. I received it today and i noticed that on the gateway orp values are fine

Si i think there is a wrong conversion for orp values (maybe depending on firmware)

I Can provide any information needed to fix this issue

Regards

@Koenkk

Same for me, plus Free chlorine is always zero, as orp is always negative (right now, -174).

@an0Nym0us63
Copy link

Hello all
I received one of this device.
Everything IS fine except i have strange orp values. The values are négative.
I bought a tuya gateway to perform calibration. I received it today and i noticed that on the gateway orp values are fine
Si i think there is a wrong conversion for orp values (maybe depending on firmware)
I Can provide any information needed to fix this issue
Regards
@Koenkk

Same for me, plus Free chlorine is always zero, as orp is always negative (right now, -174).

Yes i confirm. as orp values are negative free chlorine IS 0

Happy not to be the only one with negative values.

But i Can confirm that on tuya gateway values seems correct

@Hammerhand17
Copy link

Anyone else can help with this? as now it's not dependant of an external converter, I don't know how should I try to find the bad taken value

@juan11perez
Copy link

Edit: With the Z2M Logs I found the suitable command and it is working for me now.

@Mushupm

Can you explain how to send this command?

Thank you

@Mushupm
Copy link

Mushupm commented May 10, 2024

I have not been able to use this device with Z2M.
It was working with Tuya app.
Device is dead getting water inside electronic case.
The seal between upper and lower case was probably bad.
I got back money from Aliexpress and I will not try again this device.
I baught a temperature sensor (Owon) that I should receive today.

@juan11perez
Copy link

@Mushupm
Thank you very much for your response. Much appreciaated.
Seems this device is just not good

@vgibara
Copy link

vgibara commented Jun 18, 2024

No one have a solution for negative orp ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new device support New device support request
Projects
None yet
Development

No branches or pull requests