Add support for pairing new devices

This commit is contained in:
Adrian Jagielak
2025-07-28 14:18:42 +02:00
parent 15c65850bf
commit b034197a93
56 changed files with 1272 additions and 512 deletions

View File

@@ -21,7 +21,7 @@ export type FimpResponse = {
ver?: any;
};
type FimpValueType =
export type FimpValueType =
| 'string'
| 'int'
| 'float'
@@ -51,7 +51,7 @@ export async function sendFimpMsg({
cmd: string;
val: unknown;
val_t: FimpValueType;
props?: any;
props?: Record<string, any>;
timeoutMs?: number;
}): Promise<FimpResponse> {
const uid = uuidv4();
@@ -60,9 +60,9 @@ export async function sendFimpMsg({
corid: null,
ctime: new Date().toISOString(),
props: props,
resp_to: 'pt:j1/mt:rsp/rt:app/rn:ha-futurehome/ad:addon',
resp_to: 'pt:j1/mt:rsp/rt:cloud/rn:remote-client/ad:smarthome-app',
serv: service,
src: 'ha-futurehome',
src: 'smarthome-app',
tags: [],
type: cmd,
uid: uid,
@@ -165,7 +165,7 @@ service: "${service}",
uid: "${uid}",
cmd: "${cmd}",
val: ${JSON.stringify(val)},
val_t: "${val_t}"
val_t: "${val_t}"${Object.entries(props).length > 0 ? `\nprops: ${JSON.stringify(props)}` : ''}${timeoutMs != 10000 ? `\ntimeoutMs: ${timeoutMs}` : ''}
`);
fimp?.publish(topic, message, { qos: 1 });

View File

@@ -0,0 +1,14 @@
import { FimpResponse, sendFimpMsg } from './fimp';
export async function pollVinculum(
component: 'device' | 'house' | 'state',
): Promise<FimpResponse> {
return await sendFimpMsg({
address: '/rt:app/rn:vinculum/ad:1',
service: 'vinculum',
cmd: 'cmd.pd7.request',
val: { cmd: 'get', component: null, param: { components: [component] } },
val_t: 'object',
timeoutMs: 30000,
});
}