UNPKG

matterbridge-roborock-vacuum-plugin

Version:
27 lines (26 loc) 823 B
import { debugStringify } from 'matterbridge/logger'; import { randomInt } from 'node:crypto'; export function getSupportedScenes(scenes, log) { log?.debug('getSupportedScenes', debugStringify(scenes)); if (!scenes || scenes.length === 0) { log?.error('No scenes found'); return []; } const supportedAreas = scenes .filter((s) => s.enabled && s.id) .map((scene) => { return { areaId: scene.id ?? 0 + randomInt(5000, 9000), mapId: null, areaInfo: { locationInfo: { locationName: `Scene: ${scene.name}`, floorNumber: null, areaType: null, }, landmarkInfo: null, }, }; }); return supportedAreas; }