Koenkk / zigbee2mqtt

Zigbee 🐝 to MQTT bridge 🌉, get rid of your proprietary Zigbee bridges 🔨
https://www.zigbee2mqtt.io
GNU General Public License v3.0
12.03k stars 1.67k forks source link

[New device support]: tuya/Matsee plus current clamp meter #15359

Closed uowis closed 1 year ago

uowis commented 1 year ago

Link

https://fr.aliexpress.com/item/1005004948381800.html?spm=a2g0o.productlist.0.0.31a631410zhHLp&algo_pvid=def1e34d-7ff1-4539-b467-eeeaa6c164ba&algo_exp_id=def1e34d-7ff1-4539-b467-eeeaa6c164ba-12&pdp_ext_f=%7B%22sku_id%22%3A%2212000031119654070%22%7D&pdp_npi=2%40dis%21EUR%2157.81%2127.17%21%21%21%21%21%402100bb4a16701892996707394e5162%2112000031119654070%21sea&curPageLogUid=kahBvYoaamVy

Database entry

{"id":27,"type":"Router","ieeeAddr":"0xe0798dfffede3b6d","nwkAddr":25319,"manufId":4098,"manufName":"_TZE204_cjbofhxw","powerSource":"Mains (single phase)","modelId":"TS0601","epList":[1],"endpoints":{"1":{"profId":260,"epId":1,"devId":81,"inClusterList":[0,4,5,61184],"outClusterList":[25,10],"clusters":{"genBasic":{"attributes":{"65503":"\u0000\u0000\u0000\u0000f\u0000\u0000\u0000\u0000\u0012\u0000\u0000\u0000\u0000\u0012","65506":31,"65508":0,"65534":0,"modelId":"TS0601","manufacturerName":"_TZE204_cjbofhxw","powerSource":1,"zclVersion":3,"appVersion":70,"stackVersion":0,"hwVersion":1,"dateCode":""}}},"binds":[{"cluster":0,"type":"endpoint","deviceIeeeAddress":"0x00212effff07b952","endpointID":1}],"configuredReportings":[],"meta":{}}},"appVersion":70,"stackVersion":0,"hwVersion":1,"dateCode":"","zclVersion":3,"interviewCompleted":true,"meta":{"configured":-708457359},"lastSeen":1670193766558,"defaultSendRequestWhen":"immediate"}

Comments

fingerprint: tuya.fingerprint('TS0601', ['_TZE204_cjbofhxw']),

I have try to make an external converter but i have this error :

022-12-04T22:47:04.388Z zigbee-herdsman:deconz:driver query aps data indication
2022-12-04T22:47:04.389Z zigbee-herdsman:deconz:driver DATA_INDICATION - sending read data request - SeqNr. 88
2022-12-04T22:47:04.394Z zigbee-herdsman:deconz:frameParser DATA_INDICATION RESPONSE - seqNr. 88 srcAddr: 0x62e7 destAddr: 0x0 profile id: 0x104 cluster id: 0xef00 lqi: 212
2022-12-04T22:47:04.394Z zigbee-herdsman:deconz:frameParser response payload: 9,106,37,65,0
2022-12-04T22:47:04.397Z zigbee-herdsman:deconz:adapter could not parse zclFrame: Error: Cluster 'manuSpecificTuya' has no command response '37'
2022-12-04T22:47:04.400Z zigbee-herdsman:controller:log Received 'raw' data '{"clusterID":61184,"data":{"type":"Buffer","data":[9,106,37,65,0]},"address":25319,"endpoint":1,"linkquality":212,"groupID":null,"wasBroadcast":false,"destinationEndpoint":1}'
Zigbee2MQTT:debug 2022-12-04 23:47:04: Received Zigbee message from 'energy plaque cuisson', type 'raw', cluster 'manuSpecificTuya', data '{"data":[9,106,37,65,0],"type":"Buffer"}' from endpoint 1 with groupID null
Zigbee2MQTT:debug 2022-12-04 23:47:04: No converter available for 'TS0601_1_phase_clamp_meter' with cluster 'manuSpecificTuya' and type 'raw' and data '{"data":[9,106,37,65,0],"type":"Buffer"}'
2022-12-04T22:47:04.411Z zigbee-herdsman:deconz:driver networkstate: 2 apsDataConfirm: 0 apsDataIndication: 0 configChanged: 0 apsRequestFreeSlots: 1
2022-12-04T22:47:04.583Z zigbee-herdsman:deconz:frameParser DEVICE_STATE changed: 10101010
2022-12-04T22:47:04.583Z zigbee-herdsman:deconz:driver networkstate: 2 apsDataConfirm: 0 apsDataIndication: 1 configChanged: 0 apsRequestFreeSlots: 1

External converter

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

const definition = {
    fingerprint: tuya.fingerprint('TS0601', ['_TZE204_cjbofhxw']),
    model: 'TS0601_1_phase_clamp_meter',
    vendor: 'TuYa',
    description: '1 phase clamp power meter',
    fromZigbee: [tuya.fzDataPoints],
    toZigbee: [tuya.tzDataPoints],
    onEvent: tuya.onEventSetTime, // Add this if you are getting no converter for 'commandMcuSyncTime'
    configure: tuya.configureMagicPacket,
    exposes: [],
    meta: {
        tuyaDatapoints: [

        ],
    },
};

module.exports = definition;

Supported color modes

No response

Color temperature range

No response

Clem- commented 1 year ago

Hi, I've just received the same device as yours and didn't manage to make it works by using an existing Tuya Meter device adapter.

If this can help :

[9,114,37,170,0] // data when clamp **not** connected on live wire
[9,58,37,56,0] // data when current running trough clamp:
lugiis commented 1 year ago

https://github.com/Koenkk/zigbee2mqtt/issues/14790 It's still useful, it's from the same manufacturer

Clem- commented 1 year ago

See also this issue from zigpy/zha for the same device.

mrbluebrett commented 1 year ago

I received the same today. But i have no tuya zigbee gateway to help with the endpoints… :(

Clem- commented 1 year ago

Seller has provided those information:

//current(only report) //备注:

define DPID_CUR_CURRENT 18

//power(only report) //备注:

define DPID_CUR_POWER 19

//voltage(only report) //备注:

define DPID_CUR_VOLTAGE 20

// add electric (only report) //备注:

define DPID_ELECTRIC_ADD 101

And also a link to this blog post.

uowis commented 1 year ago

[9,114,37,170,0] // data when clamp not connected on live wire [9,58,37,56,0] // data when current running trough clamp:

I have same value in [9,xx,37, xx, 00] 9 and 37 are static and the xx change every time,... i thing this array have no the value.

Clem, after device apaired ? Is the red light stay on ? and in Zigbee2mqtt log could you find this error :

zigbee-herdsman:deconz:frameParser response payload: 9,32,37,44,0
2022-12-06T08:40:26.827Z zigbee-herdsman:deconz:adapter could not parse zclFrame: Error: Cluster 'manuSpecificTuya' has no command response '37'
Clem- commented 1 year ago

Light is steady red after pairing, yes. I have the same log error.

What is weird is that there isn't any Datapoint reported in the log. Could it be due to a bad pairing of the device?

uowis commented 1 year ago

Sophie from Matsee plus say me that 'light stay on' mean that the device is disconnect,...

uowis commented 1 year ago

I could try many converter model like this one https://github.com/Koenkk/zigbee2mqtt/issues/14790 or this blog I have ever the same error and the same static value energy : 9 and power : 37

uowis commented 1 year ago

Voir aussi ce problème de zigpy/zha pour le même appareil. In this issue why have similar error : Unknown cluster command 37

uowis commented 1 year ago

I'm a newbie and i don"t understand all detail but it seems to be a similar issue here :

14519

lugiis commented 1 year ago

One question since you're talking to Sophie de Matsee, she can't provide us with the necessary information about you. I don't have a port compatible with tuya either.

guillermohor commented 1 year ago

Same device,same problem here. 'Zigbee2MQTT:debug 2022-12-06 14:18:14: Received Zigbee message from 'Medidor', type 'raw', cluster 'manuSpecificTuya', data '{"data":[9,83,37,211,0],"type":"Buffer"}' from endpoint 1 with groupID null Zigbee2MQTT:debug 2022-12-06 14:18:14: No converter available for '_TZE204_cjbofhxw' with cluster 'manuSpecificTuya' and type 'raw' and data '{"data":[9,83,37,211,0],"type":"Buffer"}'

Koenkk commented 1 year ago

Please check with https://gist.github.com/Koenkk/8fc146f998e2bd9986df783164f4f3df (requires z2m 1.28.4). Double check that the reported values are correct (e.g. could be possible that they have to be divided by 100)

guillermohor commented 1 year ago

current Instantaneous measured electrical current N/AA power Instantaneous measured power N/AW voltage Measured electrical potential value N/AV linkquality Link quality (signal strength) 255lqi

guillermohor commented 1 year ago

Zigbee2MQTT:debug 2022-12-06 18:54:37: Received Zigbee message from 'Medidor', type 'raw', cluster 'manuSpecificTuya', data '{"data":[9,100,37,251,0],"type":"Buffer"}' from endpoint 1 with groupID null Zigbee2MQTT:debug 2022-12-06 18:54:37: No converter available for 'TS0601_clamp_meter' with cluster 'manuSpecificTuya' and type 'raw' and data '{"data":[9,100,37,251,0],"type":"Buffer"}'

guillermohor commented 1 year ago

IMG_20221206_190220 I have copied everything in "_TZE204_cjbofhxw.js" from the link.

neooffline commented 1 year ago

Same Issue (z2m version: 1.28.4-1 ) Zigbee2MQTT:debug 2022-12-06 21:30:18: Received Zigbee message from 'Power Meter', type 'raw', cluster 'manuSpecificTuya', data '{"data":[9,109,37,172,0],"type":"Buffer"}' from endpoint 1 with groupID 0 Zigbee2MQTT:debug 2022-12-06 21:30:18: No converter available for 'TS0601_clamp_meter' with cluster 'manuSpecificTuya' and type 'raw' and data '{"data":[9,109,37,172,0],"type":"Buffer"}' Zigbee2MQTT:info 2022-12-06 21:30:18: MQTT publish: topic 'zigbee2mqtt/Power Meter', payload '{"current":null,"last_seen":"2022-12-06T18:30:18.453Z","linkquality":58,"power":null,"state":"ON","voltage":null}' 2022-12-06T18:30:18.462Z zigbee-herdsman:adapter:zStack:unpi:parser --- parseNext [] 2022-12-06T18:30:18.648Z zigbee-herdsman:adapter:zStack:unpi:parser <-- [254,25,68,129,0,0,0,239,201,180,1,1,0,58,0,82,164,117,0,0,5,9,109,37,172,0,201,180,29,127] 2022-12-06T18:30:18.648Z zigbee-herdsman:adapter:zStack:unpi:parser --- parseNext [254,25,68,129,0,0,0,239,201,180,1,1,0,58,0,82,164,117,0,0,5,9,109,37,172,0,201,180,29,127] 2022-12-06T18:30:18.649Z zigbee-herdsman:adapter:zStack:unpi:parser --> parsed 25 - 2 - 4 - 129 - [0,0,0,239,201,180,1,1,0,58,0,82,164,117,0,0,5,9,109,37,172,0,201,180,29] - 127

Clem- commented 1 year ago

It might be due to something going wrong during the pairing, like an operation missing in the configure attribute?

The red light after pairing isn’t right according to the seller and the only message sent by the device seems to be something like a clock or heartbeat.

mrbluebrett commented 1 year ago

Same here... Debug 2022-12-07 10:11:52Received Zigbee message from '0xe0798dfffede41bc', type 'raw', cluster 'manuSpecificTuya', data '{"data":[9,110,37,98,0],"type":"Buffer"}' from endpoint 1 with groupID 0 Debug 2022-12-07 10:11:52No converter available for 'TS0601_clamp_meter' with cluster 'manuSpecificTuya' and type 'raw' and data '{"data":[9,110,37,98,0],"type":"Buffer"}'

In the log it only shows endpoint 1. Light stays red... so i guess it's not completely paired...

uowis commented 1 year ago

Please check with https://gist.github.com/Koenkk/8fc146f998e2bd9986df783164f4f3df (requires z2m 1.28.4). Double check that the reported values are correct (e.g. could be possible that they have to be divided by 100)

2022-12-07T10:34:25.556Z zigbee-herdsman:deconz:driver networkstate: 2 apsDataConfirm: 0 apsDataIndication: 0 configChanged: 0 apsRequestFreeSlots: 1
2022-12-07T10:34:25.727Z zigbee-herdsman:deconz:frameParser DEVICE_STATE changed: 10101010
2022-12-07T10:34:25.727Z zigbee-herdsman:deconz:driver networkstate: 2 apsDataConfirm: 0 apsDataIndication: 1 configChanged: 0 apsRequestFreeSlots: 1
2022-12-07T10:34:25.729Z zigbee-herdsman:deconz:driver query aps data indication
2022-12-07T10:34:25.734Z zigbee-herdsman:deconz:driver DATA_INDICATION - sending read data request - SeqNr. 16
2022-12-07T10:34:25.738Z zigbee-herdsman:deconz:frameParser DATA_INDICATION RESPONSE - seqNr. 16 srcAddr: 0x3384 destAddr: 0x0 profile id: 0x104 cluster id: 0xef00 lqi: 255
2022-12-07T10:34:25.739Z zigbee-herdsman:deconz:frameParser response payload: 9,12,37,111,0
2022-12-07T10:34:25.740Z zigbee-herdsman:deconz:adapter could not parse zclFrame: Error: Cluster 'manuSpecificTuya' has no command response '37'
2022-12-07T10:34:25.742Z zigbee-herdsman:controller:log Received 'raw' data '{"clusterID":61184,"data":{"type":"Buffer","data":[9,12,37,111,0]},"address":13188,"endpoint":1,"linkquality":255,"groupID":null,"wasBroadcast":false,"destinationEndpoint":1}'
Zigbee2MQTT:debug 2022-12-07 11:34:25: Received Zigbee message from '0xe0798dfffede3b6d', type 'raw', cluster 'manuSpecificTuya', data '{"data":[9,12,37,111,0],"type":"Buffer"}' from endpoint 1 with groupID null
Zigbee2MQTT:debug 2022-12-07 11:34:25: No converter available for 'TS0601_clamp_meter' with cluster 'manuSpecificTuya' and type 'raw' and data '{"data":[9,12,37,111,0],"type":"Buffer"}'

no state after reapaired :

{
    "linkquality": 255
}
uowis commented 1 year ago

Is it possible that device need some 'response' to finalise apairing ?

Koenkk commented 1 year ago

Can you provide a herdsman debug log when receiving a message from this device?

See https://www.zigbee2mqtt.io/guide/usage/debug.html on how to enable the herdsman debug logging. Note that this is only logged to STDOUT and not to log files.

neooffline commented 1 year ago

@Koenkk I sent log with herdsman debug on in message tap

guillermohor commented 1 year ago

2022-12-08T10:25:46.989Z zigbee-herdsman:controller:log Received 'raw' data '{"clusterID":61184,"data":{"type":"Buffer","data":[9,97,37,192,0]},"address":52428,"endpoint":1,"linkquality":255,"groupID":null,"wasBroadcast":false,"destinationEndpoint":1}' Zigbee2MQTT:debug 2022-12-08 11:25:46: Received Zigbee message from '0xf4b3b1fffec88e6c', type 'raw', cluster 'manuSpecificTuya', data '{"data":[9,97,37,192,0],"type":"Buffer"}' from endpoint 1 with groupID null Zigbee2MQTT:debug 2022-12-08 11:25:46: No converter available for 'TS0601_clamp_meter' with cluster 'manuSpecificTuya' and type 'raw' and data '{"data":[9,97,37,192,0],"type":"Buffer"}' 2022-12-08T10:25:46.993Z zigbee-herdsman:deconz:driver networkstate: 2 apsDataConfirm: 0 apsDataIndication: 0 configChanged: 0 apsRequestFreeSlots: 1 2022-12-08T10:25:47.183Z zigbee-herdsman:deconz:frameParser DEVICE_STATE changed: 10101010 2022-12-08T10:25:47.183Z zigbee-herdsman:deconz:driver networkstate: 2 apsDataConfirm: 0 apsDataIndication: 1 configChanged: 0 apsRequestFreeSlots: 1 2022-12-08T10:25:47.188Z zigbee-herdsman:deconz:driver query aps data indication 2022-12-08T10:25:47.192Z zigbee-herdsman:deconz:driver DATA_INDICATION - sending read data request - SeqNr. 61 2022-12-08T10:25:47.194Z zigbee-herdsman:deconz:frameParser DATA_INDICATION RESPONSE - seqNr. 61 srcAddr: 0xcccc destAddr: 0x0 profile id: 0x104 cluster id: 0xef00 lqi: 255 2022-12-08T10:25:47.194Z zigbee-herdsman:deconz:frameParser response payload: 9,97,37,192,0 2022-12-08T10:25:47.194Z zigbee-herdsman:deconz:adapter could not parse zclFrame: Error: Cluster 'manuSpecificTuya' has no command response '37' 2022-12-08T10:25:47.195Z zigbee-herdsman:controller:log Received 'raw' data '{"clusterID":61184,"data":{"type":"Buffer","data":[9,97,37,192,0]},"address":52428,"endpoint":1,"linkquality":255,"groupID":null,"wasBroadcast":false,"destinationEndpoint":1}' Zigbee2MQTT:debug 2022-12-08 11:25:47: Received Zigbee message from '0xf4b3b1fffec88e6c', type 'raw', cluster 'manuSpecificTuya', data '{"data":[9,97,37,192,0],"type":"Buffer"}' from endpoint 1 with groupID null Zigbee2MQTT:debug 2022-12-08 11:25:47: No converter available for 'TS0601_clamp_meter' with cluster 'manuSpecificTuya' and type 'raw' and data '{"data":[9,97,37,192,0],"type":"Buffer"}' 2022-12-08T10:25:47.204Z zigbee-herdsman:deconz:driver networkstate: 2 apsDataConfirm: 0 apsDataIndication: 0 configChanged: 0 apsRequestFreeSlots: 1 2022-12-08T10:25:47.385Z zigbee-herdsman:deconz:frameParser DEVICE_STATE changed: 10101010 2022-12-08T10:25:47.385Z zigbee-herdsman:deconz:driver networkstate: 2 apsDataConfirm: 0 apsDataIndication: 1 configChanged: 0 apsRequestFreeSlots: 1 2022-12-08T10:25:47.387Z zigbee-herdsman:deconz:driver query aps data indication 2022-12-08T10:25:47.392Z zigbee-herdsman:deconz:driver DATA_INDICATION - sending read data request - SeqNr. 62 2022-12-08T10:25:47.393Z zigbee-herdsman:deconz:frameParser DATA_INDICATION RESPONSE - seqNr. 62 srcAddr: 0xcccc destAddr: 0x0 profile id: 0x104 cluster id: 0xef00 lqi: 255 2022-12-08T10:25:47.394Z zigbee-herdsman:deconz:frameParser response payload: 9,97,37,192,0 2022-12-08T10:25:47.394Z zigbee-herdsman:deconz:adapter could not parse zclFrame: Error: Cluster 'manuSpecificTuya' has no command response '37' 2022-12-08T10:25:47.395Z zigbee-herdsman:controller:log Received 'raw' data '{"clusterID":61184,"data":{"type":"Buffer","data":[9,97,37,192,0]},"address":52428,"endpoint":1,"linkquality":255,"groupID":null,"wasBroadcast":false,"destinationEndpoint":1}' Zigbee2MQTT:debug 2022-12-08 11:25:47: Received Zigbee message from '0xf4b3b1fffec88e6c', type 'raw', cluster 'manuSpecificTuya', data '{"data":[9,97,37,192,0],"type":"Buffer"}' from endpoint 1 with groupID null Zigbee2MQTT:debug 2022-12-08 11:25:47: No converter available for 'TS0601_clamp_meter' with cluster 'manuSpecificTuya' and type 'raw' and data '{"data":[9,97,37,192,0],"type":"Buffer"}' 2022-12-08T10:25:47.396Z zigbee-herdsman:deconz:driver networkstate: 2 apsDataConfirm: 0 apsDataIndication: 0 configChanged: 0 apsRequestFreeSlots: 1

uowis commented 1 year ago

Pouvez-vous fournir un journal de débogage Herdsman lorsque vous recevez un message de cet appareil ?

Voir https://www.zigbee2mqtt.io/guide/usage/debug.html pour savoir comment activer la journalisation de débogage du bouvier. Notez que cela n'est enregistré que dans STDOUT et non dans les fichiers journaux.

STDOUT with herdsman debug on :

Debug 2022-12-08 11:54:54Received Zigbee message from '0xe0798dfffede3b6d', type 'raw', cluster 'manuSpecificTuya', data '{"data":[9,89,37,205,0],"type":"Buffer"}' from endpoint 1 with groupID null
Debug 2022-12-08 11:54:54No converter available for 'TS0601_clamp_meter' with cluster 'manuSpecificTuya' and type 'raw' and data '{"data":[9,89,37,205,0],"type":"Buffer"}'
Debug 2022-12-08 11:54:58Received Zigbee message from '0xe0798dfffede3b6d', type 'raw', cluster 'manuSpecificTuya', data '{"data":[9,90,37,207,0],"type":"Buffer"}' from endpoint 1 with groupID null
Debug 2022-12-08 11:54:58No converter available for 'TS0601_clamp_meter' with cluster 'manuSpecificTuya' and type 'raw' and data '{"data":[9,90,37,207,0],"type":"Buffer"}'
Debug 2022-12-08 11:54:58Received Zigbee message from '0xe0798dfffede3b6d', type 'raw', cluster 'manuSpecificTuya', data '{"data":[9,90,37,207,0],"type":"Buffer"}' from endpoint 1 with groupID null
Debug 2022-12-08 11:54:58No converter available for 'TS0601_clamp_meter' with cluster 'manuSpecificTuya' and type 'raw' and data '{"data":[9,90,37,207,0],"type":"Buffer"}'
uowis commented 1 year ago

I have recieve this message from Sophie :

This device requires it must connect with cloud.

The MCU polls the value periodically. Only when the value feedback is normal then can be considered the pairing successful, and this indicates whether the gateway is connected to the cloud

Only after the mcu confirms that the gateway is connected to the cloud, can it report the dp id normally. Otherwise, it is saved on the local device

#define CHECK_ZIGBEE_GATEWAY_STATUS_CMD 0x25

guillermohor commented 1 year ago

Can we send these parameter to the device from z2m? @Koenkk

uowis commented 1 year ago

i don"'t know,... perahps is it tz.datapoint ? I try to read this doc : https://developer.tuya.com/en/docs/iot/zigbee-door-lock-universal-docking-agreement?id=K9bjcnh616mg5 But it's 'foggy' for me

Koenkk commented 1 year ago

I see the CHECK_ZIGBEE_GATEWAY_STATUS_CMD 0x25 command in the log from @guillermohor

2022-12-08T10:25:47.194Z zigbee-herdsman:deconz:adapter could not parse zclFrame: Error: Cluster 'manuSpecificTuya' has no command response '37'

But we need to know what to send back, can somebody sniff the traffic when pairing this device with the original TuYa gateway?

https://www.zigbee2mqtt.io/advanced/zigbee/04_sniff_zigbee_traffic.html

uowis commented 1 year ago

i don't have tuya gateway, i ask it to Sophie.. I see this is why we have heartbeats vaule in the arraw : https://developer.tuya.com/en/docs/iot/advanced-features?id=Kav0qqgzfj95f#title-27-Commands https://developer.tuya.com/en/docs/iot/tuya-zigbee-module-uart-communication-protocol?id=K9ear5khsqoty#title-32-MCU%20requests%20gateway%20connection%20status%20(0x25)

guillermohor commented 1 year ago

i don't have tuya gateway, i ask it to Sophie.. I see this is why we have heartbeats vaule in the arraw : https://developer.tuya.com/en/docs/iot/advanced-features?id=Kav0qqgzfj95f#title-27-Commands https://developer.tuya.com/en/docs/iot/tuya-zigbee-module-uart-communication-protocol?id=K9ear5khsqoty#title-32-MCU%20requests%20gateway%20connection%20status%20(0x25)

Is it not enought information ? Do we still need to sniff traffic with the tuya gateway?

uowis commented 1 year ago

we need to know the sequence number ? a four digit number ? and calculate checksum ? how we can send it ? in the converter file ?

guillermohor commented 1 year ago

Let's wait to @Koenkk . Perhaps a function in the z2mqtt code could do it.

mrbluebrett commented 1 year ago

I see the CHECK_ZIGBEE_GATEWAY_STATUS_CMD 0x25 command in the log from @guillermohor

2022-12-08T10:25:47.194Z zigbee-herdsman:deconz:adapter could not parse zclFrame: Error: Cluster 'manuSpecificTuya' has no command response '37'

But we need to know what to send back, can somebody sniff the traffic when pairing this device with the original TuYa gateway?

https://www.zigbee2mqtt.io/advanced/zigbee/04_sniff_zigbee_traffic.html

This is the documentation in the link:

The module returns the following data.

Field Bytes Description
Header 2 0x55aa
Version 1 0x02
Sequence number 2 N
Command 1 0x025
Data length 2 0x0001
Data 1 0x00: The gateway is not connected to the internet.0x01: The gateway is connected to the internet.0x02: The request timed out after three seconds.
Checksum 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.

Example

55 aa 02 N 25 00 01 01 xx

It seems we need to send back a 0x01 with all the other packet data, right?

uowis commented 1 year ago

at first the zigbee module (device) send to gateway the request with the sequence number ? that right ? So can we saw it with zigbee2mqtt ?

uowis commented 1 year ago

me : "It's seems we need a sequence number that right ? a four digit number ?" sophie: "Actually, for MCU, it doesn't check this value right or not"

Somebody can tell us how send this return request ?

mrbluebrett commented 1 year ago

I think that even if the sequence number is not checked, we can copy it from the request. I don't know how to develop this though.

Koenkk commented 1 year ago

Thanks for the links, I've did an attempt to add the command and answer it accordingly.

Changes will be available in the dev branch in a few hours from now. (https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html)

kkossev commented 1 year ago

Here is a temporary link for downloading the PCAP file , paired to Tuya GW : https://drive.google.com/file/d/1GDxJrCZVoItQGcIvaBH2qqlSykkXlbcP/view?usp=sharing filter by zbee_nwk.addr eq 0xddf7 Hope this will help.

I've made it work in Hubitat, but this device is rather chatty .. :( The payload of the 0x25 command sent to the device should be 3 bytes - the first two bytes are the the four-digit numbers received from the previous device command 0x25, the third byte should be always 01

neooffline commented 1 year ago

It works, but values...

Снимок экрана 2022-12-09 в 20 26 39

May be current divideBy1000, voltage divideBy10, power divideBy10 And 101 seems to be energy

Снимок экрана 2022-12-09 в 20 51 50
guillermohor commented 1 year ago

Thanks to everyone!

mrbluebrett commented 1 year ago

Cool! Probably energy also needs to be divided by 10.

guillermohor commented 1 year ago

I had 100kwh in energy and after starting again 22. Can it go down?

guillermohor commented 1 year ago

Energy is dividedby1000. I think it reports delta values. Not the total amount of energy spend.

uowis commented 1 year ago

Same value for energy... State Can go down..

Koenkk commented 1 year ago

Updated https://gist.github.com/Koenkk/8fc146f998e2bd9986df783164f4f3df

lugiis commented 1 year ago

Hello, performing tests with two current clamps, I have seen that the TS0601 measures 2.5 and 3 amps more than the physical clamps. Can this be adjusted? Thank you very much everyone

guillermohor commented 1 year ago

Yes. There is a tab in ZigBee2mqtt for adjusting that. IMG_20221210_230318

mrbluebrett commented 1 year ago

One question: why is power defined as diagnostics in home assistant? Can it be changed to sensor? Diagnostic entities are not shown in default dashboard. No big issue but i want to know if it’s possible to change it.