Hi I am trying to setup a configuration where Homeseer plays a mp3 sound to the Up2Stream over wifi, by a .vb script.
The .vb script is something like:
Dim playURL As String = “http://” & ampIP & “/httpapi.asp?command=setPlayerCmd:play:http://” & hsServer & “ding.mp3”
client.DownloadString(playURL)
Is seems to work ok , but only after the second try.
I did try to play a “1-second-of-silence.mp3” before but that was not enough…
I really would like to know why the command must be triggered twice.
The first command may be switching or initializing the Up2Stream’s network player, while the second command arrives after the player is ready. Playing a silent file first is therefore unreliable—it produces the same race condition.
I would make the sequence explicit:
- Switch the Up2Stream to Wi-Fi/network mode.
- Allow a short delay for the player to initialize.
- Send the MP3 playback command once.
Also make sure the nested MP3 URL is properly URL-encoded. For example:
Dim ampBase As String = "http://" & ampIP
Dim mp3Url As String = "http://" & hsServer.TrimEnd("/"c) & "/ding.mp3"
Using client As New Net.WebClient()
client.DownloadString(
ampBase & "/httpapi.asp?command=setPlayerCmd:switchmode:wifi"
)
Threading.Thread.Sleep(750)
Dim command As String =
"setPlayerCmd:play:" & Uri.EscapeDataString(mp3Url)
Dim result As String =
client.DownloadString(
ampBase & "/httpapi.asp?command=" & command
)
End Using
Arylic also has a command specifically intended for notification sounds:
playPromptUrl:<MP3 URL>
That is preferable when you want a doorbell or announcement to interrupt existing network playback and then return to it. However, it only works while the Up2Stream is already in network or USB playback mode, so it may still require the initial switchmode:wifi step when the device has been idle or using Bluetooth, Line-In or another source.
Example:
Dim mp3Url As String = "http://" & hsServer.TrimEnd("/"c) & "/ding.mp3"
Dim command As String =
"playPromptUrl:" & Uri.EscapeDataString(mp3Url)
client.DownloadString(
"http://" & ampIP &
"/httpapi.asp?command=" & command
)
A few other checks:
- Confirm there is a
/ before ding.mp3.
- Test the MP3 URL from another device on the same network.
- Make sure the HomeSeer server permits unauthenticated access from the Up2Stream.
- Avoid redirects, HTTPS certificate issues and session-based URLs.
- Return the file with an appropriate audio MIME type such as
audio/mpeg.
- Log the response from both API calls rather than assuming
DownloadString() means playback started.
If the explicit mode change plus delay fixes it, the problem was player initialization. If it still requires two play commands, increase the delay temporarily to 1.5–2 seconds and query getPlayerStatus or getStatusEx before sending the MP3 instead of relying on a fixed delay.