more G-Labs products

Author Topic: Squeezebox on homegenie  (Read 10932 times)

March 02, 2015, 10:41:08 PM
Reply #15

igorrobertifoc

  • ***
  • Information
  • Full Member
  • Posts: 65
I don t know the state of the module (if is yes or no ) graphically .
Status.Level is not catch or I on t know what  :-X.

thx nolio
« Last Edit: March 02, 2015, 10:53:44 PM by igorrobertifoc »

March 03, 2015, 09:23:15 PM
Reply #16

nolio

  • *****
  • Information
  • Global Moderator
  • Posts: 544
I try by another way with the edition of widget (new one).
But i didn't succeed too ...
Did you try by this way ? (perhaps more luck)

It could be nice to have a simple widget with :
  • View of artist and song play
  • Volume control
  • Back/Forward tracks
And your part, a button to use the squeezebox as an alert system for the alarm.

March 03, 2015, 10:32:26 PM
Reply #17

igorrobertifoc

  • ***
  • Information
  • Full Member
  • Posts: 65
I don t know how to install. I try the update but it doesnt has upgrade avaiable.

My challenge  8) is basically start a radio when a motion is detected ( or when alarm is disarmed ) only during some period of the day.
I try (before the widget designer) to understand how to create a widget.. but take time.. and I tought to use virtual device to use standard widget  :P Maybe now is easier

I post a question about the management of period with the time table and dani has adviced to me to manage with virtual device.

http://www.homegenie.it/forum/index.php?topic=591.15
« Last Edit: March 03, 2015, 10:36:29 PM by igorrobertifoc »

March 07, 2015, 03:01:33 PM
Reply #18

dani

  • *****
  • Information
  • Global Moderator
  • Posts: 535
I add that line :
Program.Notify('"SqueezeBox","I run");
before the Pause(4) outside the if, and I get Notification every 4 secondes.
If you don't get it, you must see your source code other there., You can move that line until you don't get for see where is the bug.
And why do you create 2 Virtual switch ?

March 08, 2015, 10:45:26 AM
Reply #19

igorrobertifoc

  • ***
  • Information
  • Full Member
  • Posts: 65
Hi,
Now is ok, when I reinstalled the hgx it set the old ip of my pc.... The routine was blocked for this reason.  :-X

I added a new virtual device for the 'radio on motion' activation. I would like that radio play a streamed station when a motion is detected. The virtual device will be linked to the timetable scheduler.

I will add a 3 virtual switch with : play on alarm disarmed.


This is my idea and what I expect, but if someone has other ideas and opinion, for me would be great  ;D

Someone has a squeezebox at home?

March 08, 2015, 11:00:45 AM
Reply #20

igorrobertifoc

  • ***
  • Information
  • Full Member
  • Posts: 65
If someone want try to use squeezebox without a squeezebox (sorry for the word game ) there is an hack:

http://www.gerrelt.nl/RaspberryPi/wordpress/tutorial-stand-alone-squeezebox-server-and-player-for-bbq/

I would raccomend to buy one (I don t work at Logitech :) )

Bye

March 08, 2015, 02:45:04 PM
Reply #21

igorrobertifoc

  • ***
  • Information
  • Full Member
  • Posts: 65
I add some new code for link sensors state to Squeeze app:

On trigger Setup:
Code: [Select]
Program.AddFeature("Switch,Sensor,DoorWindow", "squeezebox.EnabledSensor", "Enable Squeezebox Activation");

and on the cycle:

Code: [Select]
if (Modules.InDomain("HomeAutomation.Squeezebox").WithAddress("2").Get().Parameter("Status.Level").Value == "100") {
      var squeezeModules = Modules.WithFeature("Squeezebox.EnabledSensor");
      squeezeModules.Each((module)=>{
          Program.Notify("SqueezeBox", module.Instance.Name);
        if (module.IsOfDeviceType("Switch,Sensor,DoorWindow"))
            {
             
            }
        return true; 
        }
                         
        );
  }

but when I active a sensor, the cycle doesn t catch this module.
Dani, can you help me? very thx
 

March 09, 2015, 06:42:52 AM
Reply #22

nolio

  • *****
  • Information
  • Global Moderator
  • Posts: 544
Someone has a squeezebox at home?
Yes i have. Server on my NAS and client on raspberry pi.

March 09, 2015, 08:12:39 AM
Reply #23

dani

  • *****
  • Information
  • Global Moderator
  • Posts: 535
I saw 2 problems in your code :
1 - You use try without catch instruction !
2 In the trigger code you declare squeezebox.EnabledSensor with minor letter at first position.and in the code you test with Major letter Squeezebox.EnabledSensor

In case of switch you must test Level with value 0 or 100
In case of sensor you must test Generic for motion with value 0 ou 255 I think.
In case of doorwindow I don't have that kind of module so I don't know with variable to test
« Last Edit: March 09, 2015, 08:24:06 AM by dani »

March 11, 2015, 12:02:17 PM
Reply #24

MickEE

  • *
  • Information
  • Newbie
  • Posts: 17
    • MikaelStenstrand.com
Nice to see others with interest of connecting HomeGenie with SqeezeBox :) I have SqeezeBox running in my apartment and would like to control from HomeGenie. At the moment I have only implemented hard-coded programs (in HomeGenie) that turns on/off the SqueezeBox players over HTTP, but would be great to have a dynamic way of controlling the players.

I try to find some time to test this approach out, and maybe I can contribute with something :P

March 16, 2015, 10:10:12 AM
Reply #25

NicoVermeir

  • ****
  • Information
  • Sr. Member
  • Posts: 122
    • My blog

Someone has a squeezebox at home?
been using one for the last couple of months, great system.
keeping a close eye on this thread :)

March 28, 2015, 03:03:26 PM
Reply #26

igorrobertifoc

  • ***
  • Information
  • Full Member
  • Posts: 65
Nice, we are a team  ;D
I would like to write a TO-DO list, please feel free to add code or requirement  ;) :

Functionality OK
- speaking functionality
- Radio start on sensor and time plan (almost OK)
- alarm functionality

Functionality nice to have
- Radio start on alarm disarmed
- Widget (for android too)
   - Choose radio stations
   - Start / Stop / On / Off / Volume
   - Configurations (on top)

Widget is my worst part, can some one help for this important part?

Bye

March 29, 2015, 11:38:56 AM
Reply #27

igorrobertifoc

  • ***
  • Information
  • Full Member
  • Posts: 65
Hello,
first version stable. Functionality alarm and radio on motion are OK.
I attach program and a little how to. My english is bad, if some one can correct it will be great.


March 30, 2015, 11:49:13 PM
Reply #28

nolio

  • *****
  • Information
  • Global Moderator
  • Posts: 544
I try to control with the use of the existing widget mediareceiver and add on your script :

In the trigger part :
Code: [Select]
Program.AddVirtualModule("HomeAutomation.Squeezebox", "3", "MediaReceiver", "homegenie/generic/mediareceiver");In the code part :
Code: [Select]
      switch(command)
      {
.............
        case "AvMedia.Play":
                Program.Notify("HomeAutomation.SqueezeBox", "yououououo");
        connectSqueeze(true);
          Squeeze("play");
                connectSqueeze(false);
                break;
case "AvMedia.Pause":
                Program.Notify("HomeAutomation.SqueezeBox", "yououououo 2");
        connectSqueeze(true);
          Squeeze("pause 1");
                connectSqueeze(false);
                break;
      }
and replace this :
Code: [Select]
TcpClient.SendMessage(MACPlayer + " " + command + "\n");By this one :
Code: [Select]
TcpClient.SendMessage(command + "\n");Because the first one doesn't work for me ...

Quick and dirty but it work for play/pause. Just the time to execute the command on the logitech server seems a little bit long (arround 10 secondes on my side). Perhaps, the use of WebAPI is quicker ...

I try with the WebAPI :
* Play : Net.WebService("http://"+remoteServer+":9090/status.html?p0=play").GetData();
* Pause : Net.WebService("http://"+remoteServer+":9090/status.html?p0=pause&p1=1").GetData();

But it doesn't seems quicker. I think it take 2 seconds but the server WebInterface take more time to update.
« Last Edit: March 30, 2015, 11:59:53 PM by nolio »

March 31, 2015, 12:35:57 AM
Reply #29

nolio

  • *****
  • Information
  • Global Moderator
  • Posts: 544
With the all command :
Code: [Select]
            case "AvMedia.Play":
        connectSqueeze(true);
          Squeeze("play");
                connectSqueeze(false);
                break;
case "AvMedia.Pause":
        connectSqueeze(true);
          Squeeze("pause 1");
                connectSqueeze(false);
                break;
case "AvMedia.Stop":
        connectSqueeze(true);
          Squeeze("stop");
                connectSqueeze(false);
                break;
case "AvMedia.Prev":
        connectSqueeze(true);
          Squeeze("button rew");
                connectSqueeze(false);
                break;
case "AvMedia.Next":
        connectSqueeze(true);
          Squeeze("button fwd");
                connectSqueeze(false);
                break;
case "AvMedia.SetMute":
        connectSqueeze(true);
          Squeeze("mixer muting toggle");
                connectSqueeze(false);
                break;
case "AvMedia.SetVolume":
        connectSqueeze(true);
          Squeeze("mixer volume "+reqs[3]);
                connectSqueeze(false);
                break;

And some missing one :
Code: [Select]
//AvMedia.GetTransportInfo //AvMedia.GetPositionInfo //AvMedia.GetVolume //AvMedia.GetMute