mirror of
https://github.com/adrianjagielak/home-assistant-futurehome.git
synced 2026-02-11 07:15:38 +00:00
Add support for pairing new devices
This commit is contained in:
@@ -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 });
|
||||
|
||||
14
futurehome/src/fimp/vinculum.ts
Normal file
14
futurehome/src/fimp/vinculum.ts
Normal 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,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user