Skip to content

Commit 1ffc261

Browse files
committed
Move HA override option plumbing to separate PR
1 parent c1f13c2 commit 1ffc261

2 files changed

Lines changed: 1 addition & 16 deletions

File tree

lib/extension/homeassistant.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2029,10 +2029,7 @@ export class HomeAssistant extends Extension {
20292029

20302030
if (entity.isDevice()) {
20312031
try {
2032-
const overrideHaDiscoveryPayload = entity.definition?.meta?.overrideHaDiscoveryPayload as
2033-
| ((payload: KeyValue, options: KeyValue) => void)
2034-
| undefined;
2035-
overrideHaDiscoveryPayload?.(payload, entity.options);
2032+
entity.definition?.meta?.overrideHaDiscoveryPayload?.(payload);
20362033
} catch (error) {
20372034
logger.error(`Failed to override HA discovery payload (${(error as Error).stack})`);
20382035
}

test/extensions/homeassistant.test.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,18 +1553,6 @@ describe("Extension: HomeAssistant", () => {
15531553
overrideSpy.mockRestore();
15541554
});
15551555

1556-
it("passes device options to discovery payload overrides", async () => {
1557-
const bosch = getZ2MEntity(devices.BTH_RM230Z) as Device;
1558-
assert(typeof bosch.definition?.meta?.overrideHaDiscoveryPayload === "function");
1559-
const overrideSpy = vi.spyOn(bosch.definition.meta, "overrideHaDiscoveryPayload") as MockInstance;
1560-
settings.set(["devices", "0x18fc2600000d7ae3", "expose_cooling"], true);
1561-
1562-
await resetExtension();
1563-
1564-
expect(overrideSpy).toHaveBeenCalledWith(expect.any(Object), expect.objectContaining({expose_cooling: true}));
1565-
overrideSpy.mockRestore();
1566-
});
1567-
15681556
it("Should discover Bosch BTH-RM230Z with a current_humidity attribute", () => {
15691557
const payload = {
15701558
action_template:

0 commit comments

Comments
 (0)