mirror of
https://github.com/adrianjagielak/home-assistant-futurehome.git
synced 2025-09-13 07:37:09 +00:00
Add support for 'complex_alarm_system' service
This commit is contained in:
parent
ac435719a5
commit
cfe51c6e71
@ -10,6 +10,7 @@
|
||||
- Added support for 'user_code' service (keypads).
|
||||
- Added support for 'schedule_entry' service (for scheduling access).
|
||||
- Added support for 'doorman' service (Yale door locks).
|
||||
- Added support for 'complex_alarm_system' service (part of alarm sirens control).
|
||||
|
||||
## 0.1.5 (25.07.2025)
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -13,6 +13,7 @@ import { basic__components } from '../services/basic';
|
||||
import { battery__components } from '../services/battery';
|
||||
import { chargepoint__components } from '../services/chargepoint';
|
||||
import { color_ctrl__components } from '../services/color_ctrl';
|
||||
import { complex_alarm_system__components } from '../services/complex_alarm_system';
|
||||
import { door_lock__components } from '../services/door_lock';
|
||||
import { doorman__components } from '../services/doorman';
|
||||
import { fan_ctrl__components } from '../services/fan_ctrl';
|
||||
@ -153,6 +154,7 @@ const serviceHandlers: {
|
||||
battery: battery__components,
|
||||
chargepoint: chargepoint__components,
|
||||
color_ctrl: color_ctrl__components,
|
||||
complex_alarm_system: complex_alarm_system__components,
|
||||
door_lock: door_lock__components,
|
||||
doorman: doorman__components,
|
||||
fan_ctrl: fan_ctrl__components,
|
||||
|
51
futurehome/src/services/complex_alarm_system.ts
Normal file
51
futurehome/src/services/complex_alarm_system.ts
Normal file
@ -0,0 +1,51 @@
|
||||
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';
|
||||
|
||||
export function complex_alarm_system__components(
|
||||
topicPrefix: string,
|
||||
device: VinculumPd7Device,
|
||||
svc: VinculumPd7Service,
|
||||
svcName: string,
|
||||
): ServiceComponentsCreationResult | undefined {
|
||||
const components: Record<string, HaMqttComponent> = {};
|
||||
const commandHandlers: CommandHandlers = {};
|
||||
|
||||
if (svc.intf?.includes('cmd.alarm.silence')) {
|
||||
const silenceCommandTopic = `${topicPrefix}${svc.addr}/silence/command`;
|
||||
|
||||
components[`${svc.addr}_silence`] = {
|
||||
unique_id: `${svc.addr}_silence`,
|
||||
platform: 'button',
|
||||
name: 'Silence sirens without deactivating raised alarms',
|
||||
entity_category: 'config',
|
||||
icon: 'mdi:alarm-light-off',
|
||||
command_topic: silenceCommandTopic,
|
||||
};
|
||||
|
||||
commandHandlers[silenceCommandTopic] = async (_payload: string) => {
|
||||
await sendFimpMsg({
|
||||
address: svc.addr,
|
||||
service: svcName,
|
||||
cmd: 'cmd.alarm.silences',
|
||||
val_t: 'null',
|
||||
val: null,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
// Nothing useful to expose?
|
||||
if (!Object.keys(components).length) return undefined;
|
||||
|
||||
return {
|
||||
components,
|
||||
commandHandlers,
|
||||
};
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user