directories.forEach((directory) => { logger.info(`Installing dependencies in folder ${directory}`); try { execSync(`cd ${directory} && npm install --unsafe-perm`, { maxBuffer: 10 * 1000 * 1024, // 10Mo of logs allowed for module with big npm install }); } catch (e) { logger.warn(e); } });
/** * @description Handle a message event. * @param {Object} message - The message sent by the user. * @example * message.handleEvent(message); */ async function handleEvent(message) { try { await this.create(message); } catch (e) { logger.warn(e); } }
Promise.map(action.devices, async (deviceSelector) => { try { const device = self.stateManager.get('device', deviceSelector); const deviceFeature = getDeviceFeature( device, DEVICE_FEATURE_CATEGORIES.LIGHT, DEVICE_FEATURE_TYPES.LIGHT.BINARY, ); await self.device.setValue(device, deviceFeature, 0); } catch (e) { logger.warn(e); } })
/** * @description Poll a camera * @param {Object} device - The camera to poll. * @example * poll(device); */ async function poll(device) { try { const cameraImage = await this.getImage(device); await this.gladys.device.camera.setImage(device.selector, cameraImage); } catch (e) { logger.warn('Unable to poll camera'); logger.debug(e); } }
Promise.map(action.devices, async (deviceSelector) => { try { const device = self.stateManager.get('device', deviceSelector); const deviceFeature = getDeviceFeature( device, DEVICE_FEATURE_CATEGORIES.SWITCH, DEVICE_FEATURE_TYPES.SWITCH.BINARY, ); await self.device.setValue(device, deviceFeature, 0); } catch (e) { logger.warn(e); } })
directories.forEach((directory) => { logger.info(`Installing dependencies in folder ${directory}`); try { execSync(`cd ${directory} && npm install --unsafe-perm`, { maxBuffer: 10 * 1000 * 1024, // 10Mo of logs allowed for module with big npm install }); } catch (e) { logger.warn(e); } });
/** * @description Handle a message event. * @param {Object} message - The message sent by the user. * @example * message.handleEvent(message); */ async function handleEvent(message) { try { await this.create(message); } catch (e) { logger.warn(e); } }
Promise.map(action.devices, async (deviceSelector) => { try { const device = self.stateManager.get('device', deviceSelector); const deviceFeature = getDeviceFeature( device, DEVICE_FEATURE_CATEGORIES.SWITCH, DEVICE_FEATURE_TYPES.SWITCH.BINARY, ); await self.device.setValue(device, deviceFeature, 1); } catch (e) { logger.warn(e); } })
Promise.map(action.devices, async (deviceSelector) => { try { const device = self.stateManager.get('device', deviceSelector); const deviceFeature = getDeviceFeature( device, DEVICE_FEATURE_CATEGORIES.SWITCH, DEVICE_FEATURE_TYPES.SWITCH.BINARY, ); await self.device.setValue(device, deviceFeature, 0); } catch (e) { logger.warn(e); } })
Promise.map(action.devices, async (deviceSelector) => { try { const device = self.stateManager.get('device', deviceSelector); const deviceFeature = getDeviceFeature( device, DEVICE_FEATURE_CATEGORIES.SWITCH, DEVICE_FEATURE_TYPES.SWITCH.BINARY, ); await self.device.setValue(device, deviceFeature, 1); } catch (e) { logger.warn(e); } })
Promise.map(action.devices, async (deviceSelector) => { try { const device = self.stateManager.get('device', deviceSelector); const deviceFeature = getDeviceFeature( device, DEVICE_FEATURE_CATEGORIES.LIGHT, DEVICE_FEATURE_TYPES.LIGHT.BINARY, ); await self.device.setValue(device, deviceFeature, 1); } catch (e) { logger.warn(e); } })
Promise.map(action.devices, async (deviceSelector) => { try { const device = self.stateManager.get('device', deviceSelector); const deviceFeature = getDeviceFeature( device, DEVICE_FEATURE_CATEGORIES.LIGHT, DEVICE_FEATURE_TYPES.LIGHT.BINARY, ); await self.device.setValue(device, deviceFeature, 1); } catch (e) { logger.warn(e); } })
Promise.map(action.devices, async (deviceSelector) => { try { const device = self.stateManager.get('device', deviceSelector); const deviceFeature = getDeviceFeature( device, DEVICE_FEATURE_CATEGORIES.LIGHT, DEVICE_FEATURE_TYPES.LIGHT.BINARY, ); await self.device.setValue(device, deviceFeature, 0); } catch (e) { logger.warn(e); } })
/** * @description Poll a camera * @param {Object} device - The camera to poll. * @example * poll(device); */ async function poll(device) { try { const cameraImage = await this.getImage(device); await this.gladys.device.camera.setImage(device.selector, cameraImage); } catch (e) { logger.warn('Unable to poll camera'); logger.debug(e); } }
/** * @description Poll a camera * @param {Object} device - The camera to poll. * @example * poll(device); */ async function poll(device) { try { const cameraImage = await this.getImage(device); await this.gladys.device.camera.setImage(device.selector, cameraImage); } catch (e) { logger.warn('Unable to poll camera'); logger.debug(e); } }