Hello to all,
i would like to connect my home music entertainment with Home genie.
Squeezebox is a internet radio and can play music saved on a server ( I installed on raspberry).
This server give the possibility to pilot remotely the radio. Others Home automation systems (openhab) i see that they implemented. I would like to trigget my presence with a surrounded music and play alarm sound.
So... i would like to implement .
On the server there is a XML that give you the status of the radio and the links to pilot the radio (turn on, off, volume, play song, play radio... ). I attach the xml downloaded but i don t know how to parse this file on automation.
Can someone help to extract just one information from the file ( i will complete the interface ) and how to add a button and a text in a widget?
Thank you very much
This is my base :
The trigger code:
// this Setup delegate will be executed once, when program become active
Program.Setup(()=>
{
// list the program as custom weather widget
Program.AddControlWidget( "music/squeezebox/LMS" );
// set input fields parameters
// <field_name>, <default_value>, <description>
Program.AddInputField("LMSServer", "192.168.192.19", "IP Address of Logitech Media Server");
Program.AddInputField("LMSPort", "9000", "Port of the server");
Program.AddInputField("MACPlayer", "00%3A04%3A20%3A29%3A62%3A10", "MacAddress of squeezebox player %3A for point");
Program.Parameter("squeezebox.Song").Value = "";
});
//
return true;
And the program code
while (Program.IsEnabled)
{
var LMSServer = Program.InputField("LMSServer").Value;
var LMSPort = Program.InputField("LMSPort").Value;
var MACPlayer = Program.InputField("MACPlayer").Value;
//
try
{
var serviceurl = "http://" + LMSServer + ":" + LMSPort + "/status.xml&player=" + MACPlayer;
dynamic geodata = Net.WebService(serviceurl).GetData();
//Program.Parameter("squeezebox.Song").Value = geodata.playingSong;
Program.Notify("Squeeze box updated", "Updated.");
}
catch (Exception ex)
{
Program.Notify("Squeezebox Error!", "Unable to get data from service " + "http://" + LMSServer + ":" + LMSPort + "/status.xml&player=" + MACPlayer);
Console.WriteLine(ex.Message + "\n" + ex.StackTrace);
}
//
Pause(10); // pause 24 hours before next check
}