Skip to content

Commit

Permalink
fix(ignore): Added descriptions and support 1-3 phase variants of ZJS…
Browse files Browse the repository at this point in the history
…BL7-100Z

Signed-off-by: Ondrej Pecta <opecta@gmail.com>
  • Loading branch information
octa22 committed Jun 7, 2023
1 parent d294d0a commit 4c5e93c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
27 changes: 15 additions & 12 deletions src/devices/tuya.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3868,19 +3868,22 @@ const definitions: Definition[] = [
fromZigbee: [legacy.fromZigbee.hoch_din],
toZigbee: [legacy.toZigbee.hoch_din],
exposes: [
e.text('meter_number', ea.STATE),
e.binary('state', ea.STATE_SET, 'ON', 'OFF'),
e.text('alarm', ea.STATE),
e.binary('trip', ea.STATE_SET, 'trip', 'clear'),
e.binary('child_lock', ea.STATE_SET, 'ON', 'OFF'),
e.enum('power_on_behavior', ea.STATE_SET, ['off', 'on', 'previous']),
e.numeric('countdown_timer', ea.STATE_SET).withValueMin(0).withValueMax(86400).withUnit('s'),
e.numeric('voltage_rms', ea.STATE).withUnit('V'),
e.numeric('current', ea.STATE).withUnit('A'),
e.numeric('current_average', ea.STATE).withUnit('A'),
e.text('meter_number', ea.STATE).withDescription('Meter number'),
e.binary('state', ea.STATE_SET, 'ON', 'OFF').withDescription('State'),
e.text('alarm', ea.STATE).withDescription('Alarm text'),
e.binary('trip', ea.STATE_SET, 'trip', 'clear').withDescription('Trip'),
e.binary('child_lock', ea.STATE_SET, 'ON', 'OFF').withDescription('Child lock'),
e.enum('power_on_behavior', ea.STATE_SET, ['off', 'on', 'previous']).withDescription('Power on behavior'),
e.numeric('countdown_timer', ea.STATE_SET).withValueMin(0).withValueMax(86400).withUnit('s').withDescription('Countdown timer'),
e.numeric('voltage_rms', ea.STATE).withUnit('V').withDescription('Voltage RMS'),
e.numeric('current', ea.STATE).withUnit('A').withDescription('Current'),
e.numeric('current_average', ea.STATE).withUnit('A').withDescription('Current average'),
e.power(), e.voltage(), e.energy(), e.temperature(),
e.numeric('energy_consumed', ea.STATE).withUnit('kWh'),
e.enum('clear_device_data', ea.SET, ['']),
e.numeric('power_1', ea.STATE).withUnit('W').withDescription('Instantaneous measured power on phase 1'),
e.numeric('power_2', ea.STATE).withUnit('W').withDescription('Instantaneous measured power on phase 2'),
e.numeric('power_3', ea.STATE).withUnit('W').withDescription('Instantaneous measured power on phase 3'),
e.numeric('energy_consumed', ea.STATE).withUnit('kWh').withDescription('Consumed energy'),
e.enum('clear_device_data', ea.SET, ['']).withDescription('Clear device data'),
],
},
{
Expand Down
9 changes: 9 additions & 0 deletions src/lib/legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4676,6 +4676,15 @@ const fromZigbee1 = {
}
if (dp === dataPoints.hochActivePower) {
result.power = (value[2] | value[1] << 8) / 10;
if (value.length > 3) {
result.power_1 = (value[5] | value[4] << 8) / 10;
}
if (value.length > 6) {
result.power_2 = (value[8] | value[7] << 8) / 10;
}
if (value.length > 9) {
result.power_3 = (value[11] | value[10] << 8) / 10;
}
}
if (dp === dataPoints.hochTotalActivePower) {
result.energy_consumed = value / 100;
Expand Down

0 comments on commit 4c5e93c

Please sign in to comment.