Skip to content

Commit c1f13c2

Browse files
committed
Mark irrigation remove index as disabled config
1 parent 8d80942 commit c1f13c2

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

lib/extension/homeassistant.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ const NUMERIC_DISCOVERY_LOOKUP: {[s: string]: KeyValue} = {
185185
illuminance_calibration: {entity_category: "config", icon: "mdi:wrench-clock"},
186186
illuminance: {device_class: "illuminance", state_class: "measurement"},
187187
illuminance_raw: {state_class: "measurement"},
188+
irrigation_plan_remove_plan_index: {enabled_by_default: false, entity_category: "config", icon: "mdi:calendar-remove"},
188189
internalTemperature: {
189190
device_class: "temperature",
190191
entity_category: "diagnostic",

test/extensions/homeassistant.test.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,6 +1209,41 @@ describe("Extension: HomeAssistant", () => {
12091209
}
12101210
});
12111211

1212+
it("Should discover irrigation plan remove index as disabled config", () => {
1213+
const siren = getZ2MEntity(devices.HS2WD) as Device;
1214+
assert(siren.definition);
1215+
const originalExposes = siren.definition.exposes;
1216+
1217+
siren.definition.exposes = [
1218+
{
1219+
type: "numeric",
1220+
name: "irrigation_plan_remove_plan_index",
1221+
property: "irrigation_plan_remove_plan_index",
1222+
label: "Irrigation plan remove plan index",
1223+
access: 2,
1224+
category: "config",
1225+
value_min: 0,
1226+
value_max: 5,
1227+
},
1228+
] as zhc.Expose[];
1229+
1230+
try {
1231+
// @ts-expect-error private
1232+
const configs = extension.getConfigs(siren);
1233+
1234+
expect(configs.find((config) => config.object_id === "irrigation_plan_remove_plan_index")?.discovery_payload).toMatchObject({
1235+
command_topic: true,
1236+
enabled_by_default: false,
1237+
entity_category: "config",
1238+
icon: "mdi:calendar-remove",
1239+
min: 0,
1240+
max: 5,
1241+
});
1242+
} finally {
1243+
siren.definition.exposes = originalExposes;
1244+
}
1245+
});
1246+
12121247
it("Should discover Wi-Fi composite settings as disabled config entities", () => {
12131248
const siren = getZ2MEntity(devices.HS2WD) as Device;
12141249
assert(siren.definition);

0 commit comments

Comments
 (0)