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
+50
View File
@@ -0,0 +1,50 @@
import { expect, tap } from '@git.zone/tstest/tapbundle';
import { HomeAssistantFritzIntegration, type IFritzCommand, type IFritzConfig } from '../../ts/integrations/fritz/index.js';
const config: IFritzConfig = {
host: '192.168.178.1',
snapshot: {
connected: true,
router: {
name: 'Home Fritz',
host: '192.168.178.1',
serialNumber: 'AABBCCDDEEFF',
actions: ['reboot'],
},
devices: [],
interfaces: [],
connection: {},
sensors: {},
wifiNetworks: [],
portForwards: [],
callDeflections: [],
},
};
tap.test('does not fake FRITZ TR-064 command success without injected executor', async () => {
const runtime = await new HomeAssistantFritzIntegration().setup(config, {});
const result = await runtime.callService!({ domain: 'fritz', service: 'reboot', target: {} });
expect(result.success).toBeFalse();
expect(result.error || '').toInclude('not faked');
await runtime.destroy();
});
tap.test('executes explicit FRITZ commands through injected executor', async () => {
let command: IFritzCommand | undefined;
const runtime = await new HomeAssistantFritzIntegration().setup({
...config,
commandExecutor: async (commandArg) => {
command = commandArg;
return { success: true, data: { accepted: true } };
},
}, {});
const result = await runtime.callService!({ domain: 'fritz', service: 'reboot', target: {} });
expect(result.success).toBeTrue();
expect(command?.type).toEqual('router.action');
expect(command?.action).toEqual('reboot');
await runtime.destroy();
});
export default tap.start();