Allow microphone state to be used in conditions.
This commit is contained in:
@@ -4,6 +4,7 @@ import { copyConfig } from '../config-mgmt';
|
||||
import {
|
||||
FrigateCardCondition,
|
||||
frigateConditionalSchema,
|
||||
MicrophoneConditionState,
|
||||
OverrideConfigurationKey,
|
||||
RawFrigateCardConfig,
|
||||
ViewDisplayMode,
|
||||
@@ -20,6 +21,7 @@ interface ConditionState {
|
||||
displayMode?: ViewDisplayMode;
|
||||
triggered?: Set<string>;
|
||||
interaction?: boolean;
|
||||
microphone?: MicrophoneConditionState;
|
||||
}
|
||||
|
||||
export class ConditionEvaluateRequestEvent extends Event {
|
||||
@@ -254,6 +256,13 @@ export class ConditionsManager {
|
||||
result &&=
|
||||
state.interaction !== undefined && condition.interaction === state.interaction;
|
||||
}
|
||||
if (condition.microphone) {
|
||||
result &&=
|
||||
(condition.microphone.connected === undefined ||
|
||||
state.microphone?.connected === condition.microphone.connected) &&
|
||||
(condition.microphone.muted === undefined ||
|
||||
state.microphone?.muted === condition.microphone.muted);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user