zigbee2mqtt icon indicating copy to clipboard operation
zigbee2mqtt copied to clipboard

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

Open cloudbr34k84 opened this issue 2 years ago • 163 comments

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 avatar Aug 23 '23 11:08 cloudbr34k84

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 avatar Aug 24 '23 23:08 cloudbr34k84

@Koenkk where is a list of the supported datapoints?

cloudbr34k84 avatar Aug 24 '23 23:08 cloudbr34k84

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

Koenkk avatar Aug 25 '23 06:08 Koenkk

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

mochitoju avatar Sep 01 '23 05:09 mochitoju

no its not, i dont know what im doing lol

cloudbr34k84 avatar Sep 06 '23 10:09 cloudbr34k84

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

cloudbr34k84 avatar Sep 06 '23 10:09 cloudbr34k84

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?

tschiex avatar Sep 06 '23 19:09 tschiex

i follow the the instructions on Z2M https://www.zigbee2mqtt.io/advanced/support-new-devices/03_find_tuya_data_points.html

On Thu, 7 Sept 2023 at 05:44, Thomas Schiex @.***> wrote:

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 https://github.com/cloudbr34k84 Brad, how did you get the Data Points?

— Reply to this email directly, view it on GitHub https://github.com/Koenkk/zigbee2mqtt/issues/18704#issuecomment-1708990727, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOB2WBER4VB3X5EG7OOUEOLXZDHDLANCNFSM6AAAAAA33LB5ZE . You are receiving this because you were mentioned.Message ID: @.***>

cloudbr34k84 avatar Sep 06 '23 21:09 cloudbr34k84

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

cloudbr34k84 avatar Sep 09 '23 07:09 cloudbr34k84

Yes, that would bei great!

mochitoju avatar Sep 09 '23 09:09 mochitoju

That would be great for me too!!!

Freev4lley avatar Sep 09 '23 12:09 Freev4lley

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

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

Koenkk avatar Sep 09 '23 13:09 Koenkk

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 https://github.com/zigpy/zha-device-handlers/issues/2565).

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

tschiex avatar Sep 10 '23 18:09 tschiex

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

cloudbr34k84 avatar Sep 10 '23 23:09 cloudbr34k84

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 avatar Sep 11 '23 12:09 tschiex

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',

tschiex avatar Sep 11 '23 12:09 tschiex

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 ... ;-)

BabaIsYou avatar Sep 11 '23 12:09 BabaIsYou

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

Koenkk avatar Sep 11 '23 18:09 Koenkk

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'

cloudbr34k84 avatar Sep 11 '23 21:09 cloudbr34k84

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;

alray31 avatar Sep 12 '23 20:09 alray31

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

Koenkk avatar Sep 13 '23 17:09 Koenkk

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

@Koenkk Screenshot_20230914-044527.png

cloudbr34k84 avatar Sep 13 '23 18:09 cloudbr34k84

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.

Koenkk avatar Sep 14 '23 17:09 Koenkk

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)

cloudbr34k84 avatar Sep 14 '23 20:09 cloudbr34k84

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 avatar Sep 16 '23 07:09 Koenkk

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 avatar Sep 16 '23 09:09 cloudbr34k84

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 avatar Sep 16 '23 22:09 cloudbr34k84

@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;

cloudbr34k84 avatar Sep 16 '23 23:09 cloudbr34k84

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

It would expect it still does not provide any data?

Can you provide me the debug log from starting z2m, pairing the device and waiting 5 minutes after that?

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

Koenkk avatar Sep 17 '23 06:09 Koenkk

im not 100% sure how i get the logs tbh I have it enabled and on the tabs inside the Z2M add on, I can see all the logs but I just don't understand how to get the a logfile, however, im not running a docker version of Z2M..

cloudbr34k84 avatar Sep 17 '23 06:09 cloudbr34k84