mirror of
https://github.com/adrianjagielak/home-assistant-futurehome.git
synced 2025-12-20 03:33:56 +00:00
Format the codebase using prettier
This commit is contained in:
@@ -8,13 +8,16 @@
|
||||
// <topicPrefix><addr>/scene/command → cmd.scene.set
|
||||
// ─────────────────────────────────────────────────────────────
|
||||
|
||||
import { sendFimpMsg } from "../fimp/fimp";
|
||||
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||
import { HaMqttComponent } from "../ha/mqtt_components/_component";
|
||||
import { sendFimpMsg } from '../fimp/fimp';
|
||||
import {
|
||||
VinculumPd7Device,
|
||||
VinculumPd7Service,
|
||||
} from '../fimp/vinculum_pd7_device';
|
||||
import { HaMqttComponent } from '../ha/mqtt_components/_component';
|
||||
import {
|
||||
CommandHandlers,
|
||||
ServiceComponentsCreationResult,
|
||||
} from "../ha/publish_device";
|
||||
} from '../ha/publish_device';
|
||||
|
||||
/**
|
||||
* Creates MQTT components for a single *scene_ctrl* service.
|
||||
@@ -22,33 +25,33 @@ import {
|
||||
export function scene_ctrl__components(
|
||||
topicPrefix: string,
|
||||
_device: VinculumPd7Device,
|
||||
svc: VinculumPd7Service
|
||||
svc: VinculumPd7Service,
|
||||
): ServiceComponentsCreationResult | undefined {
|
||||
const components: Record<string, HaMqttComponent> = {};
|
||||
const handlers: CommandHandlers = {};
|
||||
|
||||
// ───────────── read-only entities ─────────────
|
||||
if (svc.intf?.includes("evt.scene.report")) {
|
||||
if (svc.intf?.includes('evt.scene.report')) {
|
||||
components[`${svc.addr}_scene`] = {
|
||||
unique_id: `${svc.addr}_scene`,
|
||||
platform: 'sensor',
|
||||
unit_of_measurement: "",
|
||||
unit_of_measurement: '',
|
||||
value_template: `{{ value_json['${svc.addr}'].scene }}`,
|
||||
};
|
||||
}
|
||||
|
||||
if (svc.intf?.includes("evt.lvl.report")) {
|
||||
if (svc.intf?.includes('evt.lvl.report')) {
|
||||
components[`${svc.addr}_lvl`] = {
|
||||
unique_id: `${svc.addr}_lvl`,
|
||||
platform: 'sensor',
|
||||
unit_of_measurement: "",
|
||||
unit_of_measurement: '',
|
||||
value_template: `{{ value_json['${svc.addr}'].lvl }}`,
|
||||
};
|
||||
}
|
||||
|
||||
// ───────────── writeable “select” (scene activator) ─────────────
|
||||
const supScenes: string[] = svc.props?.sup_scenes ?? [];
|
||||
if (svc.intf?.includes("cmd.scene.set") && supScenes.length) {
|
||||
if (svc.intf?.includes('cmd.scene.set') && supScenes.length) {
|
||||
const commandTopic = `${topicPrefix}${svc.addr}/scene/command`;
|
||||
|
||||
components[`${svc.addr}_select`] = {
|
||||
@@ -65,9 +68,9 @@ export function scene_ctrl__components(
|
||||
|
||||
await sendFimpMsg({
|
||||
address: svc.addr!,
|
||||
service: "scene_ctrl",
|
||||
cmd: "cmd.scene.set",
|
||||
val_t: "string",
|
||||
service: 'scene_ctrl',
|
||||
cmd: 'cmd.scene.set',
|
||||
val_t: 'string',
|
||||
val: payload,
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user