Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

Turn on Sonos with triple click.


wesselvvvb

Question

I have a Sonos:AMP in my bathroom which I was not using that much because when I go into the bath or shower my phone often isn’t around to turn on the music.

So, It seemed handy to turn on the music (the existing playlist) with a triple click of my bathroom light switch. This is how I reached this goal:

 

  1. I installed the Sonos Plugin and I added my bathroom Sonos device 
  2. I downloaded and added the Sonos Virtual Device from Krikroff:

    Please login or register to see this link.

  3. Add a variable in the Variables Panel. I used this tutorial on Youtube:

    Please login or register to see this link.

  4. As I am still using Dimmer 1 (FGD-211), I turned on the Scene Activation functionality by putting parameter 41 on 1 in the advanced tab of my bathroom dimmer. If you use Dimmer 2 (FGD-212) you’ll have to put parameter 28 on 1 (no experience, so not sure).
  5. After that I build 3 scenes:
    1. First of all a scene to put on the Sonos on a specific volume level (where as 311 and 312 are the ID’s of the Sonos Plugin and Virtual Device):


--[[

%% properties

%% events

%% globals

--]]

 

-- Set volume of the Sonos plugin

fibaro:call(311, "setVolume", "40")

 

-- Press button 7 (play) of the Sonos Virtual Device

fibaro:call(312, "pressButton", "7")

    

    1. Second a scene to stop the Sonos player again:

 

    --[[

    %% properties

    %% events

    %% globals

    --]]

 

    -- Press button 9 (stop) of the Sonos Virtual Device

    fibaro:call(312, "pressButton", “9")

 

    1. Third, a scene to activate the scenes on a triple click:

 

    --[[

    %% properties

    12 sceneActivation 

    %% globals

    --]]

 

    local id= 12;  -- Change this to your dimmer ID

 

    if (tonumber(fibaro:getValue(id, "sceneActivation"))==15) and

      (tonumber(fibaro:getValue(id,"value"))==0) then 

      fibaro:debug("3click activated, Sonos bathroom ON"); 

      fibaro:setGlobal("Sleep", "1") -- Change this to your sleep variable(if you have one) 

      fibaro:startScene(278); -- or start a second scene 

    end 

    if (tonumber(fibaro:getValue(id, "sceneActivation"))==15) and

      (tonumber(fibaro:getValue(id,"value"))>0) then 

      fibaro:debug("3click activated, Sonos bathroom OFF"); 

      fibaro:setGlobal("Sleep", "1") -- Change this to your sleep variable(if you have one) 

      fibaro:startScene(279); -- or start a second scene

    end

 

    12 is the dimmer ID of the bathroom, 278 the ID of the scene to turn on Sonos and 279 to     turn off Sonos. 15 corresponds with triple click.

 

There is one issue I didn’t foresee (because I copied scene 3): scene 3 looks if dimmer 12 is on (>0) or off (=0) to decide whether to turn on or off the Sonos. This should obviously be: look whether the music is on or off to decide if it has to be turned on or off.

 

Somebody any suggestions to solve this? Any other suggestions to develop this solution further are welcome as well.

 

Thanks in advance.

 

Wesselvvvb

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

The topic has been moved from "

Please login or register to see this link.

" to "

Please login or register to see this link.

".

 

Temat został przeniesiony z "

Please login or register to see this link.

" do "

Please login or register to see this link.

".

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...