Skip to content

Commit

Permalink
fix: Fix no energy measurements for _TZ3000_qeuvnohg (will use poll…
Browse files Browse the repository at this point in the history
…ing now) (#5943)

* Add polling to 'din smart relay'

The din smart relay _TZ3000_qeuvnohg needs polling to get metering data.

* Fix last commit

* Update tuya.ts

---------

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
  • Loading branch information
clausmuus and Koenkk authored Jul 4, 2023
1 parent dcf2cde commit 3bf2799
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion src/devices/tuya.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3655,7 +3655,7 @@ const definitions: Definition[] = [
},
{
fingerprint: [{modelID: 'TS011F', manufacturerName: '_TZ3000_8bxrzyxz'},
{modelID: 'TS011F', manufacturerName: '_TZ3000_ky0fq4ho'}, {modelID: 'TS011F', manufacturerName: '_TZ3000_qeuvnohg'}],
{modelID: 'TS011F', manufacturerName: '_TZ3000_ky0fq4ho'}],
model: 'TS011F_din_smart_relay',
description: 'Din smart relay (with power monitoring)',
vendor: 'TuYa',
Expand All @@ -3681,6 +3681,35 @@ const definitions: Definition[] = [
e.enum('indicator_mode', ea.STATE_SET, ['off', 'on_off', 'off_on'])
.withDescription('Relay LED indicator mode')],
},
{
fingerprint: [{modelID: 'TS011F', manufacturerName: '_TZ3000_qeuvnohg'}],
model: 'TS011F_din_smart_relay_polling',
description: 'Din smart relay (with power monitoring via polling)',
vendor: 'TuYa',
fromZigbee: [fz.on_off, fz.electrical_measurement, fz.metering, fz.ignore_basic_report, tuya.fz.power_outage_memory,
fz.tuya_relay_din_led_indicator],
toZigbee: [tz.on_off, tuya.tz.power_on_behavior_1, tz.tuya_relay_din_led_indicator],
whiteLabel: [{vendor: 'MatSee Plus', model: 'ATMS1602Z'}, {vendor: 'Tongou', model: 'TO-Q-SY1-JZT'}],
ota: ota.zigbeeOTA,
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(),
e.energy(), e.enum('power_outage_memory', ea.ALL, ['on', 'off', 'restore'])
.withDescription('Recover state after power outage'),
e.enum('indicator_mode', ea.STATE_SET, ['off', 'on_off', 'off_on'])
.withDescription('Relay LED indicator mode')],
options: [exposes.options.measurement_poll_interval()],
onEvent: (type, data, device, options) => tuya.onEventMeasurementPoll(type, data, device, options, true, false),
},
{
fingerprint: [{modelID: 'TS011F', manufacturerName: '_TZ3000_7issjl2q'}],
model: 'ATMS1601Z',
Expand Down

0 comments on commit 3bf2799

Please sign in to comment.