Skip to content

Commit 37c3f6f

Browse files
committed
Improve compatibility with _TZ3000_zjchz7pd DIN rail switch
Signed-off-by: Ondrej Pecta <[email protected]>
1 parent b123439 commit 37c3f6f

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/devices/tuya.ts

+14-6
Original file line numberDiff line numberDiff line change
@@ -666,12 +666,16 @@ const fzLocal = {
666666
const data = msg.data.slice(3);
667667
if (command == 0xe6) {
668668
const value = splitToAttributes(data);
669-
return {
670-
temperature_threshold: value[0x05][1],
671-
temperature_breaker: lookup[value[0x05][0]],
672-
power_threshold: value[0x07][1],
673-
power_breaker: lookup[value[0x07][0]],
674-
};
669+
const result: KeyValue = {};
670+
if (0x05 in value) {
671+
result.temperature_threshold = value[0x05][1];
672+
result.temperature_breaker = lookup[value[0x05][0]];
673+
}
674+
if (0x07 in value) {
675+
result.power_threshold = value[0x07][1];
676+
result.power_breaker = lookup[value[0x07][0]];
677+
}
678+
return result;
675679
}
676680
if (command == 0xe7) {
677681
const value = splitToAttributes(data);
@@ -8373,6 +8377,10 @@ const definitions: DefinitionWithExtend[] = [
83738377
.withUnit('*C')
83748378
.withDescription('High temperature threshold'),
83758379
e.binary('temperature_breaker', ea.STATE_SET, 'ON', 'OFF').withDescription('High temperature breaker'),
8380+
);
8381+
}
8382+
if (device?.manufacturerName !== '_TZ3000_303avxxt') {
8383+
exposes.push(
83768384
e
83778385
.numeric('power_threshold', ea.STATE_SET)
83788386
.withValueMin(1)

0 commit comments

Comments
 (0)