Koenkk / zigbee2mqtt

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

[New device support]: TS0001 / _TZ3000_46t1rvdu #15389

Closed HENN0 closed 1 year ago

HENN0 commented 1 year ago

Link

https://www.aliexpress.com/item/1005004891031379.html?

Database entry

{"id":12,"type":"Router","ieeeAddr":"0xa4c13832326e8f25","nwkAddr":19079,"manufId":4417,"manufName":"_TZ3000_46t1rvdu","powerSource":"Mains (single phase)","modelId":"TS0001","epList":[1,242],"endpoints":{"1":{"profId":260,"epId":1,"devId":256,"inClusterList":[3,4,5,6,1794,2820,57344,57345,0],"outClusterList":[25,10],"clusters":{"57344":{"attributes":{"53251":"AAAA"}},"genBasic":{"attributes":{"65503":"�5\u0000\u0000\u0012","65506":54,"65508":0,"65534":0,"modelId":"TS0001","manufacturerName":"_TZ3000_46t1rvdu","powerSource":1,"zclVersion":3,"appVersion":70,"stackVersion":0,"hwVersion":1,"dateCode":""}},"genOnOff":{"attributes":{"onOff":1,"onTime":0,"offWaitTime":0,"moesStartUpOnOff":1}},"manuSpecificTuya_3":{"attributes":{"53248":0,"53249":0,"53250":0,"53251":0,"53252":0,"53253":0,"switchType":0}},"haElectricalMeasurement":{"attributes":{"acCurrentDivisor":1000,"acCurrentMultiplier":1,"rmsCurrent":0,"rmsVoltage":0,"activePower":0}},"seMetering":{"attributes":{"divisor":100,"multiplier":1,"currentSummDelivered":[0,0]}}},"binds":[{"cluster":6,"type":"endpoint","deviceIeeeAddress":"0x00124b0026b87981","endpointID":1},{"cluster":2820,"type":"endpoint","deviceIeeeAddress":"0x00124b0026b87981","endpointID":1},{"cluster":1794,"type":"endpoint","deviceIeeeAddress":"0x00124b0026b87981","endpointID":1}],"configuredReportings":[{"cluster":6,"attrId":0,"minRepIntval":0,"maxRepIntval":3600,"repChange":0},{"cluster":2820,"attrId":1285,"minRepIntval":5,"maxRepIntval":3600,"repChange":5},{"cluster":2820,"attrId":1288,"minRepIntval":5,"maxRepIntval":3600,"repChange":50},{"cluster":2820,"attrId":1291,"minRepIntval":5,"maxRepIntval":3600,"repChange":10},{"cluster":1794,"attrId":0,"minRepIntval":5,"maxRepIntval":3600,"repChange":[1,1]}],"meta":{}},"242":{"profId":41440,"epId":242,"devId":97,"inClusterList":[],"outClusterList":[33],"clusters":{},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":70,"stackVersion":0,"hwVersion":1,"dateCode":"","zclVersion":3,"interviewCompleted":true,"meta":{"configured":1466202208},"lastSeen":1670132131879,"defaultSendRequestWhen":"immediate"}

Comments

Switching off/on works but no Power meter is shown. There is a resistor between Nin and Nout to measure the current.

image

External converter

No response

Supported color modes

No response

Color temperature range

No response

HENN0 commented 1 year ago

Anyone?

Koenkk commented 1 year ago

Could you check if the issue is fixed with the following 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 globalStore = require('zigbee-herdsman-converters/lib/store');
const e = exposes.presets;
const ea = exposes.access;

const definition = {
    fingerprint: tuya.fingerprint('TS0001', ['_TZ3000_xkap8wtb', '_TZ3000_qnejhcsu', '_TZ3000_x3ewpzyr', '_TZ3000_mkhkxx1p', '_TZ3000_46t1rvdu']),
    model: 'TS0001_power',
    description: 'Switch with power monitoring',
    vendor: 'TuYa',
    fromZigbee: [fz.on_off, fz.electrical_measurement, fz.metering, fz.ignore_basic_report,
        tuya.fz.power_outage_memory, tuya.fz.switch_type],
    toZigbee: [tz.on_off, tuya.tz.power_on_behavior, tuya.tz.switch_type],
    configure: async (device, coordinatorEndpoint, logger) => {
        await tuya.configureMagicPacket(device, coordinatorEndpoint, logger);
        const endpoint = device.getEndpoint(1);
        await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff', 'haElectricalMeasurement', 'seMetering']);
        await reporting.rmsVoltage(endpoint, {change: 5});
        await reporting.rmsCurrent(endpoint, {change: 50});
        await reporting.activePower(endpoint, {change: 10});
        await reporting.currentSummDelivered(endpoint);
        endpoint.saveClusterAttributeKeyValue('haElectricalMeasurement', {acCurrentDivisor: 1000, acCurrentMultiplier: 1});
        endpoint.saveClusterAttributeKeyValue('seMetering', {divisor: 100, multiplier: 1});
        device.save();
    },
    onEvent: tuya.onEventMeasurementPoll,
    exposes: [e.switch(), e.power(), e.current(), e.voltage().withAccess(ea.STATE), e.energy(), tuya.exposes.switchType(),
        exposes.enum('power_outage_memory', ea.ALL, ['on', 'off', 'restore']).withDescription('Recover state after power outage')],
};

module.exports = definition;
HENN0 commented 1 year ago

It shows power, voltage and current N/A Even after repair image image

Koenkk commented 1 year ago

Updated https://github.com/Koenkk/zigbee2mqtt/issues/15389#issuecomment-1341444033, can you check again?

HENN0 commented 1 year ago

now it did change to 0

image

I will try to repair it again...

HENN0 commented 1 year ago

Even after Re pair all values 0

Koenkk commented 1 year ago

Can you provide the debug log when starting z2m + 5 minutes?

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

HENN0 commented 1 year ago

Hi,

please find attached the requested logfile. I have now 3 of this devices paired

0xa4c138892e954919 0xa4c13893fcfecba3 0xa4c1383b0d3d5958

I did once switch 0xa4c13893fcfecba3 off and back on, maybe the information is helpful for you.

Big thanks for your support and the whole Project, If you ever need anything about VW MQB platform, feel free to contact me...

log.txt

Koenkk commented 1 year ago

It seems the 0 values are reported by the device itself:

debug 2022-12-08 16:55:25: Received Zigbee message from 'Garage', type 'attributeReport', cluster 'haElectricalMeasurement', data '{"rmsCurrent":0}' from endpoint 1 with groupID 0
info  2022-12-08 16:55:25: MQTT publish: topic 'zigbee2mqtt/Garage', payload '{"current":0,"device":{"applicationVersion":70,"dateCode":"","friendlyName":"Garage","hardwareVersion":1,"ieeeAddr":"0xa4c138892e954919","manufacturerID":4417,"manufacturerName":"_TZ3000_46t1rvdu","model":"TS0001_power","networkAddress":2821,"powerSource":"Mains (single phase)","stackVersion":0,"type":"Router","zclVersion":3},"energy":0,"last_seen":"2022-12-08T16:55:25+01:00","linkquality":72,"power":0,"power_on_behavior":"previous","power_outage_memory":"restore","state":"ON","switch_type":"toggle","voltage":0}'
debug 2022-12-08 16:55:25: Received Zigbee message from 'Garage', type 'attributeReport', cluster 'haElectricalMeasurement', data '{"activePower":0}' from endpoint 1 with groupID 0
info  2022-12-08 16:55:25: MQTT publish: topic 'zigbee2mqtt/Garage', payload '{"current":0,"device":{"applicationVersion":70,"dateCode":"","friendlyName":"Garage","hardwareVersion":1,"ieeeAddr":"0xa4c138892e954919","manufacturerID":4417,"manufacturerName":"_TZ3000_46t1rvdu","model":"TS0001_power","networkAddress":2821,"powerSource":"Mains (single phase)","stackVersion":0,"type":"Router","zclVersion":3},"energy":0,"last_seen":"2022-12-08T16:55:25+01:00","linkquality":72,"power":0,"power_on_behavior":"previous","power_outage_memory":"restore","state":"ON","switch_type":"toggle","voltage":0}'
debug 2022-12-08 16:55:26: Received Zigbee message from 'Garage', type 'attributeReport', cluster 'seMetering', data '{"currentSummDelivered":[0,0]}' from endpoint 1 with groupID 0

So either this device is broken or we need to retrieve it via a different API. The next step would be to check if energy measurements works when paired with the original TuYa gateway, if that is the case we can figure out the API by sniffing the traffic: https://www.zigbee2mqtt.io/advanced/zigbee/04_sniff_zigbee_traffic.html

HENN0 commented 1 year ago

Ok, i will order one Tuya gateway

HENN0 commented 1 year ago

I did try with Tuya gateway, also no measurements. I got 50% money back from seller and did order different swiches.

Thanks

tomav commented 1 year ago

Hi @HENN0, same problem here. Plugged it yesterday on a water heater (2000w). Had power data during 2 hours and then nothing. Power in the logs was always 0 since.

This morning, I tied the "reconfigure" button in the UI and the power came back instantly, which mean my device is not broken. I will monitor this.

brynderz commented 3 months ago

Hi @Koenkk I don't know if I am in the right place to ask this but here I go. I have this same devices around the house, I am now migrating everything from ZHA to Zigbee2MQTT and I have a problem. Half of them paired successfully, the other half I can't even detect them in zb2mqtt, but in ZHA they interview without a problem. And they are the exact same model. Any clue of what's happening here?