From 529866445cdc01c2ff28301c0c155e820956a072 Mon Sep 17 00:00:00 2001 From: bertrandda Date: Tue, 3 Dec 2024 22:46:28 +0100 Subject: [PATCH 1/5] Add volume setting to play notification --- front/src/config/i18n/de.json | 1 + front/src/config/i18n/en.json | 1 + front/src/config/i18n/fr.json | 1 + .../edit-scene/actions/PlayNotification.jsx | 21 +++++++++++++++++++ server/lib/device/device.setValue.js | 5 +++-- server/lib/scene/scene.actions.js | 2 +- server/models/scene.js | 4 ++++ .../services/airplay/lib/airplay.setValue.js | 7 ++++--- .../google-cast/lib/google_cast.setValue.js | 12 ++++++++++- server/services/sonos/lib/sonos.setValue.js | 5 +++-- .../airplay/lib/airplay.setValue.test.js | 4 ++-- .../lib/google_cast.setValue.test.js | 9 ++++++-- .../services/sonos/lib/sonos.setValue.test.js | 4 ++-- 13 files changed, 61 insertions(+), 15 deletions(-) diff --git a/front/src/config/i18n/de.json b/front/src/config/i18n/de.json index 5699ffef2a..f0afb1eebc 100644 --- a/front/src/config/i18n/de.json +++ b/front/src/config/i18n/de.json @@ -2021,6 +2021,7 @@ "description": "Diese Aktion lässt Gladys auf dem ausgewählten Lautsprecher sprechen.", "needGladysPlus": "Erfordert Gladys Plus, da die Text-to-Speech-APIs kostenpflichtig sind.", "deviceLabel": "Lautsprecher", + "volumeLabel": "Volumen", "textLabel": "Nachricht zum Sprechen auf dem Lautsprecher", "variablesExplanation": "Um eine Variable einzufügen, gib \"{{\" ein. Hinweis: Du musst vor diesem Block eine Variable in einer \"Letzten Zustand abrufen\"-Aktion definiert haben." } diff --git a/front/src/config/i18n/en.json b/front/src/config/i18n/en.json index 79fdb14478..c77eddbbbd 100644 --- a/front/src/config/i18n/en.json +++ b/front/src/config/i18n/en.json @@ -2021,6 +2021,7 @@ "description": "This action will make Gladys speak on the selected speaker.", "needGladysPlus": "Requires Gladys Plus as Text-To-Speech APIs are paid.", "deviceLabel": "Speaker", + "volumeLabel": "Volume", "textLabel": "Message to speak on the speaker", "variablesExplanation": "To inject a variable, type '{{ '. Note: You must have defined a variable beforehand in a 'Retrieve Last State' action placed before this message block." } diff --git a/front/src/config/i18n/fr.json b/front/src/config/i18n/fr.json index 0ba3a52b4a..56ed687d54 100644 --- a/front/src/config/i18n/fr.json +++ b/front/src/config/i18n/fr.json @@ -2021,6 +2021,7 @@ "description": "Cette action fera parler Gladys sur l'enceinte sélectionnée.", "needGladysPlus": "Nécessite Gladys Plus car les API de \"Text To Speech\" sont payantes.", "deviceLabel": "Enceinte", + "volumeLabel": "Volume", "textLabel": "Message à dire sur l'enceinte", "variablesExplanation": "Pour injecter une variable, tapez '{{ '. Attention, vous devez avoir défini une variable auparavant dans une action 'Récupérer le dernier état' placé avant ce bloc message." } diff --git a/front/src/routes/scene/edit-scene/actions/PlayNotification.jsx b/front/src/routes/scene/edit-scene/actions/PlayNotification.jsx index 96cb7eff9c..07d3bec503 100644 --- a/front/src/routes/scene/edit-scene/actions/PlayNotification.jsx +++ b/front/src/routes/scene/edit-scene/actions/PlayNotification.jsx @@ -26,6 +26,9 @@ class PlayNotification extends Component { console.error(e); } }; + updateVolume = e => { + this.props.updateActionProperty(this.props.columnIndex, this.props.index, 'volume', e.target.value); + }; updateText = text => { this.props.updateActionProperty(this.props.columnIndex, this.props.index, 'text', text); }; @@ -84,6 +87,24 @@ class PlayNotification extends Component { onChange={this.handleDeviceChange} /> +
+ + + +