Skip to content

Instantly share code, notes, and snippets.

@Koenkk
Last active June 1, 2023 08:40
Show Gist options
  • Save Koenkk/34e60391471f8a6333176594dd80445d to your computer and use it in GitHub Desktop.
Save Koenkk/34e60391471f8a6333176594dd80445d to your computer and use it in GitHub Desktop.
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 utils = require('zigbee-herdsman-converters/lib/utils');
const ota = require('zigbee-herdsman-converters/lib/ota');
const tuya = require('zigbee-herdsman-converters/lib/tuya');
const e = exposes.presets;
const ea = exposes.access;
const definition = {
fingerprint: tuya.fingerprint('TS0601', ['_TZE200_lsanae15', '_TZE200_bkkmqmyo', '_TZE200_eaac7dkw']),
model: 'TS0601_din_1',
vendor: 'TuYa',
description: 'Zigbee DIN energy meter',
fromZigbee: [tuya.fzDataPoints],
toZigbee: [tuya.tzDataPoints],
configure: tuya.configureMagicPacket,
exposes: [tuya.exposes.switch(), e.ac_frequency(), e.energy(), e.power(), e.power_factor(), e.voltage(), e.current(),
exposes.numeric('produced_energy', exposes.access.STATE).withUnit('kWh').withDescription('Sum of produced energy'),],
meta: {
tuyaDatapoints: [
[1, 'energy', tuya.valueConverter.divideBy100],
[6, null, tuya.valueConverter.phaseA], // voltage and current
[16, 'state', tuya.valueConverter.onOff],
[103, 'power', tuya.valueConverter.raw],
[105, 'ac_frequency', tuya.valueConverter.divideBy100],
[111, 'power_factor', tuya.valueConverter.divideBy10],
// Ignored for now; we don't know what the values mean
[109, null, null], // reactive_power in VArh, ignored for now
[101, null, null], // total active power (translated from chinese) - same as energy dp 1??
[102, 'produced_energy', tuya.valueConverter.divideBy100],
[9, null, null], // Fault - we don't know the possible values here
[110, null, null], // total reactive power (translated from chinese) - value is 0.03kvar, we already have kvarh on dp 109
[17, null, null], // Alarm set1 - value seems garbage "AAAAAAAAAAAAAABkAAEOAACqAAAAAAAKAAAAAAAA"
[18, null, null], // 18 - Alarm set2 - value seems garbage "AAUAZAAFAB4APAAAAAAAAAA="
],
},
whiteLabel: [{vendor: 'Hiking', model: 'DDS238-2'}, {vendor: 'TuYa', model: 'RC-MCB'}],
};
module.exports = definition;
@Koenkk
Copy link
Author

Koenkk commented Oct 20, 2022

To be sure you are on the latest edge, uninstall and install the addon

@ArGinTTT
Copy link

Hello gentlemans,

Long time din't hear us. I hope you are doing fine.
I think I need your support again :| Apparently I buyed a second DDS238-2 zigbee, but apparently it's a different manufacture: TZE200_byzdayie, and again I can't see in zigbee2mqtt "produced energy" like in manufacture TZE200_bkkmqmyo. Can you give me some hints how to do it also for this device? It will be nice if I would get the same parameters for both of them, like in attached picture.

Thank you!

image

@ArGinTTT
Copy link

ArGinTTT commented Jun 1, 2023

Hi,
I also observed that in TZE200_byzdayie the power is not give negative values, like power from TZE200_bkkmqmyo. Ca you please support me?
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment