koxkp Posted January 20, 2019 Share Posted January 20, 2019 I'm trying to update a keypad button to loop through playlists. I believe my logic to loop between 2 is fine, but I've never used a spofity playlist for a keypad button before. The documentation in composer says to hold down the button while the driver is playing and it will automatically link to the playlist. Any insight on how to get this to work? Also, could someone answer the difference between stop and break? I think I get them confused every time. Link to comment Share on other sites More sharing options...
brucecampbell Posted January 20, 2019 Share Posted January 20, 2019 Stop will stop at that point in the function and not process any more lines of code Break will exit the current block of code and continue to process the remaining lines of code in the function. ie: break out of an If statement or While Loop. You have used Stop correctly in this instance. - However - here is where a Macro could be used instead of having all your programming in a keypress event. something like this example: --------------------------------------------- Macro "KitchenMusic" When macro kitchenmusic is executed: If variable Jona > 0 if variable Jona = 1 Play Pandora ........... if variable Jona = 2 Play Spotify ........... variable jona = 0 If variable Dad > 0 if variable Dad = 1 Play tunein channel oldies variable dad = 0 if variable Mum > 0 if variable Mum = 1 play tunein channel love songs variable mum = 0 ------------------------------------------------------------- When keybad button jona clicked variable jona = jona + 1 variable dad = 0 variable mum = 0 execute macro kitchenmusic ------------------------------------------------------------- When keybad button dad clicked variable dad = dad+ 1 variable jona = 0 variable mum = 0 execute macro kitchenmusic ------------------------------------------------------------- When keybad button mum clicked variable mum = mum + 1 variable jona = 0 variable dad = 0 execute macro kitchenmusic Link to comment Share on other sites More sharing options...
koxkp Posted January 20, 2019 Author Share Posted January 20, 2019 Thanks. Macro looks more efficient. Main problem is getting the Spotify playlist to work now. There is no easy way to select Spotify playlist like pandora channels with Spotify connect Link to comment Share on other sites More sharing options...
brucecampbell Posted January 20, 2019 Share Posted January 20, 2019 I have not played with spotify and C4. I use spotify almost every day, but I control it from the spotify app and use shairbridge. I've not yet upgraded high enough to get Spotify on C4 - so I have no idea of the options available in programming. Good luck with the programming - hopefully there is a solution to the spotify playlist request - plenty of people on here will know the definitive answer. Link to comment Share on other sites More sharing options...
Adidaswood Posted January 23, 2019 Share Posted January 23, 2019 Here is what I did. I probably isn't perfect but, I find it to be effective for my needs. Also I'm not super proud of the else section but I wasn't sure how else to join other rooms in progress. Open to hearing suggestions to clean this up.... I had to code this up for each room where I wanted to do this. something else, I might add in the future is to add a function that lets me choose which playlist by user but my brain started hurting when I thought about it. you basically tap a button and it will cycle between 3 or 4 playlists. Then you can hold the button for 2 seconds and it will turn the room off. This way I don't have any issues with mixing up taps and press/release. Link to comment Share on other sites More sharing options...
brucecampbell Posted January 24, 2019 Share Posted January 24, 2019 I try to have all 'Processing' commands in a macro. I then use the key press/tap/release/.... to set the variables. I then use the When Variable Changes function to run the macro. It generally keeps all the action functions to 1 or 2 lines of code and all programming is essentially done in the macro. This has two key purposes. 1. I don't have to hunt around many locations to view or edit what a process actually does. 2. I can run the processing (macros) from multiple functions and my single result will always be achieved. Link to comment Share on other sites More sharing options...
Adidaswood Posted January 24, 2019 Share Posted January 24, 2019 i hear ya I just couldn't wrap my brain around how to do this with each room being different in the code. I could have this code on the button, or i could have it in a macro, but I still have to do this code 6 times (6 buttons or 6 macros) because the room variable isn't an input parameter. If i press the button in the kitchen i need to specify kitchen in the code if I press the button in the Family Room and need to specify that in the code code looks the same but is different because of the room names. I want to be wrong but... Le me know if I'm not making sense Link to comment Share on other sites More sharing options...
Cyknight Posted January 24, 2019 Share Posted January 24, 2019 Why are you resetting the timer on release? Not likely to hurt anything, just unclear on what you expect that to do Link to comment Share on other sites More sharing options...
Adidaswood Posted January 25, 2019 Share Posted January 25, 2019 well, its been a while since i wrote these but...in my brain (as limited as it is ) I was Thinking that a press and a single tap might be confused sometime depending oh how the button was interacted with. So if the button was only pressed for 1 sec by mistake I wanted it to go back to 2 seconds. are saying in that scenario the timer would just go down to zero and reset automatically? since my event isn't on timer expiration rather it is just the check to see if it is running or not. Link to comment Share on other sites More sharing options...
Thepritch88 Posted January 28, 2019 Share Posted January 28, 2019 Have you guys tried using the room control driver? it`s got a source cycler in it that does what your looking for without having to use the variables and do the programing yourself. Link to comment Share on other sites More sharing options...
THawes Posted January 28, 2019 Share Posted January 28, 2019 3 hours ago, Thepritch88 said: Have you guys tried using the room control driver? it`s got a source cycler in it that does what your looking for without having to use the variables and do the programing yourself. I looked into using that instead of looping through playlists or stations like others are doing, but as the driver is now you cannot select certain stations from the media list, it just loops through all of the ones you have in there. Link to comment Share on other sites More sharing options...
BraydonH Posted January 28, 2019 Share Posted January 28, 2019 Why not use the Room Control Driver with the Preset Source Cycler. Works like a charm and it is WAY easier then the mountain of programming you have there. You can absolutely select certain stations or favorites. Mines cycles through 3 specific Sirius XM stations that I have set. Link to comment Share on other sites More sharing options...
THawes Posted January 28, 2019 Share Posted January 28, 2019 54 minutes ago, BraydonH said: You can absolutely select certain stations or favorites. Unless I am missing something, you cannot tell the driver which stations you want it to cycle through? Sources, yes. From the documentation: Quote - Preset Source 1-5 Media - [Dynamic List] This presents a dynamic list of all media found in the Broadcast Audio section of the Control4 Media Database for the associated source (not all drivers populate any data into Broadcast Audio). If an item is selected from this list, that media item will be selected as the source for the room(s) instead of the device itself, as per the Preset Source 1-5 property. If no media is found then this property will not be visible. NOTE: If the media item is later deleted from the media database, it is likely that this position on the cycler will have no effect. Link to comment Share on other sites More sharing options...
BraydonH Posted January 28, 2019 Share Posted January 28, 2019 Here it is. Selecting a Specific Station for preset 1, then a generic source (in this case an Apple Airport Express Used for Airplay) then the third preset is another tunein station. You can do this with Sirius, Deezer, Even Spotify Favorites. Don't see what your issue is. Perhaps your not just selecting TuneIn First. Select TuneIn first, then another menu magically appears to select the station. Link to comment Share on other sites More sharing options...
THawes Posted January 28, 2019 Share Posted January 28, 2019 Thanks, that's what I was looking for. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.