[GH-ISSUE #29] Working function block inputs #7

Closed
opened 2026-02-27 19:27:53 +03:00 by kerem · 17 comments
Owner

Originally created by @mr-manuel on GitHub (Oct 11, 2025).
Original GitHub issue: https://github.com/lox-audioserver/lox-audioserver/issues/29

Could you add to the readme, which function block inputs are supported by this emulator with the different backends?

I'm searching for a replacement for MS4H and the only thing I'm missing currently is the TTS with the Music Assistant backend. Could be maybe tricky, since you would have to generate the audio file somewhere and then upload/play it.

Originally created by @mr-manuel on GitHub (Oct 11, 2025). Original GitHub issue: https://github.com/lox-audioserver/lox-audioserver/issues/29 Could you add to the readme, which [function block inputs](https://www.loxone.com/enen/kb/audio-player/#Input) are supported by this emulator with the different backends? I'm searching for a replacement for [MS4H](https://music-server.net/) and the only thing I'm missing currently is the TTS with the Music Assistant backend. Could be maybe tricky, since you would have to generate the audio file somewhere and then upload/play it.
kerem 2026-02-27 19:27:53 +03:00
Author
Owner

@rudyberends commented on GitHub (Oct 11, 2025):

I’m not entirely sure about this one yet. If it’s audio player related and not already supported, it will be implemented eventually.

I still need to look into the TTS functionality. Music Assistant supports playing announcements, which could be used for short sound effects (alarms, fire alarms, bells, buzzers) and also for TTS messages.
However, you do need a TTS engine that generates the audio file to send to Music Assistant. Home Assistant already supports this, but that would introduce an external dependency. We could also implement our own TTS generation.

There have been some discussions about noticeable delays when using TTS with Music Assistant, which I can definitely imagine being an issue. I’m also curious whether there’s a real use case for this feature.
Do you know of others who actively use it? If there’s enough interest, and if it proves usable without long delays, I might consider implementing it.

<!-- gh-comment-id:3393698182 --> @rudyberends commented on GitHub (Oct 11, 2025): I’m not entirely sure about this one yet. If it’s audio player related and not already supported, it will be implemented eventually. I still need to look into the TTS functionality. Music Assistant supports playing announcements, which could be used for short sound effects (alarms, fire alarms, bells, buzzers) and also for TTS messages. However, you do need a TTS engine that generates the audio file to send to Music Assistant. Home Assistant already supports this, but that would introduce an external dependency. We could also implement our own TTS generation. There have been some discussions about noticeable delays when using TTS with Music Assistant, which I can definitely imagine being an issue. I’m also curious whether there’s a real use case for this feature. Do you know of others who actively use it? If there’s enough interest, and if it proves usable without long delays, I might consider implementing it.
Author
Owner

@rudyberends commented on GitHub (Oct 12, 2025):

So, I looked into this feature request. I didn’t want to burden the audioserver with a full local TTS stack at first. However, while testing I stumbled onto Google’s lightweight TTS endpoint, which lets us outsource the speech synthesis entirely: the audioserver now sends the text to Google, caches the returned MP3, and feeds it straight to Music Assistant’s “play announcement” action. Coupled with MA’s built-in announcement support, the whole thing turned out to be surprisingly straightforward.

What’s new to test

  • git checkout feature/alerts-backend && git pull
  • Build/start the proxy as usual.
  • Fire grouped commands such as:
    • audio/grouped/tts/<zone>/<LANG|Your+Message> (e.g. audio/grouped/tts/14/ENG|Alarm+is+going+off)
    • audio/grouped/alarm/<zone> for a siren-style endless alert
    • audio/grouped/alarm/off/<zone> (or /buzzer, /firealarm) to stop it
  • Music Assistant receives either an announcement (speech/bell) or a looping track (alarms/buzzers).
  • All assets—bundled MP3s and cached TTS—live under public/alerts/, so nothing extra needs to be installed locally.

I’m still a little worried about the delays though. I don’t use these features myself, so I’ll let you decide whether it’s acceptable.

Give it a spin and let me know how it goes!

<!-- gh-comment-id:3394140341 --> @rudyberends commented on GitHub (Oct 12, 2025): So, I looked into this feature request. I didn’t want to burden the audioserver with a full local TTS stack at first. However, while testing I stumbled onto Google’s lightweight TTS endpoint, which lets us outsource the speech synthesis entirely: the audioserver now sends the text to Google, caches the returned MP3, and feeds it straight to Music Assistant’s “play announcement” action. Coupled with MA’s built-in announcement support, the whole thing turned out to be surprisingly straightforward. ### What’s new to test - `git checkout feature/alerts-backend && git pull` - Build/start the proxy as usual. - Fire grouped commands such as: - `audio/grouped/tts/<zone>/<LANG|Your+Message>` (e.g. `audio/grouped/tts/14/ENG|Alarm+is+going+off`) - `audio/grouped/alarm/<zone>` for a siren-style endless alert - `audio/grouped/alarm/off/<zone>` (or `/buzzer`, `/firealarm`) to stop it - Music Assistant receives either an announcement (speech/bell) or a looping track (alarms/buzzers). - All assets—bundled MP3s and cached TTS—live under `public/alerts/`, so nothing extra needs to be installed locally. > I’m still a little worried about the delays though. I don’t use these features myself, so I’ll let you decide whether it’s acceptable. Give it a spin and let me know how it goes!
Author
Owner

@mr-manuel commented on GitHub (Oct 12, 2025):

Wow, you are fast. I will test it later. How to choose between a male and female voice?

MS4H works exactly like that. The idea was not to integrate a full TTS software into the lox-audioserver but rather an integration of a popular TTS online service. In the future you could maybe add also support for a local TTS engine, which then can be installed in a separate Docker container. An example is https://github.com/coqui-ai/TTS.

Would it be maybe also possible to add Amazon Polly in addition to Google's TTS endpoint? I think that Polly has the most natural voice.

Here some screenshots of the MS4H setting for Ring, Alarm, Alarm Clock and TTS:

Image Image

Then as you see in the screenshot the TTS files are cached, so that you don't waste credits if you play the same sentence multiple times.

<!-- gh-comment-id:3394181805 --> @mr-manuel commented on GitHub (Oct 12, 2025): Wow, you are fast. I will test it later. How to choose between a male and female voice? MS4H works exactly like that. The idea was not to integrate a full TTS software into the lox-audioserver but rather an integration of a popular TTS online service. In the future you could maybe add also support for a local TTS engine, which then can be installed in a separate Docker container. An example is https://github.com/coqui-ai/TTS. Would it be maybe also possible to add Amazon Polly in addition to Google's TTS endpoint? I think that Polly has the most natural voice. Here some screenshots of the MS4H setting for Ring, Alarm, Alarm Clock and TTS: <img width="1433" height="755" alt="Image" src="https://github.com/user-attachments/assets/6e0ce900-53be-4b06-9605-84985152b97d" /> <img width="1435" height="658" alt="Image" src="https://github.com/user-attachments/assets/11259434-a9ec-4c19-9c71-b89e984712d1" /> Then as you see in the screenshot the TTS files are cached, so that you don't waste credits if you play the same sentence multiple times.
Author
Owner

@mr-manuel commented on GitHub (Oct 12, 2025):

I'm not able to correctly test it. The manual generation of TTS files is working via HTTP GET, but the JSON response contains an invalid url value. Since I'm using Docker and the Music Assistant is not a Docker container, it cannot reach the IP address that is provided in the JSON response. Therefore I would need to provide the IP address of the Docker host in the JSON response to make it work properly.

Current response

{
  "groupalert_result": [
    {
      "success": true,
      "type": "tts",
      "action": "start",
      "source": "tts",
      "media": "cache/tts-fd06240ddf34d1ff7b8cebaa36def4951bf2707b.mp3",
      "language": "en",
      "textLength": 14,
      "url": "http://172.18.0.17:7091/alerts/cache/tts-fd06240ddf34d1ff7b8cebaa36def4951bf2707b.mp3",
      "looping": false,
      "targets": [
        13
      ],
      "commands": [
        {
          "zone": 13,
          "command": "announce"
        }
      ],
      "skipped": []
    }
  ],
  "command": "audio/grouped/tts/13/EN|This+is+a+test"
}

Needed response

{
  "groupalert_result": [
    {
      "success": true,
      "type": "tts",
      "action": "start",
      "source": "tts",
      "media": "cache/tts-fd06240ddf34d1ff7b8cebaa36def4951bf2707b.mp3",
      "language": "en",
      "textLength": 14,
      "url": "http://192.168.1.110:7091/alerts/cache/tts-fd06240ddf34d1ff7b8cebaa36def4951bf2707b.mp3",
      "looping": false,
      "targets": [
        13
      ],
      "commands": [
        {
          "zone": 13,
          "command": "announce"
        }
      ],
      "skipped": []
    }
  ],
  "command": "audio/grouped/tts/13/EN|This+is+a+test"
}
<!-- gh-comment-id:3395211162 --> @mr-manuel commented on GitHub (Oct 12, 2025): I'm not able to correctly test it. The manual generation of TTS files is working via HTTP GET, but the JSON response contains an invalid `url` value. Since I'm using Docker and the Music Assistant is not a Docker container, it cannot reach the IP address that is provided in the JSON response. Therefore I would need to provide the IP address of the Docker host in the JSON response to make it work properly. ### Current response ```json { "groupalert_result": [ { "success": true, "type": "tts", "action": "start", "source": "tts", "media": "cache/tts-fd06240ddf34d1ff7b8cebaa36def4951bf2707b.mp3", "language": "en", "textLength": 14, "url": "http://172.18.0.17:7091/alerts/cache/tts-fd06240ddf34d1ff7b8cebaa36def4951bf2707b.mp3", "looping": false, "targets": [ 13 ], "commands": [ { "zone": 13, "command": "announce" } ], "skipped": [] } ], "command": "audio/grouped/tts/13/EN|This+is+a+test" } ``` ### Needed response ```json { "groupalert_result": [ { "success": true, "type": "tts", "action": "start", "source": "tts", "media": "cache/tts-fd06240ddf34d1ff7b8cebaa36def4951bf2707b.mp3", "language": "en", "textLength": 14, "url": "http://192.168.1.110:7091/alerts/cache/tts-fd06240ddf34d1ff7b8cebaa36def4951bf2707b.mp3", "looping": false, "targets": [ 13 ], "commands": [ { "zone": 13, "command": "announce" } ], "skipped": [] } ], "command": "audio/grouped/tts/13/EN|This+is+a+test" } ```
Author
Owner

@rudyberends commented on GitHub (Oct 12, 2025):

If you have access to the data directory, you will find the IP of the Audioserver in the config.json. You can manually change this and restart the server. It will then use this IP.

For final release I will make this configurable in webinterface.

<!-- gh-comment-id:3395225134 --> @rudyberends commented on GitHub (Oct 12, 2025): If you have access to the data directory, you will find the IP of the Audioserver in the config.json. You can manually change this and restart the server. It will then use this IP. For final release I will make this configurable in webinterface.
Author
Owner

@mr-manuel commented on GitHub (Oct 12, 2025):

Searching through the code, I found out, that I can set the environment variable ALERTS_HOST to solve this.

github.com/rudyberends/lox-audioserver@4442383a53/src/backend/alerts/alertService.ts (L345)

<!-- gh-comment-id:3395225354 --> @mr-manuel commented on GitHub (Oct 12, 2025): Searching through the code, I found out, that I can set the environment variable `ALERTS_HOST` to solve this. https://github.com/rudyberends/lox-audioserver/blob/4442383a530bc852bfbf8a4700958d8051c69109/src/backend/alerts/alertService.ts#L345
Author
Owner

@rudyberends commented on GitHub (Oct 12, 2025):

Yes, that will also work

<!-- gh-comment-id:3395226039 --> @rudyberends commented on GitHub (Oct 12, 2025): Yes, that will also work
Author
Owner

@mr-manuel commented on GitHub (Oct 12, 2025):

The TTS works very well! How does it select the language, if the TTS is triggered via the function block?

The Alarm, FireAlarm, Bell and Buzzer do not work yet how they should. They should only play as log as the function block input is on 1, if the input then returns to 0 the previous state should be recovered (player off or music playing). Probably it would be good to implement a minimum playback time of some seconds, in case there was only a short trigger on the function block. Like play the alarm only once and do not loop it.

Very nice work!

<!-- gh-comment-id:3395279984 --> @mr-manuel commented on GitHub (Oct 12, 2025): The TTS works very well! How does it select the language, if the TTS is triggered via the function block? The `Alarm`, `FireAlarm`, `Bell` and `Buzzer` do not work yet how they should. They should only play as log as the function block input is on `1`, if the input then returns to `0` the previous state should be recovered (player off or music playing). Probably it would be good to implement a minimum playback time of some seconds, in case there was only a short trigger on the function block. Like play the alarm only once and do not loop it. Very nice work!
Author
Owner

@rudyberends commented on GitHub (Oct 12, 2025):

Miniserver calls the url like this;

audio/grouped/tts/14/ENG|Alarm+is+going+off

Where Loxone automatically sets the correct language.

I will adjust the other events like you described.

<!-- gh-comment-id:3395303834 --> @rudyberends commented on GitHub (Oct 12, 2025): Miniserver calls the url like this; audio/grouped/tts/14/ENG|Alarm+is+going+off Where Loxone automatically sets the correct language. I will adjust the other events like you described.
Author
Owner

@mr-manuel commented on GitHub (Oct 13, 2025):

When I try to play a TTS on all zones at the same time the system goes crazy. It plays instantly on the first player in the list and then in the next seconds it plays on one player after the other. In total I have 7 audio zones/players. Could it be, that either lox-audioserver or Music Assistant is not able to handle multiple commands at once?

I tried:

  • Send a TTS to two audio function blocks at the same time
  • Send a TTS to one central audio function block that includes both audio players

The goal would be to play an Alarm, FireAlarm, Bell, Buzzer and TTS event in sync on multiple selected players as an announcement in Music Assistant.

Maybe grouping over the Loxone app would solve this issue?

<!-- gh-comment-id:3397597829 --> @mr-manuel commented on GitHub (Oct 13, 2025): When I try to play a TTS on all zones at the same time the system goes crazy. It plays instantly on the first player in the list and then in the next seconds it plays on one player after the other. In total I have 7 audio zones/players. Could it be, that either lox-audioserver or Music Assistant is not able to handle multiple commands at once? I tried: - Send a TTS to two audio function blocks at the same time - Send a TTS to one central audio function block that includes both audio players The goal would be to play an `Alarm`, `FireAlarm`, `Bell`, `Buzzer` and `TTS` event in sync on multiple selected players as an announcement in Music Assistant. Maybe grouping over the Loxone app would solve this issue?
Author
Owner

@mr-manuel commented on GitHub (Nov 2, 2025):

With v3 we made a few steps back.

The TTS works very well!

TTS does not work anymore.

[2025-11-02 20:24:47.628][debug] [LoxoneHttp][msHttp] WS message: audio/grouped/tts/13/DEU|Dies ist ein Test der über Loxone gestartet wurde.
[2025-11-02 20:24:47.628][debug] [LoxoneHttp][msHttp] Command: audio/grouped/tts/13/DEU|Dies ist ein Test der über Loxone gestartet wurde.
[2025-11-02 20:24:47.628][debug] [RequestHandler] Received command: audio/grouped/tts/13/DEU|Dies ist ein Test der über Loxone gestartet wurde.
[2025-11-02 20:24:47.628][info] [AlertsManager] ON alert "tts" for leader 13
[2025-11-02 20:24:47.629][debug] [GoogleTtsProvider] Using cached TTS: tts-7f90239972fd8c5f7f1f7e15263aedef8f5ca103.mp3
[2025-11-02 20:24:47.629][debug] [AlertsManager] Using announce (looped=false) → http://10.4.4.203:7090/alerts/cache/tts-7f90239972fd8c5f7f1f7e15263aedef8f5ca103.mp3
[2025-11-02 20:24:47.629][info] [ZoneRuntime][07 Manu's Büro] → announce ["alerts","http://10.4.4.203:7090/alerts/cache/tts-7f90239972fd8c5f7f1f7e15263aedef8f5ca103.mp3"]
[2025-11-02 20:24:47.629][debug] [ZoneRuntime][07 Manu's Büro] Command not handled by mapper.
[2025-11-02 20:24:47.629][info] [AlertsManager] Alert "tts" started via announce on zone 13

From the logs it seems fine, but there was no TTS played.

The Alarm, FireAlarm, Bell and Buzzer do not work yet how they should. They should only play as log as the function block input is on 1, if the input then returns to 0 the previous state should be recovered (player off or music playing). Probably it would be good to implement a minimum playback time of some seconds, in case there was only a short trigger on the function block. Like play the alarm only once and do not loop it.

This does not work anymore. It's not an announcement anymore and it does not stop when it turns 0 again.

Maybe there is a common issue with announcements that causes both (TTS and alerts) to fail.

<!-- gh-comment-id:3478266761 --> @mr-manuel commented on GitHub (Nov 2, 2025): With v3 we made a few steps back. > The TTS works very well! TTS does not work anymore. ``` [2025-11-02 20:24:47.628][debug] [LoxoneHttp][msHttp] WS message: audio/grouped/tts/13/DEU|Dies ist ein Test der über Loxone gestartet wurde. [2025-11-02 20:24:47.628][debug] [LoxoneHttp][msHttp] Command: audio/grouped/tts/13/DEU|Dies ist ein Test der über Loxone gestartet wurde. [2025-11-02 20:24:47.628][debug] [RequestHandler] Received command: audio/grouped/tts/13/DEU|Dies ist ein Test der über Loxone gestartet wurde. [2025-11-02 20:24:47.628][info] [AlertsManager] ON alert "tts" for leader 13 [2025-11-02 20:24:47.629][debug] [GoogleTtsProvider] Using cached TTS: tts-7f90239972fd8c5f7f1f7e15263aedef8f5ca103.mp3 [2025-11-02 20:24:47.629][debug] [AlertsManager] Using announce (looped=false) → http://10.4.4.203:7090/alerts/cache/tts-7f90239972fd8c5f7f1f7e15263aedef8f5ca103.mp3 [2025-11-02 20:24:47.629][info] [ZoneRuntime][07 Manu's Büro] → announce ["alerts","http://10.4.4.203:7090/alerts/cache/tts-7f90239972fd8c5f7f1f7e15263aedef8f5ca103.mp3"] [2025-11-02 20:24:47.629][debug] [ZoneRuntime][07 Manu's Büro] Command not handled by mapper. [2025-11-02 20:24:47.629][info] [AlertsManager] Alert "tts" started via announce on zone 13 ``` From the logs it seems fine, but there was no TTS played. > The `Alarm`, `FireAlarm`, `Bell` and `Buzzer` do not work yet how they should. They should only play as log as the function block input is on `1`, if the input then returns to `0` the previous state should be recovered (player off or music playing). Probably it would be good to implement a minimum playback time of some seconds, in case there was only a short trigger on the function block. Like play the alarm only once and do not loop it. This does not work anymore. It's not an announcement anymore and it does not stop when it turns `0` again. Maybe there is a common issue with announcements that causes both (TTS and alerts) to fail.
Author
Owner

@rudyberends commented on GitHub (Nov 2, 2025):

I have this working in a test version, but I now use grouped players to send alerts. The only thing is that I can only get It stable on MA versions > 2.7 and that is in beta right now. State changes on those betas are different. I will come back on this. First I want to have stable group support and I will build on that

<!-- gh-comment-id:3478331113 --> @rudyberends commented on GitHub (Nov 2, 2025): I have this working in a test version, but I now use grouped players to send alerts. The only thing is that I can only get It stable on MA versions > 2.7 and that is in beta right now. State changes on those betas are different. I will come back on this. First I want to have stable group support and I will build on that
Author
Owner

@mr-manuel commented on GitHub (Nov 2, 2025):

What are grouped players in your case? You use a Loxone function block Central Audio (Audio Zentral), select your players there and then you send the command on this function block?

Like this?

Image

I would also test it with MA > 2.7, no problem, but if you want to wait, it's also fine for me.

In the meanwhile can you make the bell work in some way? It's no problem, if it's not an announcement right now, it would only be nice that at least I hear, if someone rings at the door, no matter how :)

<!-- gh-comment-id:3478343314 --> @mr-manuel commented on GitHub (Nov 2, 2025): What are grouped players in your case? You use a Loxone function block `Central Audio (Audio Zentral)`, select your players there and then you send the command on this function block? Like this? <img width="780" height="462" alt="Image" src="https://github.com/user-attachments/assets/2bc9955e-3d25-4598-8f38-befa9381dd9a" /> I would also test it with MA > 2.7, no problem, but if you want to wait, it's also fine for me. In the meanwhile can you make the bell work in some way? It's no problem, if it's not an announcement right now, it would only be nice that at least I hear, if someone rings at the door, no matter how :)
Author
Owner

@rudyberends commented on GitHub (Nov 5, 2025):

bell should work in testing

<!-- gh-comment-id:3492889841 --> @rudyberends commented on GitHub (Nov 5, 2025): bell should work in testing
Author
Owner

@mr-manuel commented on GitHub (Nov 6, 2025):

Works in testing again thanks.

<!-- gh-comment-id:3496291384 --> @mr-manuel commented on GitHub (Nov 6, 2025): Works in testing again thanks.
Author
Owner

@rudyberends commented on GitHub (Dec 29, 2025):

what should we do with this one? I will close it for now. Test against the new release when its available so you can open new issue?

<!-- gh-comment-id:3695789059 --> @rudyberends commented on GitHub (Dec 29, 2025): what should we do with this one? I will close it for now. Test against the new release when its available so you can open new issue?
Author
Owner

@mr-manuel commented on GitHub (Dec 29, 2025):

Fine for me, thanks!

<!-- gh-comment-id:3697009919 --> @mr-manuel commented on GitHub (Dec 29, 2025): Fine for me, thanks!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/lox-audioserver#7
No description provided.