Skip to content

Commit

Permalink
get initial state
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkeye217 committed May 16, 2024
1 parent bbd3c0c commit bb52479
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion web/src/api/ws.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,17 @@ function useValue(): useValueReturn {
const cameraStates: WsState = {};

Object.keys(config.cameras).forEach((camera) => {
const { name, record, detect, snapshots, audio } = config.cameras[camera];
const { name, record, detect, snapshots, audio, onvif } =
config.cameras[camera];
cameraStates[`${name}/recordings/state`] = record.enabled ? "ON" : "OFF";
cameraStates[`${name}/detect/state`] = detect.enabled ? "ON" : "OFF";
cameraStates[`${name}/snapshots/state`] = snapshots.enabled
? "ON"
: "OFF";
cameraStates[`${name}/audio/state`] = audio.enabled ? "ON" : "OFF";
cameraStates[`${name}/ptz_autotracker/state`] = onvif.autotracking.enabled
? "ON"
: "OFF";
});

setWsState({ ...wsState, ...cameraStates });
Expand Down

0 comments on commit bb52479

Please sign in to comment.