question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Help adding new device (RTX ZVG1) - Tuya smart garden valve

See original GitHub issue

Hello,

it is my first attempt to add support for new device. I was able to pair device, create converter “stub” and get tuya.dump.txt. But now i’m stuck, don’t know what to do with those “numbers”.

Logs for this device:

info  2021-07-15 15:13:45: 0xb4e3f9fffe0c6b70 (0xb4e3f9fffe0c6b70): ZVG1-Zigbee - RTX RTX ZVG1 Zigbee smart water valve (EndDevice)
info  2021-07-15 15:13:45: 0xb4e3f9fffe0c6b70 (0xb4e3f9fffe0c6b70): ZVG1-Zigbee - RTX RTX ZVG1 Zigbee smart water valve (EndDevice)
info  2021-07-15 15:13:45: Configuring '0xb4e3f9fffe0c6b70'
debug 2021-07-15 15:13:46: Received MQTT message on 'zigbee2mqtt/bridge/info' with data '{"commit":"1.18.1","config":{"advanced":{"adapter_concurrent":null,"adapter_delay":null,"availability_blacklist":[],"availability_blocklist":[],"availability_passlist":[],"availability_timeout":120,"availability_whitelist":[],"cache_state":true,"cache_state_persistent":true,"cache_state_send_on_startup":true,"channel":24,"elapsed":false,"ext_pan_id":[221,221,221,221,221,221,221,221],"homeassistant_discovery_topic":"homeassistant","homeassistant_legacy_triggers":true,"homeassistant_status_topic":"hass/status","last_seen":"disable","legacy_api":false,"log_directory":"/share/zigbee2mqtt/log/%TIMESTAMP%","log_file":"log.txt","log_level":"debug","log_output":["console","file"],"log_rotation":true,"log_syslog":{},"pan_id":6754,"report":false,"soft_reset_timeout":0,"timestamp_format":"YYYY-MM-DD HH:mm:ss"},"ban":[],"blocklist":[],"device_options":{"legacy":false},"devices":{"0x00158d00010f074f":{"friendly_name":"0x00158d00010f074f"},"0x00158d000124417b":{"friendly_name":"0x00158d000124417b","no_occupancy_since":[10,30,60,90,120,300,600,1800],"occupancy_timeout":10},"0x00158d00013067e2":{"friendly_name":"0x00158d00013067e2"},"0x00158d00015aa36b":{"friendly_name":"0x00158d00015aa36b","hold_timeout":1500,"legacy":false},"0x00158d00015aa53f":{"friendly_name":"0x00158d00015aa53f","hold_timeout":1500,"legacy":false},"0x00158d0001644fa1":{"friendly_name":"0x00158d0001644fa1","no_occupancy_since":[10,30,60,90,120,300,600,1800],"occupancy_timeout":10},"0x00158d000165ff2f":{"friendly_name":"0x00158d000165ff2f","no_occupancy_since":[10,30,60,90,120,300,600,1800],"occupancy_timeout":10},"0x00158d00016c3d4c":{"friendly_name":"0x00158d00016c3d4c"},"0x00158d00016c53fc":{"friendly_name":"0x00158d00016c53fc"},"0x00158d00017200b5":{"friendly_name":"0x00158d00017200b5"},"0x00158d0001a66f69":{"friendly_name":"0x00158d0001a66f69","hold_timeout":1500,"legacy":false},"0x00158d0001b95680":{"friendly_name":"0x00158d0001b95680"},"0x00158d0 ...
debug 2021-07-15 15:13:46: Received MQTT message on 'zigbee2mqtt/bridge/info' with data '{"commit":"1.18.1","config":{"advanced":{"adapter_concurrent":null,"adapter_delay":null,"availability_blacklist":[],"availability_blocklist":[],"availability_passlist":[],"availability_timeout":120,"availability_whitelist":[],"cache_state":true,"cache_state_persistent":true,"cache_state_send_on_startup":true,"channel":24,"elapsed":false,"ext_pan_id":[221,221,221,221,221,221,221,221],"homeassistant_discovery_topic":"homeassistant","homeassistant_legacy_triggers":true,"homeassistant_status_topic":"hass/status","last_seen":"disable","legacy_api":false,"log_directory":"/share/zigbee2mqtt/log/%TIMESTAMP%","log_file":"log.txt","log_level":"debug","log_output":["console","file"],"log_rotation":true,"log_syslog":{},"pan_id":6754,"report":false,"soft_reset_timeout":0,"timestamp_format":"YYYY-MM-DD HH:mm:ss"},"ban":[],"blocklist":[],"device_options":{"legacy":false},"devices":{"0x00158d00010f074f":{"friendly_name":"0x00158d00010f074f"},"0x00158d000124417b":{"friendly_name":"0x00158d000124417b","no_occupancy_since":[10,30,60,90,120,300,600,1800],"occupancy_timeout":10},"0x00158d00013067e2":{"friendly_name":"0x00158d00013067e2"},"0x00158d00015aa36b":{"friendly_name":"0x00158d00015aa36b","hold_timeout":1500,"legacy":false},"0x00158d00015aa53f":{"friendly_name":"0x00158d00015aa53f","hold_timeout":1500,"legacy":false},"0x00158d0001644fa1":{"friendly_name":"0x00158d0001644fa1","no_occupancy_since":[10,30,60,90,120,300,600,1800],"occupancy_timeout":10},"0x00158d000165ff2f":{"friendly_name":"0x00158d000165ff2f","no_occupancy_since":[10,30,60,90,120,300,600,1800],"occupancy_timeout":10},"0x00158d00016c3d4c":{"friendly_name":"0x00158d00016c3d4c"},"0x00158d00016c53fc":{"friendly_name":"0x00158d00016c53fc"},"0x00158d00017200b5":{"friendly_name":"0x00158d00017200b5"},"0x00158d0001a66f69":{"friendly_name":"0x00158d0001a66f69","hold_timeout":1500,"legacy":false},"0x00158d0001b95680":{"friendly_name":"0x00158d0001b95680"},"0x00158d0 ...
debug 2021-07-15 15:13:47: Received MQTT message on 'zigbee2mqtt/bridge/devices' with data '[{"definition":null,"endpoints":{"1":{"bindings":[],"clusters":{"input":[],"output":[]},"configured_reportings":[]},"10":{"bindings":[],"clusters":{"input":[],"output":[]},"configured_reportings":[]},"11":{"bindings":[],"clusters":{"input":["ssIasAce"],"output":["ssIasZone","ssIasWd"]},"configured_reportings":[]},"110":{"bindings":[],"clusters":{"input":[],"output":[]},"configured_reportings":[]},"12":{"bindings":[],"clusters":{"input":[],"output":[]},"configured_reportings":[]},"13":{"bindings":[],"clusters":{"input":["genOta"],"output":[]},"configured_reportings":[]},"2":{"bindings":[],"clusters":{"input":[],"output":[]},"configured_reportings":[]},"242":{"bindings":[],"clusters":{"input":[],"output":[]},"configured_reportings":[]},"3":{"bindings":[],"clusters":{"input":[],"output":[]},"configured_reportings":[]},"4":{"bindings":[],"clusters":{"input":[],"output":[]},"configured_reportings":[]},"47":{"bindings":[],"clusters":{"input":[],"output":[]},"configured_reportings":[]},"5":{"bindings":[],"clusters":{"input":[],"output":[]},"configured_reportings":[]},"6":{"bindings":[],"clusters":{"input":[],"output":[]},"configured_reportings":[]},"8":{"bindings":[],"clusters":{"input":[],"output":[]},"configured_reportings":[]}},"friendly_name":"Coordinator","ieee_address":"0x00124b0018de81c2","interview_completed":true,"interviewing":false,"network_address":0,"supported":false,"type":"Coordinator"},{"date_code":"12-20-2019","definition":{"description":"Mi power plug ZigBee","exposes":[{"features":[{"access":7,"description":"On/off state of the switch","name":"state","property":"state","type":"binary","value_off":"OFF","value_on":"ON","value_toggle":"TOGGLE"}],"type":"switch"},{"access":5,"description":"Instantaneous measured power","name":"power","property":"power","type":"numeric","unit":"W"},{"access":1,"description":"Sum of consumed energy","name":"energy","property":"energy","type":"numeric","unit":"kWh" ...
debug 2021-07-15 15:13:47: Received MQTT message on 'zigbee2mqtt/bridge/devices' with data '[{"definition":null,"endpoints":{"1":{"bindings":[],"clusters":{"input":[],"output":[]},"configured_reportings":[]},"10":{"bindings":[],"clusters":{"input":[],"output":[]},"configured_reportings":[]},"11":{"bindings":[],"clusters":{"input":["ssIasAce"],"output":["ssIasZone","ssIasWd"]},"configured_reportings":[]},"110":{"bindings":[],"clusters":{"input":[],"output":[]},"configured_reportings":[]},"12":{"bindings":[],"clusters":{"input":[],"output":[]},"configured_reportings":[]},"13":{"bindings":[],"clusters":{"input":["genOta"],"output":[]},"configured_reportings":[]},"2":{"bindings":[],"clusters":{"input":[],"output":[]},"configured_reportings":[]},"242":{"bindings":[],"clusters":{"input":[],"output":[]},"configured_reportings":[]},"3":{"bindings":[],"clusters":{"input":[],"output":[]},"configured_reportings":[]},"4":{"bindings":[],"clusters":{"input":[],"output":[]},"configured_reportings":[]},"47":{"bindings":[],"clusters":{"input":[],"output":[]},"configured_reportings":[]},"5":{"bindings":[],"clusters":{"input":[],"output":[]},"configured_reportings":[]},"6":{"bindings":[],"clusters":{"input":[],"output":[]},"configured_reportings":[]},"8":{"bindings":[],"clusters":{"input":[],"output":[]},"configured_reportings":[]}},"friendly_name":"Coordinator","ieee_address":"0x00124b0018de81c2","interview_completed":true,"interviewing":false,"network_address":0,"supported":false,"type":"Coordinator"},{"date_code":"12-20-2019","definition":{"description":"Mi power plug ZigBee","exposes":[{"features":[{"access":7,"description":"On/off state of the switch","name":"state","property":"state","type":"binary","value_off":"OFF","value_on":"ON","value_toggle":"TOGGLE"}],"type":"switch"},{"access":5,"description":"Instantaneous measured power","name":"power","property":"power","type":"numeric","unit":"W"},{"access":1,"description":"Sum of consumed energy","name":"energy","property":"energy","type":"numeric","unit":"kWh" ...
debug 2021-07-15 15:13:47: Received MQTT message on 'zigbee2mqtt/0xb4e3f9fffe0c6b70/availability' with data 'online'
info  2021-07-15 15:13:50: MQTT publish: topic 'zigbee2mqtt/0xb4e3f9fffe0c6b70/availability', payload 'online'
info  2021-07-15 15:13:54: Successfully configured '0xb4e3f9fffe0c6b70'
error 2021-07-15 15:13:54: Failed to configure '0xb4e3f9fffe0c6b70', attempt 1 (TypeError: Cannot read property 'configureKey' of undefined
debug 2021-07-15 15:14:30: Received Zigbee message from '0xb4e3f9fffe0c6b70', type 'commandGetData', cluster 'manuSpecificTuya', data '{"data":{"data":[0,0,0,0],"type":"Buffer"},"datatype":2,"dp":11,"fn":0,"status":0,"transid":68}' from endpoint 1 with groupID 0
info  2021-07-15 15:14:30: Configuring '0xb4e3f9fffe0c6b70'
info  2021-07-15 15:14:30: Successfully configured '0xb4e3f9fffe0c6b70'
error 2021-07-15 15:14:30: Failed to configure '0xb4e3f9fffe0c6b70', attempt 2 (TypeError: Cannot read property 'configureKey' of undefined
debug 2021-07-15 15:14:30: Received Zigbee message from '0xb4e3f9fffe0c6b70', type 'commandGetData', cluster 'manuSpecificTuya', data '{"data":{"data":[0],"type":"Buffer"},"datatype":1,"dp":1,"fn":0,"status":0,"transid":69}' from endpoint 1 with groupID 0
info  2021-07-15 15:14:30: Configuring '0xb4e3f9fffe0c6b70'
debug 2021-07-15 15:14:35: Received Zigbee message from '0xb4e3f9fffe0c6b70', type 'commandGetData', cluster 'manuSpecificTuya', data '{"data":{"data":[0,0,2,88],"type":"Buffer"},"datatype":2,"dp":15,"fn":0,"status":0,"transid":70}' from endpoint 1 with groupID 0
info  2021-07-15 15:14:35: Successfully configured '0xb4e3f9fffe0c6b70'
error 2021-07-15 15:14:35: Failed to configure '0xb4e3f9fffe0c6b70', attempt 3 (TypeError: Cannot read property 'configureKey' of undefined
debug 2021-07-15 15:14:35: Received Zigbee message from '0xb4e3f9fffe0c6b70', type 'commandGetData', cluster 'manuSpecificTuya', data '{"data":{"data":[2],"type":"Buffer"},"datatype":4,"dp":12,"fn":0,"status":0,"transid":71}' from endpoint 1 with groupID 0
debug 2021-07-15 15:15:10: Received Zigbee message from '0xb4e3f9fffe0c6b70', type 'commandGetData', cluster 'manuSpecificTuya', data '{"data":{"data":[1],"type":"Buffer"},"datatype":1,"dp":1,"fn":0,"status":0,"transid":72}' from endpoint 1 with groupID 0
debug 2021-07-15 15:15:10: Received Zigbee message from '0xb4e3f9fffe0c6b70', type 'commandGetData', cluster 'manuSpecificTuya', data '{"data":{"data":[1],"type":"Buffer"},"datatype":4,"dp":12,"fn":0,"status":0,"transid":73}' from endpoint 1 with groupID 0
debug 2021-07-15 15:15:10: Received Zigbee message from '0xb4e3f9fffe0c6b70', type 'commandGetData', cluster 'manuSpecificTuya', data '{"data":{"data":[0,0,2,88],"type":"Buffer"},"datatype":2,"dp":11,"fn":0,"status":0,"transid":74}' from endpoint 1 with groupID 0
debug 2021-07-15 15:15:30: Received Zigbee message from '0xb4e3f9fffe0c6b70', type 'commandGetData', cluster 'manuSpecificTuya', data '{"data":{"data":[0,0,2,28],"type":"Buffer"},"datatype":2,"dp":11,"fn":0,"status":0,"transid":75}' from endpoint 1 with groupID 0
debug 2021-07-15 15:15:40: Received Zigbee message from '0xb4e3f9fffe0c6b70', type 'commandGetData', cluster 'manuSpecificTuya', data '{"data":{"data":[0,0,0,100],"type":"Buffer"},"datatype":2,"dp":7,"fn":0,"status":0,"transid":76}' from endpoint 1 with groupID 0
debug 2021-07-15 15:16:30: Received Zigbee message from '0xb4e3f9fffe0c6b70', type 'commandGetData', cluster 'manuSpecificTuya', data '{"data":{"data":[0,0,1,224],"type":"Buffer"},"datatype":2,"dp":11,"fn":0,"status":0,"transid":77}' from endpoint 1 with groupID 0
debug 2021-07-15 15:17:30: Received Zigbee message from '0xb4e3f9fffe0c6b70', type 'commandGetData', cluster 'manuSpecificTuya', data '{"data":{"data":[0,0,1,164],"type":"Buffer"},"datatype":2,"dp":11,"fn":0,"status":0,"transid":78}' from endpoint 1 with groupID 0
debug 2021-07-15 15:18:30: Received Zigbee message from '0xb4e3f9fffe0c6b70', type 'commandGetData', cluster 'manuSpecificTuya', data '{"data":{"data":[0,0,1,104],"type":"Buffer"},"datatype":2,"dp":11,"fn":0,"status":0,"transid":79}' from endpoint 1 with groupID 0
debug 2021-07-15 15:18:48: Non-pingable device '0xb4e3f9fffe0c6b70' was last seen '18.347' seconds ago.
debug 2021-07-15 15:19:30: Received Zigbee message from '0xb4e3f9fffe0c6b70', type 'commandGetData', cluster 'manuSpecificTuya', data '{"data":{"data":[0,0,1,44],"type":"Buffer"},"datatype":2,"dp":11,"fn":0,"status":0,"transid":80}' from endpoint 1 with groupID 0
debug 2021-07-15 15:20:30: Received Zigbee message from '0xb4e3f9fffe0c6b70', type 'commandGetData', cluster 'manuSpecificTuya', data '{"data":{"data":[0,0,0,240],"type":"Buffer"},"datatype":2,"dp":11,"fn":0,"status":0,"transid":81}' from endpoint 1 with groupID 0
debug 2021-07-15 15:21:30: Received Zigbee message from '0xb4e3f9fffe0c6b70', type 'commandGetData', cluster 'manuSpecificTuya', data '{"data":{"data":[0,0,0,180],"type":"Buffer"},"datatype":2,"dp":11,"fn":0,"status":0,"transid":82}' from endpoint 1 with groupID 0
debug 2021-07-15 15:22:30: Received Zigbee message from '0xb4e3f9fffe0c6b70', type 'commandGetData', cluster 'manuSpecificTuya', data '{"data":{"data":[0,0,0,120],"type":"Buffer"},"datatype":2,"dp":11,"fn":0,"status":0,"transid":83}' from endpoint 1 with groupID 0
debug 2021-07-15 15:23:30: Received Zigbee message from '0xb4e3f9fffe0c6b70', type 'commandGetData', cluster 'manuSpecificTuya', data '{"data":{"data":[0,0,0,60],"type":"Buffer"},"datatype":2,"dp":11,"fn":0,"status":0,"transid":84}' from endpoint 1 with groupID 0
debug 2021-07-15 15:23:48: Non-pingable device '0xb4e3f9fffe0c6b70' was last seen '18.407' seconds ago.
debug 2021-07-15 15:24:30: Received Zigbee message from '0xb4e3f9fffe0c6b70', type 'commandGetData', cluster 'manuSpecificTuya', data '{"data":{"data":[0,0,0,0],"type":"Buffer"},"datatype":2,"dp":11,"fn":0,"status":0,"transid":85}' from endpoint 1 with groupID 0
debug 2021-07-15 15:24:30: Received Zigbee message from '0xb4e3f9fffe0c6b70', type 'commandGetData', cluster 'manuSpecificTuya', data '{"data":{"data":[0],"type":"Buffer"},"datatype":1,"dp":1,"fn":0,"status":0,"transid":86}' from endpoint 1 with groupID 0
debug 2021-07-15 15:24:30: Received Zigbee message from '0xb4e3f9fffe0c6b70', type 'commandGetData', cluster 'manuSpecificTuya', data '{"data":{"data":[0,0,2,88],"type":"Buffer"},"datatype":2,"dp":15,"fn":0,"status":0,"transid":87}' from endpoint 1 with groupID 0
debug 2021-07-15 15:24:30: Received Zigbee message from '0xb4e3f9fffe0c6b70', type 'commandGetData', cluster 'manuSpecificTuya', data '{"data":{"data":[2],"type":"Buffer"},"datatype":4,"dp":12,"fn":0,"status":0,"transid":88}' from endpoint 1 with groupID 0
debug 2021-07-15 15:25:30: Received Zigbee message from '0xb4e3f9fffe0c6b70', type 'commandSetTimeRequest', cluster 'manuSpecificTuya', data '{"payload":[],"payloadSize":0}' from endpoint 1 with groupID 0
debug 2021-07-15 15:26:30: Received Zigbee message from '0xb4e3f9fffe0c6b70', type 'commandGetData', cluster 'manuSpecificTuya', data '{"data":{"data":[0,0,0,100],"type":"Buffer"},"datatype":2,"dp":7,"fn":0,"status":0,"transid":90}' from endpoint 1 with groupID 0
debug 2021-07-15 15:28:48: Non-pingable device '0xb4e3f9fffe0c6b70' was last seen '138.326' seconds ago.
debug 2021-07-15 15:30:21: Received Zigbee message from '0xb4e3f9fffe0c6b70', type 'raw', cluster 'manuSpecificTuya', data '{"data":[25,89,36,0,24],"type":"Buffer"}' from endpoint 1 with groupID 0
debug 2021-07-15 15:33:48: Non-pingable device '0xb4e3f9fffe0c6b70' was last seen '206.719' seconds ago.
debug 2021-07-15 15:37:30: Received Zigbee message from '0xb4e3f9fffe0c6b70', type 'commandGetData', cluster 'manuSpecificTuya', data '{"data":{"data":[0,0,0,100],"type":"Buffer"},"datatype":2,"dp":7,"fn":0,"status":0,"transid":91}' from endpoint 1 with groupID 0
debug 2021-07-15 15:38:48: Non-pingable device '0xb4e3f9fffe0c6b70' was last seen '78.455' seconds ago.
debug 2021-07-15 15:43:48: Non-pingable device '0xb4e3f9fffe0c6b70' was last seen '378.473' seconds ago.

tuya.dump.txt

1626354870401 0xb4e3f9fffe0c6b70 00 44 0b 02 00 00 00 00 00
1626354870630 0xb4e3f9fffe0c6b70 00 45 01 01 00 00
1626354875784 0xb4e3f9fffe0c6b70 00 46 0f 02 00 00 00 02 58
1626354876007 0xb4e3f9fffe0c6b70 00 47 0c 04 00 02
1626354910603 0xb4e3f9fffe0c6b70 00 48 01 01 00 01
1626354910815 0xb4e3f9fffe0c6b70 00 49 0c 04 00 01
1626354910949 0xb4e3f9fffe0c6b70 00 4a 0b 02 00 00 00 02 58
1626354930353 0xb4e3f9fffe0c6b70 00 4b 0b 02 00 00 00 02 1c
1626354940826 0xb4e3f9fffe0c6b70 00 4c 07 02 00 00 00 00 64
1626354990315 0xb4e3f9fffe0c6b70 00 4d 0b 02 00 00 00 01 e0
1626355050312 0xb4e3f9fffe0c6b70 00 4e 0b 02 00 00 00 01 a4
1626355110302 0xb4e3f9fffe0c6b70 00 4f 0b 02 00 00 00 01 68
1626355170291 0xb4e3f9fffe0c6b70 00 50 0b 02 00 00 00 01 2c
1626355230285 0xb4e3f9fffe0c6b70 00 51 0b 02 00 00 00 00 f0
1626355290311 0xb4e3f9fffe0c6b70 00 52 0b 02 00 00 00 00 b4
1626355350269 0xb4e3f9fffe0c6b70 00 53 0b 02 00 00 00 00 78
1626355410265 0xb4e3f9fffe0c6b70 00 54 0b 02 00 00 00 00 3c
1626355470294 0xb4e3f9fffe0c6b70 00 55 0b 02 00 00 00 00 00
1626355470412 0xb4e3f9fffe0c6b70 00 56 01 01 00 00
1626355470639 0xb4e3f9fffe0c6b70 00 57 0f 02 00 00 00 02 58
1626355470765 0xb4e3f9fffe0c6b70 00 58 0c 04 00 02
1626355590342 0xb4e3f9fffe0c6b70 00 5a 07 02 00 00 00 00 64
1626356250237 0xb4e3f9fffe0c6b70 00 5b 07 02 00 00 00 00 64
1626356910148 0xb4e3f9fffe0c6b70 00 5c 07 02 00 00 00 00 64

Any help appreciated 😃

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
jacekpaszkowskicommented, Jul 3, 2022

Hi,

today i’ve noticed problems with device in Zigbee2Mqtt. I had to rewrite some code, this is working version 😃

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 tuya = require('zigbee-herdsman-converters/lib/tuya');
const e = exposes.presets;
const ea = exposes.access;

const definition = {
    // Since a lot of Tuya devices use the same modelID, but use different data points
    // it's usually necessary to provide a fingerprint instead of a zigbeeModel
    fingerprint: [
        {
            modelID: 'TS0601',
            manufacturerName: '_TZE200_akjefhj5'
        },
    ],
    model: 'ZVG1',
    vendor: 'RTX',
    description: 'Zigbee smart water valve',
    fromZigbee: [{
		cluster: 'manuSpecificTuya',
		type: ['commandDataResponse', 'commandDataReport'],
		convert: (model, msg, publish, options, meta) => {
            const result = {};
            for (const dpValue of msg.data.dpValues) {
                const dp = dpValue.dp; // First we get the data point ID
                const value = tuya.getDataValue(dpValue); // This function will take care of converting the data to proper JS type
                
                //meta.logger.info(`zigbee-herdsman-converters:RTXZVG1Valve: DP ` + `#${dp} with data ${JSON.stringify(value)}`);
                    
                switch (dp) {
                    case tuya.dataPoints.state: {
                        return {state: value ? 'ON': 'OFF'};
                    }
                    case 5: {
                        // i assume value is reported in fl. oz.
                        return {water_consumed: (value / 33.8140226).toFixed(2)};
                    }
                    case 7: {
                        return {battery: value};
                    }
                    case 11: {
                        // value reported in seconds
                        return {timer_time_left: value / 60};
                    }
                    case 12: {
                        if (value === 0) return {timer_state: 'disabled'};
                        else if (value === 1) return {timer_state: 'active', state: 'ON'};
                        else return {timer_state: 'enabled', state: 'OFF'};
                    }
                    case 15: {
                        // value reported in seconds
                        return {last_valve_open: value / 60};
                    }
                    default: {
                        meta.logger.warn(`zigbee-herdsman-converters: RTXZVG1Valve: NOT RECOGNIZED DP ` +
                            `#${dp} with data ${JSON.stringify(value)}`);
                    }
                }
            }
            return result;
        }
        },
        fz.ignore_tuya_set_time,
        fz.ignore_basic_report,
        //fz.tuya_data_point_dump, // This is a debug converter, it will be described in the next part
    ],
    toZigbee: [
	    tz.tuya_switch_state,
		{
            key: ['timer'],
            convertSet: async (entity, key, value, meta) => {
			    const timer = 60 * Math.abs(Math.min(value, 360));
                await tuya.sendDataPointValue(entity, 11, timer); // tuya.sendDataPoint* functions take care of converting the data to proper format
			    return {state: {timer: value}};
            }
	    },
        //tz.tuya_data_point_test, // Another debug converter
    ],
    onEvent: tuya.onEventSetTime, // Add this if you are getting no converter for 'commandMcuSyncTime'
    configure: async (device, coordinatorEndpoint, logger) => {
        const endpoint = device.getEndpoint(1);
        await reporting.bind(endpoint, coordinatorEndpoint, ['genBasic']);
    },
    exposes: [e.switch().setAccess('state', ea.STATE_SET), e.battery(),
              exposes.enum('timer_state', ea.STATE_GET, ['disabled', 'active', 'enabled']),
              exposes.numeric('timer', ea.STATE_SET).withValueMin(0).withValueMax(360).withUnit('min')
                .withDescription('Auto off after specific time'),
              exposes.numeric('timer_time_left', ea.STATE_GET).withUnit('min')
                .withDescription('Auto off timer time left'),
              exposes.numeric('last_valve_open', ea.STATE_GET).withUnit('min')
                .withDescription('Time the valve was open when state on'),
              exposes.numeric('water_consumed', ea.STATE_GET).withUnit('l')
                .withDescription('Liters of water consumed')],
};

module.exports = definition;```
0reactions
ytzelfcommented, Jul 12, 2022

Hi @jacekpaszkowski Thanks a lot for the hard work - very much interested in this myself.

Could you please shed some light on what’s changed vs. initial converter? I have these devices and there’s numerous bug around timer state and timer resetting to 10min after each state change. Does this new converter fix these? When I try adding this custom converter to z2m it craps out with the very generic error below - are you sure the syntax is correct?

SyntaxError: Unexpected end of input at new Script (node:vm:100:7) at createScript (node:vm:257:10) at Object.runInNewContext (node:vm:298:10) at loadModuleFromText (/app/lib/util/utils.ts:148:8) at loadModuleFromFile (/app/lib/util/utils.ts:155:12) at Object.getExternalConvertersDefinitions (/app/lib/util/utils.ts:165:25) at getExternalConvertersDefinitions.next (<anonymous>) at new ExternalConverters (/app/lib/extension/externalConverters.ts:12:20) at new Controller (/app/lib/controller.ts:84:58) at start (/app/index.js:108:18)

Thanks again!

Read more comments on GitHub >

github_iconTop Results From Across the Web

ZigBee water consumption measuring valve - Tuya RTX ...
Intelligent wireless valve with water consumption measurement function. The RTX ZVG1 valve for communication uses the ZigBee 3.0 standard, a dedicated Tuya gate ......
Read more >
Support new TuYa devices - Zigbee2MQTT
TuYa devices use a custom manuSpecificTuya cluster, the instructions below will help you understand ... Adding support for TuYa devices is a bit...
Read more >
RTX ZVG1 smart water valve - deCONZ Community
RTX ZVG1 smart water valve · Device Requests · Beercik August 26, 2021, 4:04pm #1. github.com/dresden-elektronik/deconz-rest-plugin ...
Read more >
Device support - homebridge-z2m
Check which Zigbee devices you can control with homebridge-z2m. ... TS0001, CR Smart Home Valve control (white-label of TuYa TS0001).
Read more >
Zigbee Home Automation (ZHA)
Database of Zigbee devices compatible with ZHA, Tasmota, Zigbee2MQTT, ... RTX ZVG1, RTX Irrigation Valve, ZVG1. Tuya ZG-V01, Tuya Gas/Water Valve, ZG-V01.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found