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
Search the Community
Showing results for tags 'sonos'.
-
Hi, Here is a project to create a dedicated sonos room remote using a minimote remote control. One of my kids asked if they could have a simple remote for the sonos player in their bedroom and this is what I created I use the sonos-http-api but I'm sure it could be adapted for the other methods to control sonos with the HC2 This is what we are creating ... 4 single press functions pre-programed Vol-, Vol+ are self explanatory PlayPause - this cycles between play and pause. If no music is selected (like just after a player powers up) then this button will select one of the radio favourites and start playing Favorites - allows you to cycle through your radio favorites with each button press.(more on this later) 4 long press functions can be programed These can be anything from starting a scene to selecting line in In the remote I created, the ling press functions are Sat Line In, ungroup zone, start Bedtime scene and one empty. Lets get started..... The solution has two parts A scene to interpret the button press and direct them to a VD Both scene and the VD are included at he bottom of the post. I use the one scene to interpret two minimote remote controls so adjust as you see fit You only need one scene even if you use multiple remotes/rooms and but you will need one VD per room If you don't use a HomeTable, please comment out this line wherever you see it local jT = json.decode(fibaro:getGlobalValue("HomeTable")) SCENE CONFIGURATION At the start of the scene amend with the ID of your minimote device id's to trigger the scene --[[ %% properties 851 sceneActivation 856 sceneActivation %% events %% globals --]] Adjust the references to the target Sonos RC VD(s) sonosVD1 = jT.vd.OfficeSonosRC sonosVD2 = jT.vd.GuestSonosRC Adjust the reference (851 below) to the remote at the start of each remote block of code if startSource["type"] == "property" and devID == 851 then And that's it for the scene..... VD CONFIGURATION This VD has the 4 single press functions programmed and the place to program the 4 long button presses as well Import the VD and add the IP address and port (probably 5005) of your sonos-htti-api and name and select room accordingly In the code for Button 1 to 4 amend the sonos player name to suit your player local zone = "Office" Button 4 contains a table with your favorites Amend the name in quotes in the table to match your sonos setup fav = {[1] = "4FM", [2] = "96FM", [3] = "Calm", [4] = "Heart", [5] = "Red_FM"} The code cycles through 5 favorites but can easily be adjusted to cycle through less or more You also need a place to store the current favorite and I use my Hometable for this by adding a entry to the respective room Add the highlighted entry to each room you have a remote for. Adjust the Button 4 code to match this reference local f = tonumber(jT.office.RadFav) + 1 if f > 5 then f = 1 end jT.office.RadFav = f fibaro:setGlobal("HomeTable", json.encode(jT)) s = Net.FHttp(ipaddress, port) r = s:GET("/"..zone.."/favorite/"..fav[f].."") If you don't use a HomeTable contact me and I'll help you create a global to do the same thing The final part is then to add functions to Buttons 5 to 8 that represent long presses of buttons 1-4 You don't need to if you don't want to I created these icons - There not great and if somebody has another one I'll gladly swap out for VD for Scene That's it Hopefully this will be of use to a couple of forum users, _af Minimote Sonoc RC.lua Office_Sonos_RC.vfib
-
I want to control SONOS through VD on HC2, but recently I found that after Sonos update, VD can not be used, what to do?
-
Has anyone a solution to silent playing sound devices, when a telephone is ringing?
-
How can I control Sonos using the Fibaro KeyFob
yajean posted a question in Other Devices / Third-party devices
Hi There, I am trying to figure out a way to use the new fibaro keyfob to control my sonos system. The type of functions I am thinking are on/off and volume up/down only. From what I understand you cant use the keyfob to control plugins but you can control scenes. To control Sonos via a scene I understand a Virtual Device would need to setup for SOnos which I have now done successfully. My question now is how do I create a scene using LUA code to control the Sonos VD? Is there a better way to do this? Im sure there should be an easier way??? -
Hi Re-coded my Sonos status VD into a more generic table based VD This VD monitorsd and displays status of Sonos devices (OFFLINE, STATE (PLAYING, STOPPED, ETC & VOLUME) Notification options for when a player goes offline and back online and is configurable (Smart Message Hub or HC2 email) One Alert will be received when player goes offline and another when it comes back online Online/Offline status is captured in global table (SonosTable) that can be used by other scenes and VD's ** YOU NEED TO BE USING THE SONOS-HTTP-API FOR THIS VD ** ** YOU NEED TO BE USING THE WWWAPI MONITOR FOR THIS VD ** ==INSTALLATION STEPS == - Import the Sonos Monitor 1.0 virtual device, add IP and Port of sonos API on VD General Tab - Status heading and one sonos player label (Label1) has been created as part of the VD - it will created a global variabnle called SonosTable - Add one label per extra sonos payers you have using the default label naming (Lable2, Lable3, Label4, etc) - Populate the sonos table with Player (what player is called in sonos) and Room (room name in HC2) - Run VD with updateData = "true" to populate the device table. Open debug window and you shold see - "Sonos Table successfully Updated" followed by which sonos players are online - Run VD with updateData = "false" to operate in normal mode - Enable Debug = true to see status in debug window VD attached below Suggested icon Sonos_Monitor_1.0.vfib
-
Hi Forum, The native skill for sonos is now available from Sonos There are also updates for the system and for all the controller platforms (android, desktop, iOS) To enable the skill you will need a Sonos account which you should have created with the last Sonos update. Log into your Alexa account and find the and enable the Sonos Skill This will redirect you to you Sonos account to get your permission to link to your sonos system You will then be redirected back to the alexa account to discover your sonos devices after discovery you will see the list of players List of voice commands (thanks @speedy) SiriusXM You can initiate playback from any service using the Sonos app, and basic playback commands, such as play/pause, volume and skip, will continue to work. Spotify users: The ability to ask Alexa to play Spotify music on your Sonos speakers is not yet available, but is coming soon. General playback commands Alexa, pause/stop/resume in the (room name) Alexa, pause/stop/resume the music in the (room name) Alexa, skip/next in the (room name) Alexa, play the next/previous song/track in the (room name) Alexa, pause Alexa, resume on (room name) Alexa, next song/track Alexa, previous song/track Alexa, stop Alexa, skip Alexa, skip song/track Alexa, what's playing in (room name)? Note: Skip and previous cannot be used with TuneIn radio, and previous will not work on Pandora and iHeartRadio. General volume commands Alexa, turn it up/down in the (room name) Alexa, louder/quieter in the (room name) Alexa, set the volume to 3 (30%) in the (room name) [0-10 volume levels] Alexa, softer in the (room name) Alexa, mute the (room name) Alexa, unmute the (room name) Note: Volume commands will only affect the player the command is directed to. If the player is grouped, the group volume will not be adjusted. To start Amazon Music playback Alexa, play music in the (room name) (Alexa will select music) Alexa, play (artist) in the (room name) Alexa, play (song name) by (artist) in the (room name) Alexa, play (artist) on Pandora in the (room name) Alexa, play the album (album name) by (artist) in the (room name) Alexa, play (activity) music in the (room name) To start TuneIn playback Alexa, play (TuneIn station/radio call sign) in the (room name) Alexa, put on (TuneIn station/radio call sign) in the (room name) Alexa, start playing (TuneIn station/radio call sign) in the (room name) To start Pandora playback Alexa, put on (station of your choice) on/from Pandora in the (room name) Alexa, play (station of your choice) on/from Pandora in the (room name) If Pandora is setup as your default service in the Alexa app: Alexa, play (station of your choice) in the (room name) To start iHeartRadio playback Alexa, play (station of your choice) on/from iHeartRadio in the (room name) Alexa, put on (station of your choice) on/from iHeartRadio in the (room name) If iHeartRadio is setup as your default service in the Alexa app: Alexa, play (station of your choice) in the (room name) To start SiriusXM playback Alexa, put on (station of your choice) on/from SiriusXM in the (room name) Alexa, play (station of your choice) on/from SiriusXM in the (room name) The new Sonos One has the Alexa skill built in. Details can be found here http://www.sonos.com/en-us/shop/one.html?utm_source=prospects&utm_medium=email&utm_content=hero-US&utm_campaign=sonosone
-
Hi. I have a fibaro HC Lite and have recently bought a Sonos Play:1. I would like to use the double click of my kitchen light switch to 'play' the speaker and then again to pause it.I've installed the plugin and have it working but I cannot see the device when in the graphical blocks scene builder, nor is it showing as a virtual device.I also tried to get the hcl virtual device to import but it just kept on saying doesn't support LUA code. Even though it was the specific home centre lite virtual device control plugin from the fibaro website.What am I doing wrong? Any advice would be greatly appreciated as I only bought the play:1 as it works with FibaroCheers,Steve
-
Hi, I'm fairly new to Fibaro. Sorry if this question was asked before. Have managed to set up Hue (also with VD) and now I'm trying to link up my Sonos Play:1 using the fibaro plugin. However when entering the Sonos IP adres, the Play:1 cannot be found. Get an error message saying : Unfortunately there are no results for device search. Any idea what I'm doing wrong ? Thanks in advance. D.
-
Hello anyone, I added Sonos Player 1 and Sonos Player to Home Center 2 but I can't create scenes for it because I don't have link for music. You can help you.
-
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: I installed the Sonos Plugin and I added my bathroom Sonos device I downloaded and added the Sonos Virtual Device from Krikroff: http://www.fibarouk.co.uk/resources/VirtualDevices/SonosPlayer-0.0.8.zip Add a variable in the Variables Panel. I used this tutorial on Youtube: https://www.youtube.com/watch?v=ps9jNiJ_JeU 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). After that I build 3 scenes: 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") 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") 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
- 1 reply
-
- sonos
- triple click
-
(and 3 more)
Tagged with:
-
Hi All, I'm new to all of this, Have a HC2 , also have a Harmony Remote along with a few sono's speakers. I was looking to create my first scene using the Motion sensor to essentially play music on my sonos if it gets triggered during certain times of the day, however everytime i try creating a scene the Sonos device doesnt show up, nor does any of my Harmony remote options ? I'm assuming i'm doing something wrong or does this kind of stuff need to be done via LUA (i can't code btw- but might have to start learning)
-
Sonos has started recruiting BETA Testers for August and from the questionaire, it seems clear that we will finally see SONOS integration with Amazon Echo and Echo Dot. This same questionaire asked whether one has "home automation" and things like NEST and VERA were on the list but not Fibaro
-
Does anybody have any experience with the Russound or Sonos plugins for HC2? I am looking to use either the Russound Xzone4 or multiple Sonos Connect:Amps as a multiroom audio solution but I am very concerned about plugin functionality as any other Fibaro multimedia plugin I have tried failed miserably. I realize I could create or use a VD to accomplish this but I am interested in knowing what functionality, if any, the native plugins provide. Any experiences or screenshots would be greatly appreciated. Thanks guys!
-
- multi-room audio
- sonos
-
(and 1 more)
Tagged with:
-
[VD] Sonos Players Status {v1.0} - 3 step setup.
AutoFrank posted a question in Scenes and Interface
Hi, If you are using the sonos-api then you may find this very easy to use VD helpful It will display the status and volume of each player as well as a house summary of how many are active The VD below is setup for two zones and is very easy to expand. Three Step setup 1) Import the VD, amend the IP address for your sonos-api device (port should be fine) and save 2) Add extra players to the table at line 10 (keep name the same as your sonos player/zone name) players = {"Kitchen", "LivingRoom"} 3) Add extra labels for each extra player/zone and save. (keep default label format which is Label3, Label4, etc) Enjoy !! -f FILES Sonos Players Status {v1.0} -----------------------------> Sonos_Players_Status.vfib -
What is the syntax of sonos "text-to-speech" function in lua?
-
Hi When I try to import a vfib file I get this error "403" access forbidden. Any clues ?
-
Hi Bought a new sonos 5 II today and every thing working fine whith my iphone, but when i would like to connect it to Fibaro it doesnt work The sonos 5 is connected with wifi and i have recerved a IP for it, so it will not change Problem 1 i am loading sonos plugin 1.0 at fibaro HC2 4.100 . Then i press search i get " Unfortunately there are no results for device search " If i point the plugin direct to IP (not searching) it will connect and i got the basic functions (play pause volume ...) Problem 2 I am trying to configure the VD from Krikroff pointing the VD to "ip" and port 80 (i can ping sonos speaker) In debug mode the logg says "comunication error" [DEBUG] 09:37:38: ------------------------------------------------------------------------- [DEBUG] 09:37:38: -- HC2 Toolkit Framework version 1.0.6 [DEBUG] 09:37:38: -- Current interpreter version is Lua 5.1 [DEBUG] 09:37:38: -- Total memory in use by Lua: 226.89 Kbytes [DEBUG] 09:37:38: ------------------------------------------------------------------------- [DEBUG] 09:37:38: Toolkit.Debug loaded in memory... [DEBUG] 09:37:38: Benchmark [Toolkit.Debug lib]: elapsed time: 0.000 cpu secs [DEBUG] 09:37:38: Toolkit.Collections.Queue loaded in memory... [DEBUG] 09:37:38: Benchmark [Toolkit.Collections.Queue lib]: elapsed time: 0.000 cpu secs [DEBUG] 09:37:38: Toolkit.Net loaded in memory... [DEBUG] 09:37:38: Benchmark [Toolkit.Net lib]: elapsed time: 0.000 cpu secs [DEBUG] 09:37:38: Toolkit.Xml loaded in memory... [DEBUG] 09:37:38: Benchmark [Toolkit.Xml lib]: elapsed time: 0.010 cpu secs [DEBUG] 09:37:38: Toolkit.HttpUtility loaded in memory... [DEBUG] 09:37:38: Benchmark [Toolkit.HttpUtility lib]: elapsed time: 0.000 cpu secs [DEBUG] 09:37:38: ------------------------------------------------------------------------- [DEBUG] 09:37:38: -- SONOS Advanced Remote version 1.0.0 [DEBUG] 09:37:38: ------------------------------------------------------------------------- [DEBUG] 09:37:38: SONOS Advanced Remote V 1.0.0 loaded in memory... [DEBUG] 09:37:38: Benchmark [SONOS Advanced Remote V 1.0.0 lib]: elapsed time: 0.000 cpu secs [DEBUG] 09:37:38: HC2 start script at Sat Dec 31 09:37:38 2016 [DEBUG] 09:37:38: Get status topology, look for speakers IP [DEBUG] 09:37:38: Communication error code: 2 [DEBUG] 09:37:38: retry #0 [DEBUG] 09:37:38: Get status topology, look for speakers IP [DEBUG] 09:37:38: Communication error code: 2 Anyone ?
-
hi All Not sure if you have seen this pending product from iport called xpress http://iportproducts.com/xpress/#xpress-intro -frank
-
Hello, My HC2 is running on version 4.101 I installed 3 sonos devices over the weekend. 2 play5 and 1 play-bar. All off them has a IP adres on the internal network. When i create a virutual device i can command the sonos devices. Mhen i install the sonos plugin he want discover the sonos devices. When i put in the IP adress in the plugin same problem. Any ideas what could be the problem with the plugin? Regards,
-
Hello, My HC2 is running on version 4.101 I installed 3 sonos devices over the weekend. 2 play5 and 1 play-bar. All off them has a IP adres on the internal network. When i create a virutual device i can command the sonos devices. Mhen i install the sonos plugin he want discover the sonos devices. When i put in the IP adress in the plugin same problem. Any ideas what could be the problem with the plugin? Regards,
-
Hello, Is there someone who can help to make a VD in Fibaro HC2, that makes it possible to hear Spotify on SONOS. So that when I return home, automatically my favorite playlist in Spotify on my SONOS system can be heard? Who dares? Greetz John
-
Implement Sonos VD using node-http-API running on raspberry PI The following should help if you want to implement an sonos VD that leverages the node sonos http api by jishi The post consists in two parts Setting up the API on a raspberry pi Creating the VD and summary of other uses of the API and some sample code I use **I'll structure this in a better format in the coming weeks but for now it should be sufficient** I have tested this with Play1, 3, 5 (older version) ZP100, ZP80, ZP90. I don’t have a sonos soundbar or sub but from reading other forums it should work fine for those I intend to use this more in ‘Press Button’ mode rather than directly as a remote control but it should be good either way. You can also select what appears in HC2 UI by clicking the ‘main’ checkbox on the appropriate VD button ( I think you can have one button, one label and one slider) Credit & Reuse: This work draws on the work of many many people from both this forum as well as other forums. Without these people and the work they have done as well as what they have helped me learn over the last 12 months this wouldn't have been created. Like all VD’s please feel free to constructively criticise or modify it to meet your needs STEP1: Setup api on node.js device: This VD requires jishi’s node-sonos-http-api to be installed on a node.js capable device. This can be a RPi, a NAS or something similar. Details on where to get the code and install can be found on Git - https://github.com/jishi/node-sonos-http-api You will also find an excellent blog/issue tracker at the link above for any issues you encounter I have mine installed on a Rpi Added Feb 5th The fastest way I found to get up and running on a PI if you're unsure and just want to try it (takes about 15 minutes) Use the sonos-api precompiled rpi image at http://jishi.github.io/node-sonos-http-api/ (apply to blank sd card) when you login over SSH (with something like putty) the password is root Map a network drive or Start Run to \\<IP of Pi>\flash click apps folder and you'll see the sonos-http-api folder Get an API from VoiceRSS and create a settings.json file (details in the post) and drop it into the sonos-http-api folder reboot and that's it - test through browser with something like http://<ip-of-Pi:5005/<playername>/Say/Hello If you want to upgrade to the latest api release Download the latest zip from https://github.com/jishi/node-sonos-http-api (green button on right) In the flash folder rename the sonos-http-api to -old Rename what you downloaded to to sonos-http-api Drop in your settings.json file SSH into the Pi - login = root cd /flash/apps cd sonos-http-api npm install --production when finished reboot DOCKER from @riemers (thanks ) You could also use docker Some nas systems include docker too (synology) from the gui. Using docker is easy and simple to give to someone else too, work on Pi3 too. For node-sonos-api there is a docker image https://github.com/chrisns/docker-node-sonos-http-api saves you the hassle of installing all dependency's, assuming you have some knowledge with linux. # Edit - additional observation - I like the Synology NAS option but mine doesn't reboot in the event of a power outage. The Rpi does reboot. If you use a NAS it might be good to use a UPS or find a way to reboot after an outage Once you have this setup you are ready to move on to Step 2 STEP 2 : Import the VD, you will need one VD per sonos zone node-sonos-api VD.vfib Name - The zone name needs to be the same as what it is in native Sonos (try and avoid chars such as /,etc) Spaces are okay IP Address: This is the IP of the device where the api is installed (This is NOT the IP address of the sonos zone) Port: Leave at 5005 (can be changed it needed, see git above) STEP 3 : Configure Play, Stop, Repeat, Shuffle, etc – this should work as is The parts you may want to modify are as follows => Volume I opted for the vol + / vol – as opposed to the slider as I find the sliders difficult to use on a tablet Vol + / - operates in increments of 2%. This is easy to change in the url string. The Vol 10% button is also easy to change => Favourites You will need to modify this to your favourites and how they are named in your sonos setup I would advise simplifying these names in the native Sonos setup as much as you can. Spaces are okay, you just need to use %20 where you have a space in a name If you need more of less favourites, please add/delete buttons as required => Playlists I don’t really use them but these are easily enough added in a similar way to the favourites above. => Line-in selection You can create one button for each line in option on your setup for any connect/connect amp or Zp unit.. (I have 4 on my setup) You will need to get the UUID for the zone that has the line in physically connected to it. You can get the UUID of that zone by viewing the topology of the zone with the topology url. (drop it into chrome/ff) http://[IP of any of your zone]:1400/status/topology The format of the url http://192.168.1.89:5005/kitchen/setavtransporturi/x-rincon-stream:RINCON_000E5832B85401400 and you will need to change the last numerical string for your own UUID. => Grouping Zones I have included two examples of grouping and ungrouping The url format is simple and easy to read. below are two examples that were setup on the kitchen zone where I wanted to group the Playroom zone two it and play what was playing on the kitchen zone Group - [playroom joining kitchen and playing kitchen music] http://192.168.1.89:5005/playroom/join/kitchen Ungroup - [playroom leaving kitchen zone] http://192.168.1.89:5005/playroom/ungroup/kitchen You could also include a group all and an ungroup all by stacking the commands from each zone under one button. There are also options to control volume of grouped zones if you like but I haven't explored that yet Beyond this… The api is very extensive and still undergoing development. There are other functions in the api that could be used and might be worth a glance depending on your system and patterns of use I'll update the post this evening with the actual VD as I can't seem to export it remotely. The node.js api will need to be installed first before the VD will be of any use. Hopefully it will be of use to some people Thanks -Frank Update: Adding VD file Adding some extra information The api is very extensive and seems to keep growing I use it for mainly behind the scenes control rather than me clicking the vd/scenes buttons manually If you look at http://zone_ip:5005/room_name/state for any of your players you’ll see all the state json info and what’s possible to control/trigger from Pretifying the json will show it's structure better { "currentTrack": { "title": "x-sonosapi-stream:s2846?sid=254&flags=32", "albumArtUri": "\/getaa?s=1&u=x-sonosapi-stream%3as2846%3fsid%3d254%26flags%3d32", "duration": 0, "uri": "x-sonosapi-stream:s2846?sid=254&flags=32", "type": "radio", "absoluteAlbumArtUri": "http:\/\/192.168.1.63:1400\/getaa?s=1&u=x-sonosapi-stream%3as2846%3fsid%3d254%26flags%3d32" }, "nextTrack": { "artist": "", "title": "", "album": "", "albumArtUri": "", "duration": 0, "uri": "" }, "volume": 10, "mute": false, "trackNo": 1, "elapsedTime": 651, "elapsedTimeFormatted": "00:10:51", "playbackState": "PLAYING", "playMode": { "repeat": "none", "shuffle": false, "crossfade": false } } I have a VD that shows me the status of all my players (attached) main scene code (just add labels local device = fibaro:getSelfId(); local zonename = fibaro:getName(device); local ipaddress = fibaro:getValue(device, "IPAddress"); local port = fibaro:getValue(device, "TCPPort"); sonos = Net.FHttp(ipaddress, port); local jS = json.decode(fibaro:getGlobalValue("StateTable")) -- zero the counter for each loop local zoneCount = 0 -- LANDING response = sonos:GET("/Landing/state") jsonTable = json.decode(response); if jsonTable.playbackState == "PLAYING" then zoneCount = zoneCount + 1 jS.Landing_Stairs.isPlaying = 1 else jS.Landing_Stairs.isPlaying = 0 end jS.Landing_Stairs.volPlaying = jsonTable.volume jS.Landing_Stairs.nowPlaying = jsonTable.currentTrack.artist jStateTable = json.encode(jS) fibaro:setGlobal("StateTable", jStateTable) fibaro:call(device,"setProperty","ui.lblLanding.value",""..jsonTable.playbackState.." | "..jsonTable.volume..""); -- TWINS BEDROOM response = sonos:GET("/Bed_LE/state") jsonTable = json.decode(response); if jsonTable.playbackState == "PLAYING" then zoneCount = zoneCount + 1 jS.lau_eth_bedroom.isPlaying = 1 else jS.lau_eth_bedroom.isPlaying = 0 end jS.lau_eth_bedroom.volPlaying = jsonTable.volume jS.lau_eth_bedroom.nowPlaying = jsonTable.currentTrack.artist jStateTable = json.encode(jS) fibaro:setGlobal("StateTable", jStateTable) fibaro:call(device,"setProperty","ui.lblBedLE.value",""..jsonTable.playbackState.." | "..jsonTable.volume..""); -- FRANK BEDROOM response = sonos:GET("/Bed_Frank/state") jsonTable = json.decode(response); if jsonTable.playbackState == "PLAYING" then zoneCount = zoneCount + 1 jS.frank_bedroom.isPlaying = 1 else jS.frank_bedroom.isPlaying = 0 end jS.frank_bedroom.volPlaying = jsonTable.volume jS.frank_bedroom.nowPlaying = jsonTable.currentTrack.artist jStateTable = json.encode(jS) fibaro:setGlobal("StateTable", jStateTable) fibaro:call(device,"setProperty","ui.lblBedFrank.value",""..jsonTable.playbackState.." | "..jsonTable.volume..""); -- GUEST BEDROOM response = sonos:GET("/Bed_Guests/state") jsonTable = json.decode(response); if jsonTable.playbackState == "PLAYING" then zoneCount = zoneCount + 1 jS.guest_bedroom.isPlaying = 1 else jS.guest_bedroom.isPlaying = 0 end jS.guest_bedroom.volPlaying = jsonTable.volume jS.guest_bedroom.nowPlaying = jsonTable.currentTrack.artist jStateTable = json.encode(jS) fibaro:setGlobal("StateTable", jStateTable) fibaro:call(device,"setProperty","ui.lblGuests.value",""..jsonTable.playbackState.." | "..jsonTable.volume..""); -- OFFICE response = sonos:GET("/Bed5_Office/state") jsonTable = json.decode(response); if jsonTable.playbackState == "PLAYING" then zoneCount = zoneCount + 1 jS.office.isPlaying = 1 else jS.office.isPlaying = 0 end jS.office.volPlaying = jsonTable.volume jS.office.nowPlaying = jsonTable.currentTrack.artist jStateTable = json.encode(jS) fibaro:setGlobal("StateTable", jStateTable) fibaro:call(device,"setProperty","ui.lblOffice.value",""..jsonTable.playbackState.." | "..jsonTable.volume..""); -- MASTER BED response = sonos:GET("/Bed_MasterL/state") jsonTable = json.decode(response); if jsonTable.playbackState == "PLAYING" then zoneCount = zoneCount + 1 jS.master_bedroom.isPlaying = 1 else jS.master_bedroom.isPlaying = 0 end jS.master_bedroom.volPlaying = jsonTable.volume jS.master_bedroom.nowPlaying = jsonTable.currentTrack.artist jStateTable = json.encode(jS) fibaro:setGlobal("StateTable", jStateTable) fibaro:call(device,"setProperty","ui.lblMaster.value",""..jsonTable.playbackState.." | "..jsonTable.volume..""); -- HALL response = sonos:GET("/Hallway/state") jsonTable = json.decode(response); if jsonTable.playbackState == "PLAYING" then zoneCount = zoneCount + 1 jS.hall.isPlaying = 1 else jS.hall.isPlaying = 0 end jS.hall.volPlaying = jsonTable.volume jS.hall.nowPlaying = jsonTable.currentTrack.artist jStateTable = json.encode(jS) fibaro:setGlobal("StateTable", jStateTable) fibaro:call(device,"setProperty","ui.lblhallway.value",""..jsonTable.playbackState.." | "..jsonTable.volume..""); -- KITCHEN response = sonos:GET("/Kitchen/state") jsonTable = json.decode(response); if jsonTable.playbackState == "PLAYING" then zoneCount = zoneCount + 1 jS.kitchen.isPlaying = 1 else jS.kitchen.isPlaying = 0 end jS.kitchen.volPlaying = jsonTable.volume jS.kitchen.nowPlaying = jsonTable.currentTrack.artist jStateTable = json.encode(jS) fibaro:setGlobal("StateTable", jStateTable) fibaro:call(device,"setProperty","ui.lblkitchen.value",""..jsonTable.playbackState.." | "..jsonTable.volume..""); -- PLAYROOM response = sonos:GET("/playroom/state") jsonTable = json.decode(response); if jsonTable.playbackState == "PLAYING" then zoneCount = zoneCount + 1 jS.playroom.isPlaying = 1 else jS.playroom.isPlaying = 0 end jS.playroom.volPlaying = jsonTable.volume jS.playroom.nowPlaying = jsonTable.currentTrack.artist jStateTable = json.encode(jS) fibaro:setGlobal("StateTable", jStateTable) fibaro:call(device,"setProperty","ui.lblplayroom.value",""..jsonTable.playbackState.." | "..jsonTable.volume..""); -- GARAGE response = sonos:GET("/Garage/state") jsonTable = json.decode(response); if jsonTable.playbackState == "PLAYING" then zoneCount = zoneCount + 1 jS.garage.isPlaying = 1 else jS.garage.isPlaying = 0 end jS.garage.volPlaying = jsonTable.volume jS.garage.nowPlaying = jsonTable.currentTrack.artist jStateTable = json.encode(jS) fibaro:setGlobal("StateTable", jStateTable) fibaro:call(device,"setProperty","ui.lblgarage.value",""..jsonTable.playbackState.." | "..jsonTable.volume..""); -- PIZZA BBQ response = sonos:GET("/PizzaBBQ_Area/state") jsonTable = json.decode(response); if jsonTable.playbackState == "PLAYING" then zoneCount = zoneCount + 1 jS.pizza_bbq_area.isPlaying = 1 else jS.pizza_bbq_area.isPlaying = 0 end jS.pizza_bbq_area.volPlaying = jsonTable.volume jS.pizza_bbq_area.nowPlaying = jsonTable.currentTrack.artist jStateTable = json.encode(jS) fibaro:setGlobal("StateTable", jStateTable) fibaro:call(device,"setProperty","ui.lblpizza.value",""..jsonTable.playbackState.." | "..jsonTable.volume..""); -- LIVING response = sonos:GET("/Living_Room/state") jsonTable = json.decode(response); if jsonTable.playbackState == "PLAYING" then zoneCount = zoneCount + 1 jS.living_room.isPlaying = 1 else jS.living_room.isPlaying = 0 end jS.living_room.volPlaying = jsonTable.volume jS.living_room.nowPlaying = jsonTable.currentTrack.artist jStateTable = json.encode(jS) fibaro:setGlobal("StateTable", jStateTable) fibaro:call(device,"setProperty","ui.lblliving.value",""..jsonTable.playbackState.." | "..jsonTable.volume..""); -- GARAGE response = sonos:GET("/DiningRoom/state") jsonTable = json.decode(response); if jsonTable.playbackState == "PLAYING" then zoneCount = zoneCount + 1 jS.dining_room.isPlaying = 1 else jS.dining_room.isPlaying = 0 end jS.dining_room.volPlaying = jsonTable.volume jS.dining_room.nowPlaying = jsonTable.currentTrack.artist jStateTable = json.encode(jS) fibaro:setGlobal("StateTable", jStateTable) fibaro:call(device,"setProperty","ui.lbldining.value",""..jsonTable.playbackState.." | "..jsonTable.volume..""); fibaro:setGlobal("ActiveMusicZones", zoneCount); fibaro:call(device,"setProperty","ui.activeZones.value",zoneCount); Three of my zones use power amps (the are sonos connects) and I use the ‘playstate’ to turn the amp on / off when required. That’s the code at the bottom of the vd At one stage I was even displaying the image (radio station, music album) on an openremote UI using the uri part of the state json. I use the VoiceRSS TTS on teh http api but there are others. That all that was there when I found it and it worked well I have TTS to tell me “welcome home”, “good night”, "gate opening/closing", "garage door opening/closing" and all the usual stuff but I vary the volume it at night so it doesn’t wake everybody up. I intend this expand this feedback out so If we come home and the alarm went off it would tell me or that the washing machine has finished, the humidity is still too high in the bathroom and I should open the window (or that a fan was turned on) or some HC2 system info like the available memory went beyond certain thresholds, temp in a room rose or dropped, My siemens alarm is connected to my HC2 and I keep track of all the status of the alarm zones and when we press the “Leaving Home” button it checks the alarm zones and if one or many are open, it will TTS the open alarm zones in the hall sonos so we know where to go and close. Same thing when we go to bed at night. I found that each of my zones have different volume levels that work at night and during the day. I’ll be using my HomeTable (different topic) to store this info for each zones but it can written directly into the scene/vd. (This is what the the following code is for) I also plan on using a central TTS engine (simple a scene that take a zone/message and vol) so I can TTS more easily to any player. For now I have specific TTS code on a per player basis. I leverage the global variables that @Sankotronic Weather Basic VD populates and a scene that allows me to send the current weather (temp, humidity, wind speed direction, etc) as a TTS to our bedroom in the morning as well as the temp of the house as part of our wake up routine The API has a presets concept. This allows the user to pre-define a set of grouped players, source and volume. This is a file on the rpi and is referenced by a single command rather than starting one zone and grouping other zones. An example of its structure is as follows ... { "players": [ { "roomName": "Landing", "volume": 0 }, { "roomName": "Bed_MasterL", "volume": 0 }, { "roomName": "Bed_LE", "volume": 0 }, { "roomName": "Bed_Frank", "volume": 0 } ], "pauseOthers": false, "favorite": "96FM" } You may notice that the volume is set as 0 because I use another scene to slowly raise the volume so we are not woken to the sharp shock to a loud song. This simple vd button code is what I use to slowly raise the volume slowly local device = fibaro:getSelfId(); local zonename = fibaro:getName(device); local ipaddress = fibaro:getValue(device, "IPAddress"); local port = fibaro:getValue(device, "TCPPort"); sonos = Net.FHttp(ipaddress, port); for v = 1, 10 do response = sonos:GET("/Bed_Frank/volume/"..v.."") fibaro:debug("vol= "..v.."") fibaro:sleep(1000) end I use this for morning music upstairs and downstairs as well as when the kids go to bed. (changing the presets on the rpi requires a restart of the api - i normally just reboot the pi ) Watch out for radio favorites and playlists - try and not have spaces in the names on sonos and you should have no issue calling them ADDED - Jan 21st Creating a single button on a VD to cycle through favorites or playlist instead of using 1 per favorite. Every time you click the button it selects the next favorite. I have it limited to 5 favorites but this is easily adjusted. I store the favorite in my HomeTable but it could also be a global variable. I use an array to decode the numerical value stored globally into the actual favorite so I can append to the sonos api call. This will need to be adjusted to suit your system VD button code .... local device = fibaro:getSelfId(); local ipaddress = fibaro:getValue(device, "IPAddress"); local port = fibaro:getValue(device, "TCPPort"); local jT = json.decode(fibaro:getGlobalValue("HomeTable")) -- Get the current favorite number stored, increment by 1 and if > 5 set back to 1 local f = tonumber(jT.Landing_Stairs.RadFav) + 1 if f > 5 then f = 1 end -- Store the new favorite jT.Landing_Stairs.RadFav = f fibaro:setGlobal("HomeTable", json.encode(jT)) -- Array for the favorites fav = {[1] = "4FM", [2] = "96FM", [3] = "Calm", [4] = "Heart", [5] = "Red_FM"} -- Execute the sonos conmmand sonos = Net.FHttp(ipaddress, port); response = sonos:GET("/Landing/favorite/"..fav[f]..""); I also reflect this on a status label on the VD. -- Get favorite stored globally local f = tonumber(jT.Landing_Stairs.RadFav) -- Translate into favorite name to be displayed fav = {[1] = "96FM", [2] = "4FM", [3] = "Calm", [4] = "Heart", [5] = "Red_FM"} -- fav[f] represents the name. I apppend to otehr date and display in one label local status = " "..fav[f].." | "..jTS.playbackState.." | Volume "..jTS.volume.."%" fibaro:call(device,"setProperty","ui.status.value", status); This display at the top of the VD doesn't account is somebody changes the favorite from the native sonos app. I'll add code later to keep alignment between what is selected and what is stored in the global variable, This is what it looks like on my setup that is still a work in progress x Please see post 163 on this topic on how to get the VD icons dynamic for radio station or line in
- 255 replies
-
Hi everybody, This is my first time on the fibaro forum so i dont know if my subject is in the right topic list. I want too buy a HC2 in the next 2 months but i got a question about the audio system i want to pair with the system. I already know that Sonos is the most user friendly system too pair with Fibaro but i prefer a Audio Receiver like Denon, Onkyo or something like that. I know no other system than Sonos has a good multi-room function but i live in a small appartment so the multi-room function wont be that necessary, but my girlfriend wants too have music in the bathroom. (like pairing the fibaro dimmer with audio, so if you pushed the light button the music starts also playing) Can you tell me what you're experiences are with this kind of systems (like denon, onkyo etc)? Do you have the same functions with the scenes like sonos or not?
-
i thought i would share a little VD i made coz i am a bit lazy when it comes to my Sonos. i created some playlists and saved them as .m3u files and each one is about an hour long. i then created a VD to select my speaker and then i sent the playlist path to it, set the initial volume and it just plays it all and turns off. No other input is required. you can pause/unpause and stop if required and adjust volume if needed. This VD requires the krikroff VD and sonos remote to work properly. to make it easier here is a short video : https://youtu.be/s8FPiVFa-gU and the VD is attached. Playlist_Selector.vfib
-
Hi, Strange one for you ... I have 14 sonos zones or varying types and when I add the 12th the VD doesn't work or display anything. I think its a number related issue as I removed a few and added a few different ones and always couldn't seem to add more than 11 I tried the usual, adding/removing VD many times, fixed IP's on the zones, all SW up to date, power cycled impacted zones, removed any 'funny' characters in the room or device names running 4.080 and it's the 1.0.1b beta sonos remote Does anybody have more that 11 zones with VD and all running okay ? Thanks -Frank