diff --git a/front/src/actions/dashboard/boxes/humidityInRoom.js b/front/src/actions/dashboard/boxes/humidityInRoom.js new file mode 100644 index 0000000000..4ec78953d8 --- /dev/null +++ b/front/src/actions/dashboard/boxes/humidityInRoom.js @@ -0,0 +1,26 @@ +import { RequestStatus } from '../../../utils/consts'; +import createBoxActions from '../boxActions'; + +const BOX_KEY = 'HumidityInRoom'; + +function createActions(store) { + const boxActions = createBoxActions(store); + + const actions = { + async getHumidityInRoom(state, box, x, y) { + boxActions.updateBoxStatus(state, BOX_KEY, x, y, RequestStatus.Getting); + try { + const room = await state.httpClient.get(`/api/v1/room/${box.room}?expand=humidity`); + boxActions.mergeBoxData(state, BOX_KEY, x, y, { + room + }); + boxActions.updateBoxStatus(state, BOX_KEY, x, y, RequestStatus.Success); + } catch (e) { + boxActions.updateBoxStatus(state, BOX_KEY, x, y, RequestStatus.Error); + } + } + }; + return Object.assign({}, actions); +} + +export default createActions; diff --git a/front/src/actions/dashboard/edit-boxes/editHumidityInRoom.js b/front/src/actions/dashboard/edit-boxes/editHumidityInRoom.js new file mode 100644 index 0000000000..7ddf1e0592 --- /dev/null +++ b/front/src/actions/dashboard/edit-boxes/editHumidityInRoom.js @@ -0,0 +1,16 @@ +import createBoxActions from '../boxActions'; + +function createActions(store) { + const boxActions = createBoxActions(store); + + const actions = { + updateBoxRoom(state, x, y, room) { + boxActions.updateBoxConfig(state, x, y, { + room + }); + } + }; + return actions; +} + +export default createActions; diff --git a/front/src/components/boxs/room-humidity/EditRoomHumidityBox.jsx b/front/src/components/boxs/room-humidity/EditRoomHumidityBox.jsx new file mode 100644 index 0000000000..e8f5fbd4fc --- /dev/null +++ b/front/src/components/boxs/room-humidity/EditRoomHumidityBox.jsx @@ -0,0 +1,34 @@ +import { Component } from 'preact'; +import { connect } from 'unistore/preact'; +import { Text } from 'preact-i18n'; +import actions from '../../../actions/dashboard/edit-boxes/editHumidityInRoom'; +import BaseEditBox from '../baseEditBox'; + +import RoomSelector from '../../house/RoomSelector'; + +const updateBoxRoom = (updateBoxRoomFunc, x, y) => room => { + updateBoxRoomFunc(x, y, room.selector); +}; + +const EditRoomHumidityBox = ({ children, ...props }) => ( + +
+ + +
+
+); + +@connect('', actions) +class EditRoomHumidityBoxComponent extends Component { + render(props, {}) { + return ; + } +} + +export default EditRoomHumidityBoxComponent; diff --git a/front/src/components/boxs/room-humidity/RoomHumidity.jsx b/front/src/components/boxs/room-humidity/RoomHumidity.jsx new file mode 100644 index 0000000000..58fe040922 --- /dev/null +++ b/front/src/components/boxs/room-humidity/RoomHumidity.jsx @@ -0,0 +1,59 @@ +import { Component } from 'preact'; +import { connect } from 'unistore/preact'; +import { Text } from 'preact-i18n'; +import actions from '../../../actions/dashboard/boxes/humidityInRoom'; +import { DASHBOARD_BOX_STATUS_KEY, DASHBOARD_BOX_DATA_KEY } from '../../../utils/consts'; +import get from 'get-value'; + +const RoomHumidityBox = ({ children, ...props }) => ( +
+
+ {props.humidity > 45 && props.humidity < 60 && ( + + + + )} + {props.humidity <= 45 && ( + + + + )} + {props.humidity >= 60 && ( + + + + )} +
+ {props.humidity && ( +

+ +

+ )} + {!props.humidity && ( +

+ +

+ )} + {props.roomName} +
+
+
+); + +@connect('DashboardBoxDataHumidityInRoom,DashboardBoxStatusHumidityInRoom', actions) +class RoomHumidityBoxComponent extends Component { + componentDidMount() { + this.props.getHumidityInRoom(this.props.box, this.props.x, this.props.y); + } + + render(props, {}) { + const boxData = get(props, `${DASHBOARD_BOX_DATA_KEY}HumidityInRoom.${props.x}_${props.y}`); + const boxStatus = get(props, `${DASHBOARD_BOX_STATUS_KEY}HumidityInRoom.${props.x}_${props.y}`); + const humidity = get(boxData, 'room.humidity.humidity'); + const unit = get(boxData, 'room.humidity.unit'); + const roomName = get(boxData, 'room.name'); + return ; + } +} + +export default RoomHumidityBoxComponent; diff --git a/front/src/config/i18n/en.json b/front/src/config/i18n/en.json index 6180f3148e..c8642cd9e9 100644 --- a/front/src/config/i18n/en.json +++ b/front/src/config/i18n/en.json @@ -178,6 +178,7 @@ "boxTitle": { "weather": "Weather", "temperature-in-room": "Temperature in room", + "humidity-in-room": "Humidity in room", "user-presence": "User presence", "camera": "Camera", "devices-in-room": "Devices in room" @@ -212,6 +213,10 @@ "editRoomLabel": "Select the room you want to display here.", "noTemperatureRecorded": "No temperature recorded recently." }, + "humidityInRoom": { + "editRoomLabel": "Select the room you want to display here.", + "noHumidityRecorded": "No humidity recorded recently." + }, "userPresence": { "description": "Display who's at home and who is not. You can change the user presence in scenes.", "left": "Left ({{since}})", diff --git a/front/src/config/i18n/fr.json b/front/src/config/i18n/fr.json index b0a025d2d5..f4ddbee7ec 100644 --- a/front/src/config/i18n/fr.json +++ b/front/src/config/i18n/fr.json @@ -178,6 +178,7 @@ "boxTitle": { "weather": "Météo", "temperature-in-room": "Température de la pièce", + "humidity-in-room": "Humidité de la pièce", "user-presence": "Utilisateurs présent", "camera": "Caméra", "devices-in-room": "Appareils de la pièce" @@ -212,6 +213,10 @@ "editRoomLabel": "Sélectionnez la pièce que vous souhaitez afficher ici.", "noTemperatureRecorded": "Aucune température enregistrée récemment." }, + "humidityInRoom": { + "editRoomLabel": "Sélectionnez la pièce que vous souhaitez afficher ici.", + "noHumidityRecorded": "Aucune mesure d'humidité enregistrée récemment." + }, "userPresence": { "description": "Cette box affiche qui est à la maison et qui ne l'est pas. Vous pouvez changer la présence d'un utilisateur dans les scènes.", "left": "Absent ({{since}})", diff --git a/front/src/routes/dashboard/Box.jsx b/front/src/routes/dashboard/Box.jsx index f853990568..3e2ed07aeb 100644 --- a/front/src/routes/dashboard/Box.jsx +++ b/front/src/routes/dashboard/Box.jsx @@ -1,5 +1,6 @@ import WeatherBox from '../../components/boxs/weather/WeatherBox'; import RoomTemperatureBox from '../../components/boxs/room-temperature/RoomTemperature'; +import RoomHumidityBox from '../../components/boxs/room-humidity/RoomHumidity'; import CameraBox from '../../components/boxs/camera/Camera'; import AtHomeBox from '../../components/boxs/user-presence/UserPresence'; import DevicesInRoomsBox from '../../components/boxs/device-in-room/DevicesInRoomsBox'; @@ -14,6 +15,8 @@ const Box = ({ children, ...props }) => { return ; case 'temperature-in-room': return ; + case 'humidity-in-room': + return ; case 'devices-in-room': return ; } diff --git a/front/src/routes/dashboard/EditBox.jsx b/front/src/routes/dashboard/EditBox.jsx index aacde619e1..5c88d61474 100644 --- a/front/src/routes/dashboard/EditBox.jsx +++ b/front/src/routes/dashboard/EditBox.jsx @@ -1,6 +1,7 @@ import { Text } from 'preact-i18n'; import EditWeatherBox from '../../components/boxs/weather/EditWeatherBox'; import EditRoomTemperatureBox from '../../components/boxs/room-temperature/EditRoomTemperatureBox'; +import EditRoomHumidityBox from '../../components/boxs/room-humidity/EditRoomHumidityBox'; import EditCameraBox from '../../components/boxs/camera/EditCamera'; import EditAtHomeBox from '../../components/boxs/user-presence/EditUserPresenceBox'; import EditDevicesInRoom from '../../components/boxs/device-in-room/EditDeviceInRoom'; @@ -15,6 +16,8 @@ const Box = ({ children, ...props }) => { return ; case 'temperature-in-room': return ; + case 'humidity-in-room': + return ; case 'devices-in-room': return ; } diff --git a/server/api/controllers/room.controller.js b/server/api/controllers/room.controller.js index 973dcfb330..c7d2acfcbf 100644 --- a/server/api/controllers/room.controller.js +++ b/server/api/controllers/room.controller.js @@ -89,6 +89,10 @@ module.exports = function RoomController(gladys) { unit: req.user.temperature_unit_preference, }); } + // if the user wants the humidity in the room + if (expandFields.humidity) { + room.humidity = await gladys.device.humiditySensorManager.getHumidityInRoom(room.id); + } res.json(room); } diff --git a/server/config/brain/humidity-sensor/answers.en.json b/server/config/brain/humidity-sensor/answers.en.json new file mode 100644 index 0000000000..8b611baab7 --- /dev/null +++ b/server/config/brain/humidity-sensor/answers.en.json @@ -0,0 +1,14 @@ +[ + { + "label": "humidity-sensor.get-in-room.success", + "answers": ["The humidity level is {{ humidity }}% in the {{ roomName }}."] + }, + { + "label": "humidity-sensor.get-in-room.fail.no-results", + "answers": ["No humidity values were recorded in the last hour in this room."] + }, + { + "label": "humidity-sensor.get-in-room.fail.room-not-found", + "answers": ["I can't find a room with this name."] + } +] diff --git a/server/config/brain/humidity-sensor/answers.fr.json b/server/config/brain/humidity-sensor/answers.fr.json new file mode 100644 index 0000000000..f16a3c4d0b --- /dev/null +++ b/server/config/brain/humidity-sensor/answers.fr.json @@ -0,0 +1,14 @@ +[ + { + "label": "humidity-sensor.get-in-room.success", + "answers": ["Le taux d'humidité est de {{ humidity }}% dans la pièce {{ roomName }}."] + }, + { + "label": "humidity-sensor.get-in-room.fail.no-results", + "answers": ["Aucune valeur d'humidité n'a été enregistré dans cette pièce au cours de la dernière heure."] + }, + { + "label": "humidity-sensor.get-in-room.fail.room-not-found", + "answers": ["Je n'ai pas trouvé de pièce avec ce nom."] + } +] diff --git a/server/config/brain/humidity-sensor/questions.en.json b/server/config/brain/humidity-sensor/questions.en.json new file mode 100644 index 0000000000..b069135bc0 --- /dev/null +++ b/server/config/brain/humidity-sensor/questions.en.json @@ -0,0 +1,6 @@ +[ + { + "label": "humidity-sensor.get-in-room", + "questions": ["What's the humidity level in the %room% ?", "Give me the humidity level in the %room%"] + } +] diff --git a/server/config/brain/humidity-sensor/questions.fr.json b/server/config/brain/humidity-sensor/questions.fr.json new file mode 100644 index 0000000000..65148f63c4 --- /dev/null +++ b/server/config/brain/humidity-sensor/questions.fr.json @@ -0,0 +1,6 @@ +[ + { + "label": "humidity-sensor.get-in-room", + "questions": ["Quel est le taux d'humidité dans le %room% ?", "Donne moi l'humidité du %room%"] + } +] diff --git a/server/lib/device/humidity-sensor/humidity-sensor.command.js b/server/lib/device/humidity-sensor/humidity-sensor.command.js new file mode 100644 index 0000000000..aad3a8a2da --- /dev/null +++ b/server/lib/device/humidity-sensor/humidity-sensor.command.js @@ -0,0 +1,52 @@ +const logger = require('../../../utils/logger'); +const { NotFoundError, NoValuesFoundError } = require('../../../utils/coreErrors'); +const { DEVICE_FEATURE_UNITS } = require('../../../utils/constants'); + +/** + * @description Get the average humidity in a room. + * @param {Object} message - The message sent by the user. + * @param {Object} classification - The classification calculated by the brain. + * @param {Object} context - The context object containing found variables in question. + * @example + * command(message, classification, context); + */ +async function command(message, classification, context) { + let humidityResult; + let roomEntity; + try { + switch (classification.intent) { + case 'humidity-sensor.get-in-room': + if (!context.room) { + throw new NotFoundError('Room not found'); + } + humidityResult = await this.getHumidityInRoom(context.room, { + unit: DEVICE_FEATURE_UNITS.PERCENT, + }); + if (humidityResult.humidity === null) { + throw new NoValuesFoundError('No humidity values found in this room.'); + } + roomEntity = classification.entities.find((entity) => entity.entity === 'room'); + context.humidity = Math.round(humidityResult.humidity); + context.unit = DEVICE_FEATURE_UNITS.PERCENT; + context.roomName = roomEntity.sourceText; + this.messageManager.replyByIntent(message, `humidity-sensor.get-in-room.success`, context); + break; + default: + throw new Error('Not found'); + } + } catch (e) { + logger.debug(e); + if (e instanceof NotFoundError && e.message === 'Room not found') { + this.messageManager.replyByIntent(message, 'humidity-sensor.get-in-room.fail.room-not-found', context); + } else if (e instanceof NoValuesFoundError) { + this.messageManager.replyByIntent(message, 'humidity-sensor.get-in-room.fail.no-results', context); + } else { + this.messageManager.replyByIntent(message, 'humidity-sensor.get-in-room.fail', context); + } + } + return null; +} + +module.exports = { + command, +}; diff --git a/server/lib/device/humidity-sensor/humidity-sensor.getHumidityInRoom.js b/server/lib/device/humidity-sensor/humidity-sensor.getHumidityInRoom.js new file mode 100644 index 0000000000..0500dcb23e --- /dev/null +++ b/server/lib/device/humidity-sensor/humidity-sensor.getHumidityInRoom.js @@ -0,0 +1,69 @@ +const { Op } = require('sequelize'); +const logger = require('../../../utils/logger'); +const db = require('../../../models'); +const { DEVICE_FEATURE_CATEGORIES, DEVICE_FEATURE_UNITS } = require('../../../utils/constants'); + +const DEFAULT_PARAMETERS = { + unit: DEVICE_FEATURE_UNITS.PERCENT, +}; + +/** + * @description Return the average value of the humidity in a room. + * @param {string} roomId - The uuid of the room. + * @param {Object} [options] - Options of the query (units). + * @returns {Promise} - Resolve with the humidity and the unit. + * @example + * getHumidityInRoom('d65deccf-d8fc-4674-ac50-3d98d1d87aba', { + * unit: 'percent', + * }); + */ +async function getHumidityInRoom(roomId, options) { + logger.debug(`Getting average humidity in room ${roomId}`); + const optionsWithDefault = Object.assign({}, DEFAULT_PARAMETERS, options); + + const oneHourAgo = new Date(new Date().getTime() - 1 * 60 * 60 * 1000); + const deviceFeatures = await db.DeviceFeature.findAll({ + attributes: ['last_value', 'unit'], + include: [ + { + model: db.Device, + as: 'device', + where: { + room_id: roomId, + }, + }, + ], + where: { + category: DEVICE_FEATURE_CATEGORIES.HUMIDITY_SENSOR, + last_value: { + [Op.not]: null, + }, + last_value_changed: { + // we want fresh value, less than 1h + [Op.gt]: oneHourAgo, + }, + }, + }); + + if (deviceFeatures.length === 0) { + return { + humidity: null, + unit: optionsWithDefault.unit, + }; + } + + const total = deviceFeatures.reduce((prev, deviceFeature) => deviceFeature.last_value + prev, 0); + + // we calculate the average value + const averageHumidity = total / deviceFeatures.length; + + // return humidity and unit + return { + humidity: averageHumidity, + unit: optionsWithDefault.unit, + }; +} + +module.exports = { + getHumidityInRoom, +}; diff --git a/server/lib/device/humidity-sensor/index.js b/server/lib/device/humidity-sensor/index.js new file mode 100644 index 0000000000..e6dda16def --- /dev/null +++ b/server/lib/device/humidity-sensor/index.js @@ -0,0 +1,15 @@ +const { command } = require('./humidity-sensor.command'); +const { getHumidityInRoom } = require('./humidity-sensor.getHumidityInRoom'); +const { INTENTS } = require('../../../utils/constants'); + +const HumiditySensorManager = function HumiditySensorManager(eventManager, messageManager, deviceManager) { + this.eventManager = eventManager; + this.messageManager = messageManager; + this.deviceManager = deviceManager; + this.eventManager.on(INTENTS.HUMIDITY_SENSOR.GET_IN_ROOM, this.command.bind(this)); +}; + +HumiditySensorManager.prototype.command = command; +HumiditySensorManager.prototype.getHumidityInRoom = getHumidityInRoom; + +module.exports = HumiditySensorManager; diff --git a/server/lib/device/index.js b/server/lib/device/index.js index ae6d792476..c96a6d542d 100644 --- a/server/lib/device/index.js +++ b/server/lib/device/index.js @@ -5,6 +5,7 @@ const { eventFunctionWrapper } = require('../../utils/functionsWrapper'); const CameraManager = require('./camera'); const LightManager = require('./light'); const TemperatureSensorManager = require('./temperature-sensor'); +const HumiditySensorManager = require('./humidity-sensor'); // Functions const { add } = require('./device.add'); @@ -45,6 +46,7 @@ const DeviceManager = function DeviceManager( this.camera = new CameraManager(this.stateManager, messageManager, eventManager, this); this.lightManager = new LightManager(eventManager, messageManager, this); this.temperatureSensorManager = new TemperatureSensorManager(eventManager, messageManager, this); + this.humiditySensorManager = new HumiditySensorManager(eventManager, messageManager, this); this.devicesByPollFrequency = {}; // listen to events diff --git a/server/seeders/20190227081700-device-feature.js b/server/seeders/20190227081700-device-feature.js index bdd1946e83..066638af0c 100644 --- a/server/seeders/20190227081700-device-feature.js +++ b/server/seeders/20190227081700-device-feature.js @@ -76,6 +76,24 @@ module.exports = { created_at: '2019-02-12 07:49:07.556 +00:00', updated_at: '2019-02-12 07:49:07.556 +00:00', }, + { + id: '3b5b4870-145d-4584-bf0e-d97fdcf908b5', + name: 'Test humidity sensor', + selector: 'test-humidity-sensor', + external_id: 'humidity-sensor:1', + category: 'humidity-sensor', + type: 'humidity', + unit: 'percent', + read_only: false, + has_feedback: false, + min: 0, + max: 100, + last_value: 56.2, + last_value_changed: new Date().toISOString(), + device_id: '7f85c2f8-86cc-4600-84db-6c074dadb4e8', + created_at: '2019-02-12 07:49:07.556 +00:00', + updated_at: '2019-02-12 07:49:07.556 +00:00', + }, { id: '565d05fc-1736-4b76-99ca-581232901d96', name: 'Test camera image', diff --git a/server/test/controllers/room/room.test.js b/server/test/controllers/room/room.test.js index 1a1b495773..f4a752c419 100644 --- a/server/test/controllers/room/room.test.js +++ b/server/test/controllers/room/room.test.js @@ -82,6 +82,26 @@ describe('GET /api/v1/room/:room_selector', () => { }); }); }); + it('should get a room by selector with expanded humidity', async () => { + await authenticatedRequest + .get('/api/v1/room/test-room?expand=humidity') + .expect('Content-Type', /json/) + .expect(200) + .then((res) => { + expect(res.body).to.deep.equal({ + id: '2398c689-8b47-43cc-ad32-e98d9be098b5', + house_id: 'a741dfa6-24de-4b46-afc7-370772f068d5', + name: 'Test room', + selector: 'test-room', + humidity: { + humidity: 56.2, + unit: 'percent', + }, + created_at: '2019-02-12T07:49:07.556Z', + updated_at: '2019-02-12T07:49:07.556Z', + }); + }); + }); it('should get a room by selector with expanded devices', async () => { await authenticatedRequest .get('/api/v1/room/test-room?expand=devices') diff --git a/server/test/lib/device/humidity-sensor/humidity-sensor.test.js b/server/test/lib/device/humidity-sensor/humidity-sensor.test.js new file mode 100644 index 0000000000..597849d886 --- /dev/null +++ b/server/test/lib/device/humidity-sensor/humidity-sensor.test.js @@ -0,0 +1,145 @@ +const EventEmitter = require('events'); +const { expect } = require('chai'); +const { assert, fake } = require('sinon'); +const sinon = require('sinon'); +const Device = require('../../../../lib/device'); +const Room = require('../../../../lib/room'); +const StateManager = require('../../../../lib/state'); + +const event = new EventEmitter(); +const messageManager = { + replyByIntent: fake.resolves(true), +}; + +describe('HumiditySensor.getHumidityInRoom', () => { + it('should get average humidity in room', async () => { + const stateManager = new StateManager(event); + const deviceManager = new Device(event, messageManager, stateManager, {}); + const result = await deviceManager.humiditySensorManager.getHumidityInRoom('2398c689-8b47-43cc-ad32-e98d9be098b5'); + expect(result).to.deep.equal({ + humidity: 56.2, + unit: 'percent', + }); + }); + it('should return not found error', async () => { + const stateManager = new StateManager(event); + const deviceManager = new Device(event, {}, stateManager, {}); + const humidityResult = await deviceManager.humiditySensorManager.getHumidityInRoom( + 'f08337ff-206e-4bd7-86c4-6d63d793d58e', + ); + expect(humidityResult).to.deep.equal({ + humidity: null, + unit: 'percent', + }); + }); +}); + +describe('HumiditySensor.command', () => { + afterEach(() => { + sinon.reset(); + }); + it('should ask the humidity in a room', async () => { + const stateManager = new StateManager(event); + const deviceManager = new Device(event, messageManager, stateManager, {}); + const message = {}; + await deviceManager.humiditySensorManager.command( + message, + { + intent: 'humidity-sensor.get-in-room', + entities: [ + { + sourceText: 'kitchen', + entity: 'room', + }, + ], + }, + { + room: '2398c689-8b47-43cc-ad32-e98d9be098b5', + }, + ); + assert.calledWith(messageManager.replyByIntent, message, 'humidity-sensor.get-in-room.success', { + room: '2398c689-8b47-43cc-ad32-e98d9be098b5', + roomName: 'kitchen', + humidity: 56, + unit: 'percent', + }); + }); + it('should return room not found', async () => { + const stateManager = new StateManager(event); + const deviceManager = new Device(event, messageManager, stateManager, {}); + const message = {}; + await deviceManager.humiditySensorManager.command( + message, + { + intent: 'humidity-sensor.get-in-room', + entities: [], + }, + {}, + ); + assert.calledWith(messageManager.replyByIntent, message, 'humidity-sensor.get-in-room.fail.room-not-found', {}); + }); + it('should ask the humidity in a room with no values', async () => { + const brain = { + addRoom: fake.returns(null), + removeRoom: fake.returns(null), + }; + const stateManager = new StateManager(event); + const deviceManager = new Device(event, messageManager, stateManager, {}); + const room = new Room(brain); + await room.create('test-house', { + name: 'No value Room', + }); + const roomFound = await room.getBySelector('no-value-room'); + const message = {}; + await deviceManager.humiditySensorManager.command( + message, + { + intent: 'humidity-sensor.get-in-room', + entities: [ + { + sourceText: 'no-value-room', + entity: 'room', + }, + ], + }, + { + room: roomFound.id, + }, + ); + assert.calledWith(messageManager.replyByIntent, message, 'humidity-sensor.get-in-room.fail.no-results', { + room: roomFound.id, + }); + }); + it('should return error when incorrect intent', async () => { + const brain = { + addRoom: fake.returns(null), + removeRoom: fake.returns(null), + }; + const stateManager = new StateManager(event); + const deviceManager = new Device(event, messageManager, stateManager, {}); + const room = new Room(brain); + await room.create('test-house', { + name: 'No value Room', + }); + const roomFound = await room.getBySelector('no-value-room'); + const message = {}; + await deviceManager.humiditySensorManager.command( + message, + { + intent: 'humidity-sensor.get-in-rooom', + entities: [ + { + sourceText: 'no-value-room', + entity: 'room', + }, + ], + }, + { + room: roomFound.id, + }, + ); + assert.calledWith(messageManager.replyByIntent, message, 'humidity-sensor.get-in-room.fail', { + room: roomFound.id, + }); + }); +}); diff --git a/server/utils/constants.js b/server/utils/constants.js index c05997846c..8670c035d0 100644 --- a/server/utils/constants.js +++ b/server/utils/constants.js @@ -116,6 +116,9 @@ const EVENTS = { TEMPERATURE_SENSOR: { TEMPERATURE_CHANGED: 'temperature.changed', }, + HUMIDITY_SENSOR: { + HUMIDITY_CHANGED: 'humidity.changed', + }, SCHEDULED_SCENE: { ENABLED: 'scheduled-scene.enabled', DISABLED: 'scheduled-scene.disabled', @@ -241,6 +244,9 @@ const INTENTS = { TEMPERATURE_SENSOR: { GET_IN_ROOM: 'intent.temperature-sensor.get-in-room', }, + HUMIDITY_SENSOR: { + GET_IN_ROOM: 'intent.humidity-sensor.get-in-room', + }, WEATHER: { GET: 'intent.weather.get', TOMORROW: 'intent.weather.tomorrow', @@ -454,6 +460,7 @@ const DASHBOARD_TYPE = { const DASHBOARD_BOX_TYPE = { WEATHER: 'weather', TEMPERATURE_IN_ROOM: 'temperature-in-room', + HUMIDITY_IN_ROOM: 'humidity-in-room', USER_PRESENCE: 'user-presence', CAMERA: 'camera', DEVICES_IN_ROOM: 'devices-in-room',