fix announcement (#9155)

Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
This commit is contained in:
J-N-K 2020-11-28 13:10:19 +01:00 committed by GitHub
parent 7130886d22
commit 9211248f96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 3 deletions

View File

@ -584,7 +584,7 @@ Expert:
You can use a json formatted string to control title, sound and volume:
```php
{ "sound": true, "speak":"<Speak>" "title": "<Title>", "body": "<Body Text>", "volume": 20}
{ "sound": true, "speak":"<Speak>", "title": "<Title>", "body": "<Body Text>", "volume": 20}
```
The combination of `sound=true` and `speak` in SSML syntax is not allowed.

View File

@ -1355,8 +1355,7 @@ public class Connection {
JsonAnnouncementContent[] contentArray = new JsonAnnouncementContent[1];
JsonAnnouncementContent content = new JsonAnnouncementContent();
content.display.title = title == null || title.isEmpty() ? "openHAB" : title;
content.display.body = bodyText;
content.display.body = speak.replaceAll("<.+?>", " ").replaceAll("\\s+", " ").trim();
content.display.body = bodyText.replaceAll("<.+?>", " ").replaceAll("\\s+", " ").trim();
if (speak.startsWith("<speak>") && speak.endsWith("</speak>")) {
content.speak.type = "ssml";
}