TuYa TS011F_plug_1 Zigbee2mqtt power measure problem

Hello all!
I am using zigbee2mqtt via sonoff usb dongle key.
I have successfully installed zigbee smart plug with electricity meter.
On/Off work normaly, voltage show, current show after 7-8s after connecting the consumer,
but power show sometimes after 20s, sometimes after 30s…
When unplug conumer, current go to 0 after 3-4 s, power is still there 20 -30 40s - useless

I try pair this plug with zigbee gateway, work normal, at the same time current, power is displayed

I buy zigbee plug because I expected a faster response to current, power, but it’s even worse than a regular wifi socket…
Where could the problem be?

Thankyou for your help!

Hi, have you solved your issue?

I have the same plug TS011F_plug_1 connected through zigbee2mqtt and recently it began freezing on the last non-zero power value, respectively when a dishwasher finishes, last report is about 70W then it switches off but the power remains 70W, while the energy sensor does not count any other energy consumption.

This will be fixed in the next Zigbee2MQTT release.

What have you done? It has solved the issue? I have experiencing exactly the same

I have TS011f Plugs with this problem. currently only 2 are affected.
all of them are updated to firmware 192

Plug firmware doesn’t matter. The only thing that matters is which version of Z2M you’re running.

Mine have stopped reporting 0 since I updated Z2M 2 years ago

this is the behaviour with me. up to a certain value the value is read out. after that z2m ignores it. you can see it on this plateau on the top of the graph

zigbee2mqtt version: 2.1.3-1

Ah, apologies - thought you were referring to the power reporting as 0 issue.

I’ve never seen that plateauing behaviour on mine. Are you sure it’s Z2M ignoring it, and not HA graphs displaying it incorrectly? There were some recent changes to the graphs in HA, so the only way to confirm the issue is to check Z2M dashboard when this happens and see what reading your plugs show.

I searched for freezing measurement in conjunction with this plugs and z2m, so I only found this thread.
No it is z2m related as you can see here, I can “create” the jumps by reading the values of a affected plug via DEV-console in z2m… choosing endpoint 1, cluster haElectricalMeasurement and attribute activePower and then READ.

you can see ALL theese jumps in this graph was me with the dev-console as this device was freezing/stuck at 6W

But I can say that I have this behaviour since 2-3days and “currently” I am in the migration parts of my zha-zigbee network to z2m because of issues I got there.
So I could imagine that there is a faulty zigbee-device but I could not identify it yet.
I disconnected all devices which I think I migrated in the last 3 days but the issue is still in there

I already searched for triggering this function via servicecall/automation but I would need a hint how to find the corresponding numbers of “haElectricalMeasurement” and attribute “activePower”

yesterday I found a mqtt.publish yaml code which I could not get to work because I think I had to use numbers instead of the names:

and “currently” I only found the Power/activePower is affected.
the Energy (kWh) readings are fine.

so this is also visible in the z2m statuspage of the devices…
{
“child_lock”: “UNLOCK”,
“countdown”: 0,
“current”: 0.32,
“energy”: 1297.83,
“indicator_mode”: “off/on”,
“linkquality”: 176,
“power”: 61,
“power_outage_memory”: “restore”,
“state”: “ON”,
“update”: {
“installed_version”: 192,
“latest_version”: 192,
“state”: “idle”
},
“voltage”: 227
}

You can set those up in the reporting tab of your device.

About to head out so can’t send you a screenshot of mine. Will try to remember to post it later tonight if you haven’t solved the issue by then

but these are already the standardsettings. I understand I could change on the reporting tab the interval of reporting exactly this measurement which is somehow “freezing” - from my understanding this will not change anything

I’m sorry, I don’t know what else to tell you. It’s been 2 years since I had to mess around with this plug, so I don’t remember if I had to change anything else. I also haven’t yet updated Z2M to v2, so it’s entirely possible this is a bug which was introduced recently.

All I can say is that mine is recognised as _TZ3000_typdpbpg and is the UK version. Maybe check if your model is actually listed in the tuya folder for the converters in Z2M github?

These are my reporting intervals. Further below is the initial converter I had used to help Koenkk debug the 0 reporting values. You will need to add/replace with your model in rows 22 & 49. Note that this converter is from 2023 and that requirements for custom converters have changed since then.
Try playing around wiht that - hopefully that will help you fix the issue.

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 fzLocal = {
    TS011F_electrical_measurement: {
        ...fz.electrical_measurement,
        convert: (model, msg, publish, options, meta) => {
            const result = fz.electrical_measurement.convert(model, msg, publish, options, meta);
            const lookup = {power: 'activePower', current: 'rmsCurrent', voltage: 'rmsVoltage'};

            // Wait 5 seconds before reporting a 0 value as this could be an invalid measurement.
            // https://github.com/Koenkk/zigbee2mqtt/issues/16709#issuecomment-1509599046
            if (result && ['_TZ3000_gvn91tmx', '_TZ3000_amdymr7l', '_TZ3000_typdpbpg', '_TZ3000_hdopuwv6'].includes(meta.device.manufacturerName)) {
                for (const key of ['power', 'current', 'voltage']) {
                    if (key in result) {
                        const value = result[key];
                        clearTimeout(globalStore.getValue(msg.endpoint, key));
                        if (value === 0) {
                            const configuredReporting = msg.endpoint.configuredReportings.find((c) => 
                                c.cluster.name === 'haElectricalMeasurement' && c.attribute.name === lookup[key]);
                            const time = ((configuredReporting ? configuredReporting.minimumReportInterval : 5) * 2) + 1;
                            console.log('NEXT 0 publish time', time);
                            globalStore.putValue(msg.endpoint, key, setTimeout(() => publish({[key]: value}), time * 1000));
                            delete result[key];
                        }
                    }
                }
            }
            return result; 
        },
    },
}

const definition = {
    // Note: below you will find the TS011F_plug_2 and TS011F_plug_3. These are identified via a fingerprint and
    // thus preferred above the TS011F_plug_1 if the fingerprint matches
	    fingerprint: [
        {
            modelID: 'TS011F',
            manufacturerName: '_TZ3000_typdpbpg',
        },
    ],
    zigbeeModel: ['TS011F'],
    model: 'TS011F_plug_1',
    description: 'Smart plug (with power monitoringj)',
    vendor: 'TuYa',
    whiteLabel: [{vendor: 'LELLKI', model: 'TS011F_plug'}, {vendor: 'NEO', model: 'NAS-WR01B'},
        {vendor: 'BlitzWolf', model: 'BW-SHP15'}, {vendor: 'Nous', model: 'A1Z'}, {vendor: 'BlitzWolf', model: 'BW-SHP13'},
        {vendor: 'MatSee Plus', model: 'PJ-ZSW01'}, {vendor: 'MODEMIX', model: 'MOD037'}, {vendor: 'MODEMIX', model: 'MOD048'},
        {vendor: 'Coswall', model: 'CS-AJ-DE2U-ZG-11'}, {vendor: 'Aubess', model: 'TS011F_plug_1'}, {vendor: 'Immax', model: '07752L'},
        tuya.whitelabel('NOUS', 'A1Z', 'Smart plug (with power monitoring)', ['_TZ3000_2putqrmw']),
    ],
    ota: ota.zigbeeOTA,
    extend: tuya.extend.switch({
        electricalMeasurements: true, electricalMeasurementsFzConverter: fzLocal.TS011F_electrical_measurement,
        powerOutageMemory: true, indicatorMode: true, childLock: true}),
    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: 5});
        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();
    },
};

module.exports = definition;

Dear ShadowFist,
the report is working. or the report is working great again after I applied it again.

so I do not know currently if was disabled or not. but for the plugs which had the freezing I had yesterday and today no freezes anymore after I clicked the apply button. so this is a possible solution for people haveing plugs which have freezing values

thanks a lot