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
Question
wesselvvvb 1
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:
Please login or register to see this link.
Please login or register to see this link.
--[[
%% 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")
--[[
%% properties
%% events
%% globals
--]]
-- Press button 9 (stop) of the Sonos Virtual Device
fibaro:call(312, "pressButton", “9")
--[[
%% 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.