mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 09:31:20 -04:00
awaa
This commit is contained in:
@@ -4,13 +4,11 @@
|
||||
const io = require('../../globals/io');
|
||||
const { getMode, MODES, modeEvents } = require('../modeManager');
|
||||
const { isAdmin, isLockdownAdmin } = require('../roleService');
|
||||
const { turnEvents } = require('../turnService');
|
||||
|
||||
function registerHomeAssistantHooks(deps) {
|
||||
const {
|
||||
logger,
|
||||
haConfig,
|
||||
evaluateLightAutomation,
|
||||
isLightControlLocked,
|
||||
setLightsLockedOn,
|
||||
toggleEntity,
|
||||
@@ -19,26 +17,14 @@ function registerHomeAssistantHooks(deps) {
|
||||
setLightWhite,
|
||||
} = deps;
|
||||
|
||||
turnEvents.on('activeDriver', () => {
|
||||
evaluateLightAutomation();
|
||||
});
|
||||
|
||||
turnEvents.on('queue', () => {
|
||||
evaluateLightAutomation();
|
||||
});
|
||||
|
||||
modeEvents.on('change', (mode) => {
|
||||
if (mode === MODES.ADMIN || mode === MODES.LOCKDOWN) {
|
||||
if (isLightControlLocked()) {
|
||||
setLightsLockedOn(false, { source: 'modeGateReset' }).catch((err) => {
|
||||
logger.warn('Failed to disable lights lock on mode change', err.message);
|
||||
});
|
||||
} else {
|
||||
evaluateLightAutomation();
|
||||
}
|
||||
return;
|
||||
}
|
||||
evaluateLightAutomation();
|
||||
});
|
||||
|
||||
io.on('connection', (socket) => {
|
||||
|
||||
Reference in New Issue
Block a user