Add native local infrastructure integrations

This commit is contained in:
2026-05-05 19:06:21 +00:00
parent cfab8c593e
commit a144ef687c
70 changed files with 11607 additions and 183 deletions
@@ -0,0 +1,46 @@
import { expect, tap } from '@git.zone/tstest/tapbundle';
import { HomeAssistantDevoloHomeNetworkIntegration, type IDevoloCommand, type IDevoloConfig } from '../../ts/integrations/devolo_home_network/index.js';
const config: IDevoloConfig = {
host: '192.168.1.20',
name: 'Office Adapter',
serialNumber: 'S12345',
features: ['led'],
switches: { leds: true },
};
tap.test('does not fake devolo command success without an injected executor', async () => {
const runtime = await new HomeAssistantDevoloHomeNetworkIntegration().setup(config, {});
const result = await runtime.callService!({
domain: 'switch',
service: 'turn_off',
target: { entityId: 'switch.office_adapter_enable_leds' },
});
expect(result.success).toBeFalse();
expect(result.error || '').toInclude('not faked');
await runtime.destroy();
});
tap.test('executes devolo commands through an injected executor', async () => {
let command: IDevoloCommand | undefined;
const runtime = await new HomeAssistantDevoloHomeNetworkIntegration().setup({
...config,
commandExecutor: async (commandArg) => {
command = commandArg;
return { success: true, data: { accepted: true } };
},
}, {});
const result = await runtime.callService!({
domain: 'switch',
service: 'turn_off',
target: { entityId: 'switch.office_adapter_enable_leds' },
});
expect(result.success).toBeTrue();
expect(command?.type).toEqual('device.set_leds');
expect(command?.enabled).toEqual(false);
await runtime.destroy();
});
export default tap.start();