feat: add CMD_DATABASE_QUERY_BY_DATE (10006) support for HB3#768
Conversation
src/eufysecurity.ts
Outdated
| station.on("image download", (station: Station, file: string, image: Buffer) => this.onStationImageDownload(station, file, image)); | ||
| station.on("database query latest", (station: Station, returnCode: DatabaseReturnCode, data: Array<DatabaseQueryLatestInfo>) => this.onStationDatabaseQueryLatest(station, returnCode, data)); | ||
| station.on("database query local", (station: Station, returnCode: DatabaseReturnCode, data: Array<DatabaseQueryLocal>) => this.onStationDatabaseQueryLocal(station, returnCode, data)); | ||
| station.on("database query by date", (station: Station, returnCode: DatabaseReturnCode, data: Array<DatabaseQueryByDate>) => this.onStationDatabaseQueryByDate(station, returnCode, data)); |
There was a problem hiding this comment.
We need to add documentation in eufysecurity.ts.html
|
Hi @max246, I can't find |
my bad, was looking locally, and that was my coverage jest test , will approve and you can merge it |
|
just nee to rebase I think, but you can merge it when I approve it, otherwise I am happy to merge it in |
|
Tried this on my HB3 (T8030) via Firmware: 3.7.3.6
same for and |
|
@nhols Did you try with a single day? Eufy is quite picky about what we can ask. I managed to get events with this code for example (replace the WS URL with your service) node -e "
const WS = require('ws');
const ws = new WS('ws://<TODO>:3000');
ws.on('error', e => console.log('Error:', e.message));
const send = (c, p) => { console.log('>>> ' + c); ws.send(JSON.stringify({ messageId: Date.now(), command: c, ...p })); };
const fmt = d => d.toISOString().slice(0,10).replace(/-/g,'');
ws.on('open', () => {
console.log('Connected!');
send('set_api_schema', {schemaVersion:21});
send('start_listening');
});
ws.on('message', d => {
const m = JSON.parse(d);
console.log('<<< type:', m.type, 'event:', m.event?.event || m.result?.state ? 'state' : '');
if (m.result?.state?.stations) {
console.log('Stations:', m.result.state.stations);
const t = new Date(), n = new Date(t); n.setDate(n.getDate()+1);
m.result.state.stations.forEach(s => send('station.database_query_by_date', {
serialNumber:s, serialNumbers:[], startDate:fmt(t), endDate:fmt(n), eventType:0, detectionType:0, storageType:0
}));
}
if (m.event?.event === 'database query by date') {
console.log('=== RESULTS ===');
console.log('Events:', m.event.data?.length || 0);
if (m.event.data?.[0]) console.log(JSON.stringify(m.event.data[0], null, 2));
ws.close(); process.exit();
}
});
setTimeout(() => { console.log('Timeout'); process.exit(1); }, 30000);
" |
|
@temp-droid this worked - thank you! |
aa12a0f to
1e683f2
Compare
1e683f2 to
aab1402
Compare
|
@max246 I believe I do not have permission to merge, you will need to do it yourself if you are OK with the conflict resolution |
Description
Adds support for
CMD_DATABASE_QUERY_BY_DATE(command 10006) to query video recordings by date range. This enables retrieving the recording history with metadata like storage paths, thumbnails, and timestamps.Testing
Tested on HomeBase 3 (T8030) - Firmware 3.7.3.6.