Add native MQTT integration

This commit is contained in:
2026-05-05 12:56:38 +00:00
parent c052a5aec2
commit 97cba0a9a1
13 changed files with 1398 additions and 38 deletions
+17
View File
@@ -0,0 +1,17 @@
import { expect, tap } from '@git.zone/tstest/tapbundle';
import { createMqttDiscoveryDescriptor } from '../../ts/integrations/mqtt/index.js';
tap.test('matches Home Assistant MQTT discovery config topics', async () => {
const descriptor = createMqttDiscoveryDescriptor();
const matcher = descriptor.getMatchers()[1];
const result = await matcher.matches({
topic: 'homeassistant/sensor/kitchen/temperature/config',
payload: '{"name":"Kitchen temperature","state_topic":"kitchen/temperature"}',
}, {});
expect(result.matched).toBeTrue();
expect(result.candidate?.metadata?.component).toEqual('sensor');
expect(result.candidate?.metadata?.nodeId).toEqual('kitchen');
expect(result.normalizedDeviceId).toEqual('temperature');
});
export default tap.start();