Skip to content

Commit

Permalink
fix: Improve compatibility with _TZ3000_zjchz7pd DIN rail switch (#7963)
Browse files Browse the repository at this point in the history
Signed-off-by: Ondrej Pecta <opecta@gmail.com>
  • Loading branch information
octa22 authored Sep 9, 2024
1 parent b123439 commit 8625590
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/devices/tuya.ts
Original file line number Diff line number Diff line change
Expand Up @@ -666,12 +666,16 @@ const fzLocal = {
const data = msg.data.slice(3);
if (command == 0xe6) {
const value = splitToAttributes(data);
return {
temperature_threshold: value[0x05][1],
temperature_breaker: lookup[value[0x05][0]],
power_threshold: value[0x07][1],
power_breaker: lookup[value[0x07][0]],
};
const result: KeyValue = {};
if (0x05 in value) {
result.temperature_threshold = value[0x05][1];
result.temperature_breaker = lookup[value[0x05][0]];
}
if (0x07 in value) {
result.power_threshold = value[0x07][1];
result.power_breaker = lookup[value[0x07][0]];
}
return result;
}
if (command == 0xe7) {
const value = splitToAttributes(data);
Expand Down Expand Up @@ -8373,6 +8377,10 @@ const definitions: DefinitionWithExtend[] = [
.withUnit('*C')
.withDescription('High temperature threshold'),
e.binary('temperature_breaker', ea.STATE_SET, 'ON', 'OFF').withDescription('High temperature breaker'),
);
}
if (device?.manufacturerName !== '_TZ3000_303avxxt') {
exposes.push(
e
.numeric('power_threshold', ea.STATE_SET)
.withValueMin(1)
Expand Down

0 comments on commit 8625590

Please sign in to comment.