mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 01:21:20 -04:00
fixes, changes, no more periodic sync. since theres enough activity at this point...
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -11,8 +11,8 @@
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||
<meta name="apple-mobile-web-app-title" content="Multi Roomba Rover" />
|
||||
<title>Multi Roomba Rover</title>
|
||||
<script type="module" crossorigin src="/assets/index-w3F8-NIp.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-CuroqLuU.css">
|
||||
<script type="module" crossorigin src="/assets/index-DBuBh8sB.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-CQrwYoqn.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
||||
@@ -34,7 +34,7 @@ function createReplayCommand({ getMode, MODES, tryTriggerReplay, getReplaySource
|
||||
const roverName = record?.meta?.name || source?.label || roverId;
|
||||
lines.push(`${nickname} → ${roverName}`);
|
||||
});
|
||||
if (!lines.length) return '';
|
||||
if (!lines.length) return 'Drivers: none active for selected rover sources';
|
||||
return `Drivers: ${lines.join(' | ')}`;
|
||||
}
|
||||
function resolveReplaySources(query) {
|
||||
|
||||
@@ -56,7 +56,7 @@ function createBusEventHandler(deps) {
|
||||
const roverName = record?.meta?.name || source?.label || roverId;
|
||||
lines.push(`${nickname} → ${roverName}`);
|
||||
});
|
||||
if (!lines.length) return '';
|
||||
if (!lines.length) return 'Drivers: none active for selected rover sources';
|
||||
return `Drivers: ${lines.join(' | ')}`;
|
||||
}
|
||||
|
||||
|
||||
@@ -93,16 +93,27 @@ function createDmModerationHandlers(deps) {
|
||||
if (emoji === APPROVE) {
|
||||
approveRequest(linked.request.id, user.id);
|
||||
await reaction.message.reply({
|
||||
content: `✅ Verification request \`${linked.request.id}\` approved by ${sanitizeMentions(user.username || user.tag || user.id)}.`,
|
||||
content: [
|
||||
`✅ Verification request \`${linked.request.id}\` approved by ${sanitizeMentions(user.username || user.tag || user.id)}.`,
|
||||
`Nickname: ${sanitizeMentions(linked.request.nickname || 'unknown')}`,
|
||||
`Identity Key: \`${String(linked.request.cookieUserId || 'unknown')}\``,
|
||||
].join('\n'),
|
||||
allowedMentions: { parse: [] },
|
||||
});
|
||||
} else {
|
||||
denyRequest(linked.request.id, user.id);
|
||||
await reaction.message.reply({
|
||||
content: `❌ Verification request \`${linked.request.id}\` denied by ${sanitizeMentions(user.username || user.tag || user.id)}.`,
|
||||
content: [
|
||||
`❌ Verification request \`${linked.request.id}\` denied by ${sanitizeMentions(user.username || user.tag || user.id)}.`,
|
||||
`Nickname: ${sanitizeMentions(linked.request.nickname || 'unknown')}`,
|
||||
`Identity Key: \`${String(linked.request.cookieUserId || 'unknown')}\``,
|
||||
].join('\n'),
|
||||
allowedMentions: { parse: [] },
|
||||
});
|
||||
}
|
||||
try {
|
||||
await reaction.message.reactions.removeAll();
|
||||
} catch {}
|
||||
}
|
||||
|
||||
async function handlePrivateAccessReaction(reaction, user) {
|
||||
@@ -117,16 +128,27 @@ function createDmModerationHandlers(deps) {
|
||||
if (emoji === APPROVE) {
|
||||
approvePrivateAccessRequest(linked.request.id, user.id);
|
||||
await reaction.message.reply({
|
||||
content: `✅ Private access request \`${linked.request.id}\` approved by ${sanitizeMentions(user.username || user.tag || user.id)}.`,
|
||||
content: [
|
||||
`✅ Private access request \`${linked.request.id}\` approved by ${sanitizeMentions(user.username || user.tag || user.id)}.`,
|
||||
`Rover: ${sanitizeMentions(linked.request.roverName || linked.request.roverId || 'unknown')} (\`${String(linked.request.roverId || 'unknown')}\`)`,
|
||||
`Requester: ${sanitizeMentions(linked.request.requester?.nickname || 'unknown')}`,
|
||||
].join('\n'),
|
||||
allowedMentions: { parse: [] },
|
||||
});
|
||||
} else {
|
||||
denyPrivateAccessRequest(linked.request.id, user.id);
|
||||
await reaction.message.reply({
|
||||
content: `❌ Private access request \`${linked.request.id}\` denied by ${sanitizeMentions(user.username || user.tag || user.id)}.`,
|
||||
content: [
|
||||
`❌ Private access request \`${linked.request.id}\` denied by ${sanitizeMentions(user.username || user.tag || user.id)}.`,
|
||||
`Rover: ${sanitizeMentions(linked.request.roverName || linked.request.roverId || 'unknown')} (\`${String(linked.request.roverId || 'unknown')}\`)`,
|
||||
`Requester: ${sanitizeMentions(linked.request.requester?.nickname || 'unknown')}`,
|
||||
].join('\n'),
|
||||
allowedMentions: { parse: [] },
|
||||
});
|
||||
}
|
||||
try {
|
||||
await reaction.message.reactions.removeAll();
|
||||
} catch {}
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -141,8 +141,7 @@ function createRuntimeEngine(deps) {
|
||||
const nextUpdated = raw?.last_updated ?? null;
|
||||
const changed =
|
||||
runtimeState.lastState !== nextState ||
|
||||
runtimeState.lastChanged !== nextChanged ||
|
||||
runtimeState.lastUpdated !== nextUpdated;
|
||||
runtimeState.lastChanged !== nextChanged;
|
||||
if (!changed) {
|
||||
return { matched: false, nextState, nextChanged, nextUpdated };
|
||||
}
|
||||
|
||||
@@ -13,6 +13,21 @@ const {
|
||||
} = require('./constants');
|
||||
|
||||
async function turnOffRoomControls() {
|
||||
const lightPolicy = homeAssistantService.getLightPolicyState?.() || null;
|
||||
const lockState = lightPolicy?.lockState || null;
|
||||
if (lockState === 'on') {
|
||||
logger.info('Idle room-controls off skipped because room controls are locked on', {
|
||||
lockState,
|
||||
source: 'idleService:turnOffRoomControls',
|
||||
});
|
||||
return {
|
||||
action: 'roomControlsOff',
|
||||
skipped: true,
|
||||
reason: 'lightsLockedOn',
|
||||
lockState,
|
||||
};
|
||||
}
|
||||
|
||||
const before = homeAssistantService.getState?.().entities || [];
|
||||
const summary = await homeAssistantService.setAllControllableEntitiesState('off', {
|
||||
source: 'idleService:turnOffRoomControls',
|
||||
|
||||
@@ -49,6 +49,7 @@ const ENTITY_IDS = {
|
||||
},
|
||||
textSensors: {
|
||||
// ESPHome text_sensor entities surface in Home Assistant under the sensor domain.
|
||||
robotState: entityId('sensor', 'robot_state'),
|
||||
uiState: entityId('sensor', 'ui_state'),
|
||||
robotError: entityId('sensor', 'robot_error'),
|
||||
robotAlert: entityId('sensor', 'robot_alert'),
|
||||
@@ -96,6 +97,7 @@ function requiredEntityIds() {
|
||||
ENTITY_IDS.sensors.batteryVoltage,
|
||||
ENTITY_IDS.binarySensors.chargingActive,
|
||||
ENTITY_IDS.binarySensors.extPowerPresent,
|
||||
ENTITY_IDS.textSensors.robotState,
|
||||
ENTITY_IDS.textSensors.uiState,
|
||||
ENTITY_IDS.textSensors.robotError,
|
||||
ENTITY_IDS.textSensors.robotAlert,
|
||||
@@ -133,6 +135,7 @@ function buildState() {
|
||||
const batteryPercent =
|
||||
batteryPercentValue == null ? null : Math.max(0, Math.min(100, Math.round(batteryPercentValue)));
|
||||
const batteryVoltage = parseNumber(readState(ENTITY_IDS.sensors.batteryVoltage));
|
||||
const robotState = readState(ENTITY_IDS.textSensors.robotState);
|
||||
const uiState = readState(ENTITY_IDS.textSensors.uiState);
|
||||
const robotError = readState(ENTITY_IDS.textSensors.robotError);
|
||||
const robotAlert = readState(ENTITY_IDS.textSensors.robotAlert);
|
||||
@@ -151,6 +154,7 @@ function buildState() {
|
||||
batteryVoltage,
|
||||
chargingActive,
|
||||
extPowerPresent,
|
||||
robotState,
|
||||
uiState,
|
||||
robotError,
|
||||
robotAlert,
|
||||
|
||||
@@ -331,10 +331,10 @@ audioLevelsEvents.on('change', () => {
|
||||
});
|
||||
|
||||
// sync all sockets 20 seconds
|
||||
setInterval(() => {
|
||||
logger.info('Periodic session sync for all clients');
|
||||
syncAll();
|
||||
}, PERIODIC_SYNC_MS);
|
||||
// setInterval(() => {
|
||||
// logger.info('Periodic session sync for all clients');
|
||||
// syncAll();
|
||||
// }, PERIODIC_SYNC_MS);
|
||||
|
||||
module.exports = {
|
||||
buildSession,
|
||||
|
||||
Reference in New Issue
Block a user