Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tuya.ts #6116

Merged
merged 15 commits into from
Aug 30, 2023
52 changes: 51 additions & 1 deletion src/devices/tuya.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import fz from '../converters/fromZigbee';
import tz from '../converters/toZigbee';
import {KeyValue, Definition, Tz, Fz, Expose, KeyValueAny, KeyValueNumberString, KeyValueString} from '../lib/types';

const e = exposes.presets;
const ea = exposes.access;

Expand Down Expand Up @@ -5912,6 +5911,57 @@
],
},
},
{
fingerprint: tuya.fingerprint('TS0601', ['_TZE204_81yrt3lo']),
model: 'TS0601_Bidirectional_Energy_Meter_with_80A_Current_Clamp',
vendor: 'TuYa',
description: 'Bidirectional Energy Meter with 80A Current Clamp',
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
onEvent: tuya.onEventSetTime,
configure: tuya.configureMagicPacket,
whiteLabel: [
tuya.whitelabel('Tuya', 'PJ-1203A', 'Bidirectional Energy Meter with 80A Current Clamp', ['_TZE204_81yrt3lo']),
],
exposes: [ //only report data

Check failure on line 5926 in src/devices/tuya.ts

View workflow job for this annotation

GitHub Actions / ci

Expected space or tab after '//' in comment
e.ac_frequency(),
e.numeric('total_power_A', ea.STATE).withUnit('W').withDescription('Total power A'),
e.numeric('total_power_B', ea.STATE).withUnit('W').withDescription('Total power B'),
e.numeric('total_power_AB', ea.STATE).withUnit('W').withDescription('Total power A'),
e.numeric('voltage', ea.STATE).withUnit('V').withDescription('Voltage'),
e.numeric('current_A', ea.STATE).withUnit('A').withDescription('Current A'),
e.numeric('current_B', ea.STATE).withUnit('A').withDescription('Current B'),
e.numeric('power_factor_A', ea.STATE).withUnit('%').withDescription('Instantaneous measured power factor A'),
e.numeric('power_factor_B', ea.STATE).withUnit('%').withDescription('Instantaneous measured power factor B'),
e.numeric('power_direction A', ea.STATE).withDescription('Power direction A 0/1 for forward/reverse'),
e.numeric('power_direction B', ea.STATE).withDescription('Power direction B 0/1 for forward/reverse'),
e.numeric('energy_forward_A', ea.STATE).withUnit('kWh').withDescription('Total energy A forward'),
e.numeric('energy_forward_B', ea.STATE).withUnit('kWh').withDescription('Total energy B forward'),
e.numeric('energy_reverse_A', ea.STATE).withUnit('kWh').withDescription('Total energy A reverse'),
e.numeric('energy_reverse_B', ea.STATE).withUnit('kWh').withDescription('Total energy B reverse'),
e.numeric('update_frequency', ea.STATE).withUnit('sec').withDescription('Update frequency'),
],
meta: {
tuyaDatapoints: [

Check failure on line 5945 in src/devices/tuya.ts

View workflow job for this annotation

GitHub Actions / ci

Expected indentation of 12 spaces but found 16
[111, 'ac_frequency', tuya.valueConverter.divideBy100],

Check failure on line 5946 in src/devices/tuya.ts

View workflow job for this annotation

GitHub Actions / ci

Expected indentation of 16 spaces but found 18
[101, 'total_power_A', tuya.valueConverter.divideBy10],

Check failure on line 5947 in src/devices/tuya.ts

View workflow job for this annotation

GitHub Actions / ci

Expected indentation of 16 spaces but found 18
[105, 'total_power_B', tuya.valueConverter.divideBy10],

Check failure on line 5948 in src/devices/tuya.ts

View workflow job for this annotation

GitHub Actions / ci

Expected indentation of 16 spaces but found 18
[115, 'total_power_AB', tuya.valueConverter.divideBy10],

Check failure on line 5949 in src/devices/tuya.ts

View workflow job for this annotation

GitHub Actions / ci

Expected indentation of 16 spaces but found 18
[112, 'voltage', tuya.valueConverter.divideBy10],

Check failure on line 5950 in src/devices/tuya.ts

View workflow job for this annotation

GitHub Actions / ci

Expected indentation of 16 spaces but found 18
[113, 'current_A', tuya.valueConverter.divideBy1000],

Check failure on line 5951 in src/devices/tuya.ts

View workflow job for this annotation

GitHub Actions / ci

Expected indentation of 16 spaces but found 18
[114, 'current_B', tuya.valueConverter.divideBy1000],

Check failure on line 5952 in src/devices/tuya.ts

View workflow job for this annotation

GitHub Actions / ci

Expected indentation of 16 spaces but found 18
[110, 'power_factor_A', tuya.valueConverter.divideBy100],

Check failure on line 5953 in src/devices/tuya.ts

View workflow job for this annotation

GitHub Actions / ci

Expected indentation of 16 spaces but found 18
[121, 'power_factor_B', tuya.valueConverter.divideBy100],
[102, 'power_direction A', tuya.valueConverter.raw],
[104, 'power_direction B', tuya.valueConverter.raw],
[106, 'energy_forward_A', tuya.valueConverter.divideBy100],
[108, 'energy_forward_B', tuya.valueConverter.divideBy100],
[107, 'energy_reverse_A', tuya.valueConverter.divideBy100],
[109, 'energy_reverse_B', tuya.valueConverter.divideBy100],
[129, 'update_frequency', tuya.valueConverter.raw],
],
},
},
];

module.exports = definitions;