zigbee2mqtt icon indicating copy to clipboard operation
zigbee2mqtt copied to clipboard

power plug ZigBee EU sparkle

Open snowmassi opened this issue 5 years ago • 41 comments

Received message from unsupported device with Zigbee model 'TS011F' and manufacturer name '_TZ3000_nfnmi125' Warning Please see: https://www.zigbee2mqtt.io/how_tos/how_to_support_new_devices.html. Warning Received message from unsupported device with Zigbee model 'TS011F' and manufacturer name '_TZ3000_nfnmi125' Warning Please see: https://www.zigbee2mqtt.io/how_tos/how_to_support_new_devices.html.

please support

0xa4c138c05e64c38f TS011F _TZ3000_nfnmi125 0x81E8

thanks

snowmassi avatar Nov 04 '21 10:11 snowmassi

I think its just a simple switch, here's a device definition that works for me.

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 definition = {
  fingerprint: [{modelID: 'TS011F', manufacturerName: '_TZ3000_nfnmi125'}],
  model: 'TS011F',
  vendor: 'Sparkleiot',
  description: '10A smart switch',
  fromZigbee: [fz.on_off],
  toZigbee: [tz.on_off],
  exposes: [exposes.presets.switch()],
};

module.exports = definition;

GimpArm avatar Nov 28 '21 19:11 GimpArm

Hello, sharing my config:

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 definition = {
    zigbeeModel: ['TS011F'],
    model: '_TZ3000_nfnmi125',
    vendor: 'Shenzhen Sparkle IoT',
    whiteLabel: [{vendor: 'Sparkle IoT', model: 'XH-002P'}],
    description: 'Zigbee Smart Plug',
    supports: 'on/off, power measurement',
    fromZigbee: [
        fz.ignore_basic_report,
        fz.on_off,
        fz.electrical_measurement,
        fz.metering,
        fz.tuya_switch_power_outage_memory,
    ],
    toZigbee: [
        tz.on_off,
        tz.tuya_switch_power_outage_memory,
    ],
    exposes: [
        e.switch(),
        e.power(),
        e.current(),
        e.voltage().withAccess(ea.STATE),
        e.energy(),
        exposes.enum('power_outage_memory', ea.STATE_SET, ['on', 'off', 'restore']).withDescription('Recover state after power outage'),
    ],
    configure: async (device, coordinatorEndpoint, logger) => {
        const endpoint = device.getEndpoint(1);
        await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff', 'haElectricalMeasurement']);
        endpoint.saveClusterAttributeKeyValue('seMetering', {divisor: 100, multiplier: 1});
        endpoint.saveClusterAttributeKeyValue('haElectricalMeasurement', {
            acVoltageMultiplier: 1, acVoltageDivisor: 1, acCurrentMultiplier: 1, acCurrentDivisor: 1000, acPowerMultiplier: 1,
            acPowerDivisor: 1,
        });
    },
};

module.exports = definition;

The problem is, that I can't get energy consumption values. I can't query anything energy-related from haElectricalMesurement cluster.

And I get an error in log:

debug 2021-11-28 20:49:10: Received Zigbee message from 'zSocket02', type 'raw', cluster '57344', data '{"data":[8,132,10,2,208,72,2,0,10],"type":"Buffer"}' from endpoint 1 with groupID 0
debug 2021-11-28 20:49:10: No converter available for '_TZ3000_nfnmi125' with cluster '57344' and type 'raw' and data '{"data":[8,132,10,2,208,72,2,0,10],"type":"Buffer"}'

Cluster 57344 in DEC is E000 in HEX. I wasn't able to find it in node_modules/zigbee-herdsman/dist/zcl/definition/cluster.js, so my guess is that its not supported yet.

Info from database.db:

{"id":2,"type":"Router","ieeeAddr":"0xa4c1384a8c57f201","nwkAddr":11932,"manufId":4417,"manufName":"_TZ3000_nfnmi125","powerSource":"Mains (single phase)","modelId":"TS011F","epList":[1,242],"endpoints":{"1":{"profId":260,"epId":1,"devId":266,"inClusterList":[3,4,5,6,57344,57345,0],"outClusterList":[25,10],"clusters":{"genOnOff":{"attributes":{"20480":1,"32768":0,"onOff":0,"onTime":0,"offWaitTime":0,"tuyaBacklightMode":1,"moesStartUpOnOff":2}},"manuSpecificTuya_3":{"attributes":{"53264":2,"switchType":0}},"genBasic":{"attributes":{"modelId":"TS011F","manufacturerName":"_TZ3000_nfnmi125","powerSource":1,"zclVersion":3,"appVersion":65,"stackVersion":0,"hwVersion":1,"dateCode":""}},"seMetering":{"attributes":{"divisor":100,"multiplier":1}},"haElectricalMeasurement":{"attributes":{"acVoltageMultiplier":1,"acVoltageDivisor":1,"acCurrentMultiplier":1,"acCurrentDivisor":1000,"acPowerMultiplier":1,"acPowerDivisor":1}}},"binds":[{"cluster":6,"type":"endpoint","deviceIeeeAddress":"0x00124b001ccca8b0","endpointID":1},{"cluster":2820,"type":"endpoint","deviceIeeeAddress":"0x00124b001ccca8b0","endpointID":1},{"cluster":1794,"type":"endpoint","deviceIeeeAddress":"0x00124b001ccca8b0","endpointID":1}],"configuredReportings":[],"meta":{}},"242":{"profId":41440,"epId":242,"devId":97,"inClusterList":[],"outClusterList":[33],"clusters":{},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":65,"stackVersion":0,"hwVersion":1,"dateCode":"","zclVersion":3,"interviewCompleted":true,"meta":{"configured":-917712964},"lastSeen":1638132747889}

Bought from aliexpress.

simie7 avatar Nov 28 '21 21:11 simie7

The only one that I can get working from your config is the power_outage_memory. I don't know what the z2m policy is about submitting devices with broken functionality. Do you remove what doesn't work currently or leave it until the core has the functionality implemented? That's why I only did on/off, so on/off + power_outage_memory are the only parts that currently work for me.

GimpArm avatar Nov 29 '21 18:11 GimpArm

I did full configuration from examples, expecting that it will work. But yes, you are right - only those things are currently working, so up to you which part of configuration to keep.

simie7 avatar Nov 29 '21 19:11 simie7

Hi thanks for what you did so far. I can only get the code working if i remove the line const extend = require('zigbee-herdsman-converters/lib/extend'); but i guess it makes no difference if the power management is not available anyway

bertkuh avatar Dec 01 '21 11:12 bertkuh

@simie7

The problem is, that I can't get energy consumption values. I can't query anything energy-related from haElectricalMesurement cluster.

What is logged in the debug log when:

  • pressing the yellow configure button in the frontend
  • refreshing the power value from the frontend

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

Koenkk avatar Dec 01 '21 16:12 Koenkk

Hi @Koenkk ,

pressing yellow Reconfigure, I am getting only those messages:

debug 2021-12-01 19:34:06: Received MQTT message on 'zigbee2mqtt/bridge/request/device/configure' with data '{"id":"zSocket01","transaction":"eys19-11"}'
info  2021-12-01 19:34:06: Configuring 'zSocket01'
info  2021-12-01 19:34:06: Successfully configured 'zSocket01'
info  2021-12-01 19:34:06: MQTT publish: topic 'zigbee2mqtt/bridge/response/device/configure', payload '{"data":{"id":"zSocket01"},"status":"ok","transaction":"eys19-11"}'

Refreshing values from frontend (Devices/device_id/Exposes):

debug 2021-12-01 19:35:29: Received MQTT message on 'zigbee2mqtt/zSocket01/get' with data '{"state":""}'
debug 2021-12-01 19:35:29: Publishing get 'get' 'state' to 'zSocket01'
info  2021-12-01 19:35:29: MQTT publish: topic 'zigbee2mqtt/zSocket01', payload '{"current":null,"energy":null,"last_seen":1638380129512,"linkquality":47,"power":null,"power_outage_memory":"restore","state":"OFF","voltage":null}'
debug 2021-12-01 19:35:29: Received Zigbee message from 'zSocket01', type 'readResponse', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
info  2021-12-01 19:35:29: MQTT publish: topic 'zigbee2mqtt/zSocket01', payload '{"current":null,"energy":null,"last_seen":1638380129512,"linkquality":44,"power":null,"power_outage_memory":"restore","state":"OFF","voltage":null}'

But sometimes I am getting those messages in log:

debug 2021-11-28 20:49:10: Received Zigbee message from 'zSocket02', type 'raw', cluster '57344', data '{"data":[8,132,10,2,208,72,2,0,10],"type":"Buffer"}' from endpoint 1 with groupID 0
debug 2021-11-28 20:49:10: No converter available for '_TZ3000_nfnmi125' with cluster '57344' and type 'raw' and data '{"data":[8,132,10,2,208,72,2,0,10],"type":"Buffer"}'

Some details above.

simie7 avatar Dec 01 '21 17:12 simie7

Refreshing values from frontend (Devices/device_id/Exposes):

I see you do a get on the state:

debug 2021-12-01 19:35:29: Received MQTT message on 'zigbee2mqtt/zSocket01/get' with data '{"state":""}'
debug 2021-12-01 19:35:29: Publishing get 'get' 'state' to 'zSocket01'

Can you do a get on the power?

Reading https://github.com/zigpy/zha-device-handlers/issues/910 I get the impression that this device does not support power measurements, are you sure it actually does? It might be worth checking this with an original TuYa gateway before starting to reverse engineer what the values in cluster 57344 mean

Koenkk avatar Dec 02 '21 07:12 Koenkk

Sorry for dumb question, but how to do it from GUI? Inside device menu I can't find a way of quering this data. I've got a state as there is refresh button under Exposes menu. I can't query from dev console, as values from haElectricalMeasurement fail:

debug 2021-12-02 12:32:34: Received MQTT message on 'zigbee2mqtt/zSocket01/1/set' with data '{"read":{"attributes":["rmsVoltage"],"cluster":"haElectricalMeasurement","options":{}}}'
debug 2021-12-02 12:32:34: Publishing 'set' 'read' to 'zSocket01'
error 2021-12-02 12:32:57: Publish 'set' 'read' to 'zSocket01' failed: 'Error: Read 0xa4c1388a487cc633/1 haElectricalMeasurement(["rmsVoltage"], {"sendWhenActive":false,"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Timeout - 3135 - 1 - 254 - 2820 - 1 after 10000ms)'
debug 2021-12-02 12:32:57: Error: Read 0xa4c1388a487cc633/1 haElectricalMeasurement(["rmsVoltage"], {"sendWhenActive":false,"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Timeout - 3135 - 1 - 254 - 2820 - 1 after 10000ms)
    at Timeout._onTimeout (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/src/utils/waitress.ts:64:35)
    at listOnTimeout (internal/timers.js:557:17)
    at processTimers (internal/timers.js:500:7)

IDK how to query otherwise? Regarding support of energy monitoring - seller says yes, best proof would be to pair with original Tuya gateway, but I don't have it at the moment.

simie7 avatar Dec 02 '21 10:12 simie7

Removed as external converter and added manufacturerName in tuya.js:

    {
        fingerprint: [{modelID: 'TS011F', manufacturerName: '_TZ3000_cphmq0q7', applicationVersion: 67},
            {modelID: 'TS011F', manufacturerName: '_TZ3000_ew3ldmgx'},
            {modelID: 'TS011F', manufacturerName: '_TZ3000_ps3dmato'},
            {modelID: 'TS011F', manufacturerName: '_TZ3000_mraovvmm'},
            {modelID: 'TS011F', manufacturerName: '_TZ3000_jvzvulen'},
            {modelID: 'TS011F', manufacturerName: '_TZ3000_nfnmi125'}],

        model: 'TS011F_plug_1',
        description: 'Smart plug (with power monitoring)',
        vendor: 'TuYa',
        whiteLabel: [{vendor: 'LELLKI', model: 'TS011F_plug'}],
        fromZigbee: [fz.on_off, fz.electrical_measurement, fz.metering, fz.ignore_basic_report, fz.tuya_switch_power_outage_memory],
        toZigbee: [tz.on_off, tz.tuya_switch_power_outage_memory],
        configure: async (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();
        },
        exposes: [e.switch(), e.power(), e.current(), e.voltage().withAccess(ea.STATE),
            e.energy(), exposes.enum('power_outage_memory', ea.STATE_SET, ['on', 'off', 'restore'])
                .withDescription('Recover state after power outage')],
    },

Got some logs trying to reconfigure:

debug 2021-12-03 00:21:25: Received MQTT message on 'zigbee2mqtt/bridge/request/device/configure' with data '{"id":"zSocket01","transaction":"9e9i1-7"}'
info  2021-12-03 00:21:25: Configuring 'zSocket01'
error 2021-12-03 00:21:48: Failed to configure 'zSocket01', attempt 2 (Error: ConfigureReporting 0xa4c1388a487cc633/1 haElectricalMeasurement([{"attribute":"rmsVoltage","minimumReportInterval":5,"maximumReportInterval":3600,"reportableChange":5}], {"sendWhenActive":false,"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Timeout - 3135 - 1 - 12 - 2820 - 7 after 10000ms)
    at Timeout._onTimeout (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/src/utils/waitress.ts:64:35)
    at listOnTimeout (internal/timers.js:557:17)
    at processTimers (internal/timers.js:500:7))
info  2021-12-03 00:21:48: MQTT publish: topic 'zigbee2mqtt/bridge/response/device/configure', payload '{"data":{"id":"zSocket01"},"error":"Failed to configure (ConfigureReporting 0xa4c1388a487cc633/1 haElectricalMeasurement([{\"attribute\":\"rmsVoltage\",\"minimumReportInterval\":5,\"maximumReportInterval\":3600,\"reportableChange\":5}], {\"sendWhenActive\":false,\"timeout\":10000,\"disableResponse\":false,\"disableRecovery\":false,\"disableDefaultResponse\":true,\"direction\":0,\"srcEndpoint\":null,\"reservedBits\":0,\"manufacturerCode\":null,\"transactionSequenceNumber\":null,\"writeUndiv\":false}) failed (Timeout - 3135 - 1 - 12 - 2820 - 7 after 10000ms))","status":"error","transaction":"9e9i1-7"}'

simie7 avatar Dec 02 '21 22:12 simie7

https://github.com/Koenkk/zigbee2mqtt/issues/9493#issuecomment-984503465 proofs it doesn't support reporting energy measurements in the same way as other TuYa plugs do. Getting more convinced this device does not support power measurements.

Koenkk avatar Dec 03 '21 18:12 Koenkk

I seem to have exactly the same case, but with even another "manufacture name)

` Received message from unsupported device with Zigbee model 'TS011F' and manufacturer name '_TZ3000_w0qqde0g'

Any straight forward way to get this addional name into support?

stefanschaedeli avatar Dec 08 '21 10:12 stefanschaedeli

@stefanschaedeli you can try to add your device id here or add custom converter like this, changing id to yours. You will now if it works only after trying.

simie7 avatar Dec 08 '21 11:12 simie7

@stefanschaedeli you can try to add your device id here or add custom converter like this, changing id to yours. You will now if it works only after trying.

Maybe a stupid question but I just don't fined the the way at the moment. How can I modify the tuya.js in the container hosted environment. This file seems to be part of the non persitant volume and I apply the change persistant...

stefanschaedeli avatar Dec 08 '21 16:12 stefanschaedeli

Hi, I have the same plug TS011F with manufacturer name: _TZ3000_ew3ldmgx. The pairing works flawlessly and the device shows up as supported. The switch works and the power_outage_memory works as well, but I cannot get the energy values with Z2M. I tried pairing with ZHA and I can get all the correct energy, power and voltage values so the plug can measure power as specified in the aliexpress seller description.

img

img2

filippopetri avatar Dec 10 '21 14:12 filippopetri

Hi I got them working just yesterday I went with the :latest-dev version and after i restartet everything AND reconnecting my zigbee stick it works. Remember to put power_outage_memory to off if you want to see values (it helped sometimes idk) and it talkes a while sometimes.

bertkuh avatar Dec 10 '21 17:12 bertkuh

@stefanschaedeli you can try to add your device id here or add custom converter like this, changing id to yours. You will now if it works only after trying.

Maybe a stupid question but I just don't fined the the way at the moment. How can I modify the tuya.js in the container hosted environment. This file seems to be part of the non persitant volume and I apply the change persistant...

Same problem here - running zigbee2mqtt in docker container. Restarting the container reverts the modifications to tuya.js.

My device is (labeled "Blitzwolf SHP15"):

0x84ba20fffe77b83e TS011F / _TZ3000_u5u4cakc

linuxrrze avatar Dec 14 '21 19:12 linuxrrze

Same problem here - running zigbee2mqtt in docker container. Restarting the container reverts the modifications to tuya.js.

My device is (labeled "Blitzwolf SHP15"):

0x84ba20fffe77b83e TS011F / _TZ3000_u5u4cakc

Same situation for me. Exact same manuafacturerName _TZ3000_u5u4cakc as you have. Power on-off works with the custom converter, but no measurements being reported: image

In ZHA, the same device works flawlessly: image

ShadNex avatar Dec 15 '21 16:12 ShadNex

I found out something: The measurements are being reported by zigbee2mqtt when manually querying the attributes via the dev console: image

They then also update in the device detail page: image

So my guess is that zigbee2mqtt simply doesn't periodically query the device about the measurements and so they're stuck at null values? Or is the device supposed to periodically report it to zigbee2mqtt?

This is the converter i used:

module.exports = [
{
    fingerprint: [{modelID: 'TS011F', manufacturerName: '_TZ3000_u5u4cakc'}],
    model: 'BW-SHP15',
    description: 'Smart plug (with power monitoring)',
    vendor: 'BlitzWolf',
    fromZigbee: [fz.on_off, fz.electrical_measurement, fz.metering, fz.ignore_basic_report, fz.tuya_switch_power_outage_memory],
    toZigbee: [tz.on_off, tz.tuya_switch_power_outage_memory],
    configure: async (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();
    },
    exposes: [e.switch(), e.power(), e.current(), e.voltage().withAccess(ea.STATE),
        e.energy(), exposes.enum('power_outage_memory', ea.STATE_SET, ['on', 'off', 'restore'])
            .withDescription('Recover state after power outage')],
}
];

ShadNex avatar Dec 16 '21 06:12 ShadNex

Can you check if power measurements work now in the latest-dev branch? If not please post your data/database.db entry of this device?

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)

Koenkk avatar Dec 16 '21 17:12 Koenkk