Skip to content

Commit b79a718

Browse files
expose action_group
1 parent 03e02e5 commit b79a718

8 files changed

Lines changed: 18 additions & 17 deletions

File tree

src/devices/eglo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ export const definitions: DefinitionWithExtend[] = [
269269
"recall_2",
270270
"recall_2_long",
271271
]),
272-
e.numeric("action_group", ea.STATE),
272+
e.action_group(),
273273
e.action_level(),
274274
e.numeric("action_color_temperature", ea.STATE),
275275
],

src/devices/iluminize.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import * as sunricher from "../lib/sunricher";
66
import type {DefinitionWithExtend} from "../lib/types";
77

88
const e = exposes.presets;
9-
const ea = exposes.access;
109

1110
export const definitions: DefinitionWithExtend[] = [
1211
{
@@ -247,7 +246,7 @@ export const definitions: DefinitionWithExtend[] = [
247246
"enhanced_move_to_hue_and_saturation",
248247
"hue_stop",
249248
]),
250-
e.numeric("action_group", ea.STATE).withDescription("Shows the zigbee2mqtt group bound to the active data point EP(1-4)."),
249+
e.action_group(),
251250
e.action_step_size(),
252251
e.action_transition_time(),
253252
e.action_rate(),

src/devices/ls.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const fzLocal = {
3434
const lsModernExtend = {
3535
groupIdExpose(): ModernExtend {
3636
const result: ModernExtend = {
37-
exposes: [e.numeric("action_group", ea.STATE).withDescription("Group where the action was triggered on")],
37+
exposes: [e.action_group()],
3838
isModernExtend: true,
3939
};
4040

src/devices/shelly.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2123,10 +2123,6 @@ export const definitions: DefinitionWithExtend[] = [
21232123
model: "SBRC-005B-B",
21242124
vendor: "Shelly",
21252125
description: "BLU Remote Control ZB",
2126-
exposes: [
2127-
e.action(["on", "off", "brightness_step_up", "brightness_step_down"]),
2128-
e.numeric("action_group", ea.STATE).withDescription("Group ID associated with the action command."),
2129-
],
21302126
extend: [
21312127
m.battery(),
21322128
m.commandsOnOff({commands: ["on", "off"]}),

src/devices/tuya.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23882,7 +23882,7 @@ export const definitions: DefinitionWithExtend[] = [
2388223882
.withValueMax(4)
2388323883
.withCategory("diagnostic")
2388423884
.withDescription("Button number from last action"),
23885-
e.numeric("action_group", ea.STATE).withCategory("diagnostic").withDescription("Group ID from last action"),
23885+
e.action_group(),
2388623886
e.enum("bind_all_scene", ea.SET, ["bind"]).withCategory("config").withDescription("Bind all buttons to Scene mode (red LED)"),
2388723887
e.enum("bind_all_light", ea.SET, ["bind"]).withCategory("config").withDescription("Bind all buttons to Light mode (green LED)"),
2388823888
e.enum("bind_all_curtain", ea.SET, ["bind"]).withCategory("config").withDescription("Bind all buttons to Curtain mode (blue LED)"),

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_transition_time", "action_rate"];
359+
const actionParamOrder = ["action_group", "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: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,13 @@ export const presets = {
967967
new Enum("action", access.STATE, values).withDescription("Triggered action (e.g. a button click)").withCategory("diagnostic"),
968968
action_duration: () =>
969969
new Numeric("action_duration", access.STATE).withUnit("s").withDescription("Triggered action duration in seconds").withCategory("diagnostic"),
970-
action_group: () => new Numeric("action_group", access.STATE).withDescription("Group where the action was triggered on"),
970+
action_group: () =>
971+
new Numeric("action_group", access.STATE)
972+
.withDescription("Target group of the action")
973+
.withValueMin(0)
974+
.withValueMax(65535)
975+
.withValueStep(1)
976+
.withCategory("diagnostic"),
971977
action_level: () =>
972978
new Numeric("action_level", access.STATE)
973979
.withDescription("Target brightness of Move to level command")

src/lib/modernExtend.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ export function commandsOnOff(args: CommandsOnOffArgs = {}): ModernExtend {
654654
if (endpointNames) {
655655
actions = commands.flatMap((c) => endpointNames.map((e) => `${c}_${e}`));
656656
}
657-
const exposes: Expose[] = [e.action(actions)];
657+
const exposes: Expose[] = [e.action(actions), e.action_group()];
658658

659659
const actionPayloadLookup: KeyValueString = {
660660
commandOn: "on",
@@ -1379,7 +1379,7 @@ export function commandsLevelCtrl(args: CommandsLevelCtrl = {}): ModernExtend {
13791379
if (endpointNames) {
13801380
actions = commands.flatMap((c) => endpointNames.map((e) => `${c}_${e}`));
13811381
}
1382-
const exposes: Expose[] = [e.action(actions)];
1382+
const exposes: Expose[] = [e.action(actions), e.action_group()];
13831383

13841384
if (commands.includes("brightness_move_to_level")) {
13851385
exposes.push(e.action_level());
@@ -1460,7 +1460,7 @@ export function commandsColorCtrl(args: CommandsColorCtrl = {}): ModernExtend {
14601460
if (endpointNames) {
14611461
actions = commands.flatMap((c) => endpointNames.map((e) => `${c}_${e}`));
14621462
}
1463-
const exposes: Expose[] = [e.action(actions)];
1463+
const exposes: Expose[] = [e.action(actions), e.action_group()];
14641464

14651465
// TODO: e.action_hue, e.action_enhanced_hue, e.action_direction, e.action_saturation,
14661466
// e.action_color, e.action_stepx, e.action_stepy, e.action_colortemp, e.action_minimum, e.action_maximum etc.
@@ -1673,7 +1673,7 @@ export function commandsWindowCovering(args: CommandsWindowCoveringArgs = {}): M
16731673
if (endpointNames) {
16741674
actions = commands.flatMap((c) => endpointNames.map((e) => `${c}_${e}`));
16751675
}
1676-
const exposes: Expose[] = [e.action(actions)];
1676+
const exposes: Expose[] = [e.action(actions), e.action_group()];
16771677

16781678
const actionPayloadLookup: KeyValueString = {
16791679
commandUpOpen: "open",
@@ -2614,7 +2614,7 @@ export function commandsScenes(args: CommandsScenesArgs = {}) {
26142614
if (endpointNames) {
26152615
actions = commands.flatMap((c) => endpointNames.map((e) => `${c}_${e}`));
26162616
}
2617-
const exposesArray = [e.action(actions)];
2617+
const exposesArray = [e.action(actions), e.action_group()];
26182618

26192619
const actionPayloadLookup: {[key: string]: string} = {
26202620
commandRecall: "recall",
@@ -3103,7 +3103,7 @@ export function actionEnumLookup<
31033103
} satisfies Fz.Converter<Cl, Custom, Cos extends undefined ? ["attributeReport", "readResponse"] : Cos>,
31043104
];
31053105

3106-
return {exposes: [expose], fromZigbee, isModernExtend: true};
3106+
return {exposes: [expose, e.action_group()], fromZigbee, isModernExtend: true};
31073107
}
31083108

31093109
export interface QuirkAddEndpointClusterArgs {

0 commit comments

Comments
 (0)