Skip to content

Commit 03e02e5

Browse files
expose action_transition_time
1 parent 441876f commit 03e02e5

6 files changed

Lines changed: 28 additions & 6 deletions

File tree

src/devices/iluminize.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,8 @@ export const definitions: DefinitionWithExtend[] = [
248248
"hue_stop",
249249
]),
250250
e.numeric("action_group", ea.STATE).withDescription("Shows the zigbee2mqtt group bound to the active data point EP(1-4)."),
251-
e.numeric("action_transition_time", ea.STATE),
252251
e.action_step_size(),
252+
e.action_transition_time(),
253253
e.action_rate(),
254254
],
255255
toZigbee: [],

src/devices/shelly.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2126,7 +2126,6 @@ export const definitions: DefinitionWithExtend[] = [
21262126
exposes: [
21272127
e.action(["on", "off", "brightness_step_up", "brightness_step_down"]),
21282128
e.numeric("action_group", ea.STATE).withDescription("Group ID associated with the action command."),
2129-
e.numeric("action_transition_time", ea.STATE).withDescription("Transition time in seconds for the action."),
21302129
],
21312130
extend: [
21322131
m.battery(),

src/devices/tuya.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13507,9 +13507,9 @@ export const definitions: DefinitionWithExtend[] = [
1350713507
"rotate_right",
1350813508
]),
1350913509
e.numeric("action_brightness_delta", ea.STATE).withValueMin(-255).withValueMax(255),
13510-
e.action_step_size(),
1351113510
e.numeric("action_color_temperature_delta", ea.STATE).withValueMin(-65535).withValueMax(65535),
13512-
e.numeric("action_transition_time", ea.STATE).withUnit("s"),
13511+
e.action_step_size(),
13512+
e.action_transition_time(),
1351313513
e.action_rate(),
1351413514
e.battery(),
1351513515
e

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ function processExtensions(definition: DefinitionWithExtend): Definition {
356356
}
357357

358358
// De-duplicate and sort action parameters
359-
const actionParamOrder = ["action_level", "action_step_size", "action_rate"];
359+
const actionParamOrder = ["action_level", "action_step_size", "action_transition_time", "action_rate"];
360360
const actionParamExposes = new Map<string, Expose>();
361361

362362
for (const e of allExposes) {

src/lib/exposes.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,14 @@ export const presets = {
989989
.withValueMax(255)
990990
.withValueStep(1)
991991
.withCategory("diagnostic"),
992+
action_transition_time: () =>
993+
new Numeric("action_transition_time", access.STATE)
994+
.withDescription("Transition parameter of level control commands")
995+
.withValueMin(0)
996+
.withValueMax(6553.5)
997+
.withValueStep(0.1)
998+
.withUnit("s")
999+
.withCategory("diagnostic"),
9921000
angle: (name: string) => new Numeric(name, access.STATE).withValueMin(-360).withValueMax(360).withUnit("°"),
9931001
angle_axis: (name: string) => new Numeric(name, access.STATE).withValueMin(-90).withValueMax(90).withUnit("°"),
9941002
aqi: () => new Numeric("aqi", access.STATE).withDescription("Air quality index"),

src/lib/modernExtend.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1365,7 +1365,7 @@ export interface CommandsLevelCtrl {
13651365
export function commandsLevelCtrl(args: CommandsLevelCtrl = {}): ModernExtend {
13661366
const {
13671367
commands = [
1368-
"brightness_move_to_level",
1368+
"brightness_move_to_level", // with on off "parameter" for all
13691369
"brightness_move_up",
13701370
"brightness_move_down",
13711371
"brightness_step_up",
@@ -1383,10 +1383,12 @@ export function commandsLevelCtrl(args: CommandsLevelCtrl = {}): ModernExtend {
13831383

13841384
if (commands.includes("brightness_move_to_level")) {
13851385
exposes.push(e.action_level());
1386+
exposes.push(e.action_transition_time());
13861387
}
13871388

13881389
if (commands.includes("brightness_step_up") || commands.includes("brightness_step_down")) {
13891390
exposes.push(e.action_step_size());
1391+
exposes.push(e.action_transition_time());
13901392
}
13911393

13921394
if (commands.includes("brightness_move_up") || commands.includes("brightness_move_down")) {
@@ -1449,6 +1451,7 @@ export function commandsColorCtrl(args: CommandsColorCtrl = {}): ModernExtend {
14491451
"move_to_saturation",
14501452
"move_to_hue",
14511453
"stop_move_step",
1454+
// TODO: "move_to_color", "move_to_color_temp", "color_step", more...
14521455
],
14531456
bind = true,
14541457
endpointNames = undefined,
@@ -1459,6 +1462,17 @@ export function commandsColorCtrl(args: CommandsColorCtrl = {}): ModernExtend {
14591462
}
14601463
const exposes: Expose[] = [e.action(actions)];
14611464

1465+
// TODO: e.action_hue, e.action_enhanced_hue, e.action_direction, e.action_saturation,
1466+
// e.action_color, e.action_stepx, e.action_stepy, e.action_colortemp, e.action_minimum, e.action_maximum etc.
1467+
if (
1468+
commands.includes("enhanced_move_to_hue_and_saturation") ||
1469+
commands.includes("move_to_hue_and_saturation") ||
1470+
commands.includes("move_to_saturation") ||
1471+
commands.includes("move_to_hue")
1472+
) {
1473+
exposes.push(e.action_transition_time());
1474+
}
1475+
14621476
if (
14631477
commands.includes("color_temperature_step_up") ||
14641478
commands.includes("color_temperature_step_down") ||
@@ -1468,6 +1482,7 @@ export function commandsColorCtrl(args: CommandsColorCtrl = {}): ModernExtend {
14681482
commands.includes("color_saturation_step_down")
14691483
) {
14701484
exposes.push(e.action_step_size());
1485+
exposes.push(e.action_transition_time());
14711486
}
14721487

14731488
if (

0 commit comments

Comments
 (0)