mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 01:21:20 -04:00
neatp
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
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-EI4GBqvV.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-IQlwhkNm.css">
|
||||
<script type="module" crossorigin src="/assets/index-wLjyvnCl.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-pfHsbpoo.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
||||
@@ -34,6 +34,7 @@ const ENTITY_IDS = {
|
||||
start: entityId('button', 'house_clean'),
|
||||
sendHome: entityId('button', 'send_to_base'),
|
||||
locate: entityId('button', 'locate_robot'),
|
||||
clearErrors: entityId('button', 'clear_errors'),
|
||||
},
|
||||
sensors: {
|
||||
batteryPercent: entityId('sensor', 'fuel_percent'),
|
||||
@@ -92,6 +93,10 @@ function buildState() {
|
||||
entityId: ENTITY_IDS.buttons.locate,
|
||||
available: hasEntity(ENTITY_IDS.buttons.locate),
|
||||
},
|
||||
clearErrors: {
|
||||
entityId: ENTITY_IDS.buttons.clearErrors,
|
||||
available: hasEntity(ENTITY_IDS.buttons.clearErrors),
|
||||
},
|
||||
};
|
||||
|
||||
const batteryPercentValue = parseNumber(readState(ENTITY_IDS.sensors.batteryPercent));
|
||||
@@ -179,6 +184,10 @@ async function locateRobot() {
|
||||
await pressButton(ENTITY_IDS.buttons.locate, 'locate');
|
||||
}
|
||||
|
||||
async function clearErrors() {
|
||||
await pressButton(ENTITY_IDS.buttons.clearErrors, 'clear_errors');
|
||||
}
|
||||
|
||||
function getState() {
|
||||
cachedState = buildState();
|
||||
return cachedState;
|
||||
@@ -220,6 +229,18 @@ io.on('connection', (socket) => {
|
||||
cb({ error: err.message });
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('neato:clearErrors', async (_, cb = () => {}) => {
|
||||
try {
|
||||
if (!isVerified(socket)) {
|
||||
throw new Error('VIP verification required');
|
||||
}
|
||||
await clearErrors();
|
||||
cb({ success: true });
|
||||
} catch (err) {
|
||||
cb({ error: err.message });
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
emitUpdate();
|
||||
@@ -229,5 +250,6 @@ module.exports = {
|
||||
startCleaning,
|
||||
sendHome,
|
||||
locateRobot,
|
||||
clearErrors,
|
||||
neatoEvents: events,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user