Wanted to include only cameras for a specific network. Code suggested is below, five lines starting with // only show comment, enabled by adding array of desired networks names to config (if no config.networks, system works as before).
async refreshData(force = false) {
const ttl = force ? 0 : (this.config["camera-status-polling-seconds"] || STATUS_POLL);
const homescreen = await this.blinkAPI.getAccountHomescreen(ttl);
homescreen.cameras.push(...homescreen.owls);
for (const network of homescreen.networks) {
network.syncModule = homescreen.sync_modules.filter(sm => sm.network_id === network.id)[0];
}
// only show items from networks listed in config
if (this.config.networks) {
homescreen.networks = homescreen.networks.filter(n => this.config.networks.includes(n.name));
homescreen.cameras = homescreen.cameras.filter(c => homescreen.networks.map(n => n.id).includes(c.network_id));
}
if (this.networks && this.networks.size > 0) {
for (const n of homescreen.networks) {
//TODO: new networks?
if (this.networks.has(n.id)) this.networks.get(n.id).data = n;
}
for (const c of homescreen.cameras) {
//TODO: new cameras?
if (this.cameras.has(c.id)) this.cameras.get(c.id).data = c;
}
}
else {
this.networks = new Map(homescreen.networks.map(n => [n.id, new BlinkNetwork(n, this)]));
this.cameras = new Map(homescreen.cameras.map(c => [c.id, new BlinkCamera(c, this)]));
}
return homescreen;
}
Wanted to include only cameras for a specific network. Code suggested is below, five lines starting with // only show comment, enabled by adding array of desired networks names to config (if no config.networks, system works as before).