Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/devices/sonoff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ interface SonoffTrvzb {
temporaryMode: number;
temporaryModeTime: number;
temporaryModeTemp: number;
smartTempControl: number;
};
commands: never;
commandResponses: never;
Expand Down Expand Up @@ -2388,6 +2389,7 @@ export const definitions: DefinitionWithExtend[] = [
write: true,
max: 0xff,
},
smartTempControl: {ID: 0x6017, type: Zcl.DataType.BITMAP8, write: true},
},
commands: {},
commandsResponse: {},
Expand Down Expand Up @@ -2579,6 +2581,23 @@ export const definitions: DefinitionWithExtend[] = [
}),
sonoffExtend.weeklySchedule(),
m.customTimeResponse("1970_UTC"),
m.enumLookup<"customSonoffTrvzb", SonoffTrvzb>({
name: "smart_temperature_control",
// manual sends 0x00 (same as off), 0x01 is report-only
lookup: {off: 0x00, manual: 0x00, smart: 0x02},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
lookup: {off: 0x00, manual: 0x00, smart: 0x02},
lookup: {off: 0x00, on: 0x02},

cluster: "customSonoffTrvzb",
attribute: "smartTempControl",
description:
"Manual mode: off or manual (same effect), Smart mode: automatic temperature control. " +
'After enabling the smart mode, "Valve Opening Percentage" and "Temperature Accuracy" will be automatically disabled.',
Comment on lines +2591 to +2592
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Manual mode: off or manual (same effect), Smart mode: automatic temperature control. " +
'After enabling the smart mode, "Valve Opening Percentage" and "Temperature Accuracy" will be automatically disabled.',
'Off: fully opens or closes the radiator valve based on a threshold temperature, ' +
'On: adjust valve opening based on a PID algorithm. ' +
'After enabling the smart mode, "Valve Opening Percentage" and "Temperature Accuracy" will be automatically disabled.',

access: "ALL",
fzConvert: (model, msg, publish, options, meta) => {
if ("smartTempControl" in msg.data) {
const valueToMode: Record<number, string> = {0: "off", 1: "manual", 2: "smart"};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const valueToMode: Record<number, string> = {0: "off", 1: "manual", 2: "smart"};
const valueToMode: Record<number, string> = {0: "off", 1: "off", 2: "on"};

return {smart_temperature_control: valueToMode[msg.data.smartTempControl] ?? "off"};
}
},
}),
],
ota: true,
configure: async (device, coordinatorEndpoint) => {
Expand Down