Note: As of version 1.1.5 (Big Sur), you can no longer pair and control from a different Mac. This appears to be part of Apple's tightening of security as the Music app specifically returns an error that remote login capability is not supported.
This plugin is the basic Music (iTunes) integration plugin. You may create as many “iTunes Server” devices as you have on your network (but only one per Music instance as defined by Music running on a Mac - you can't have multiple iTunes server devices that are pointing to the same iTunes instance). For each of those devices, you can trigger off of various state changes in the built-in Device State Changed trigger type and you can execute many different actions in the Actions tab. None of this requires scripting of any kind.
Indigo now includes a device state image for use with Music which mimics the Play/Pause button in iTunes. If the Music play state is “playing”, the icon will show the pause symbol and vice versa. If it's “unavailable” it will be grayed out and if there's an error it will be reddish. To use just select iTunesStatus_large+, iTunesStatus_med+, or iTunesStatus_small+ in the control page editor and you'll get automatic play/pause switching icon. Works even better when you make the action a “Toggle Play/Pause” plugin action.
The plugin's config dialog allows you to turn on extra debugging information in the Event Log. Unless you're trying to debug a problem it's probably best to leave that unchecked.
The iTunes Plugin allows you to create iTunes Server devices. To create a new one, switch to the device view and click the New…
button. This will bring up the device edit dialog:
As shown above, select Plugin
from the Type:
popup. Select iTunes Plugin
from the Plugin:
popup, and select iTunes Server
from the Model:
popup. Click on the Edit Device Settings…
button and you'll see the iTunes Device Config UI:
This dialog tells you what to do next. You must pair this new device with the iTunes Server that you intend to control. Switch to iTunes.
If you're using the Music app (macOS Catalina 10.15.2 or above) that replaced iTunes, you'll see a line in the outline view on the left under Devices named “Indigo - [YOUR DATABASE NAME HERE]”. Select that item.
If you're using iTunes 12, you'll see a button with an right arrow in it in the upper left corner of the iTunes window:
If you're using iTunes 11, you'll see a button titled Remote
in the upper right corner next to the iTunes Store
button:
Click on that button. If you're using iTunes 10.x you should see this in the outline view:
Select Indigo Remote Control
With either case, you'll be prompted to enter a passcode:
Enter 0 0 0 0 for the passcode (or anything actually) - you'll see a message that says “Your Remote is now able to control iTunes” and an OK
button. Click OK
, then switch back to Indigo and click the Save
button. That should save your device and you should start seeing state updates.
If you use the Pause Playback and Speak Text action and iTunes is running on a remote Mac and/or you are using Airfoil to direct sound to other devices, you may notice that the speaking and iTunes music overlap somewhat. That's what the other setting in the device config UI above is for (# of seconds of latency
) - just increase that incrementally until the spoken text no longer overlaps the iTunes music. You may not need any latency adjustment.
TIP: If you ever change the name of the Mac that you're controlling, you'll need to re-pair - just open the config dialog again and pair just like you did above. This may also help if your device can't connect to iTunes.
You can trigger off of various custom state changes on an iTunes Server device - like when the player status changes (playing, paused, etc), when the album, artist, track changes, etc.
iTunes Server device types provide you with several device states that you can use in the Trigger dialog:
Player Status Changed
- any change to the play state of iTunesPlayer Status is Playing
- iTunes is playingPlayer Status is Paused
- iTunes is pausedPlayer Status is Stopped
- iTunes is stoppedPlayer Status is Unavailable
- iTunes is unavailable - it's probably not runningPlayer Status is Error
- this iTunes device has an unknown error - look in the Event Log for detailsCurrent Playlist Name
- the current playlist that's selected in iTunesCurrent Album
- the current album nameCurrent Artist
- the current artist nameCurrent Track
- the current track nameCurrent Volume
- the current volume levelRepeating Changed
- any change in repeat statusRepeating None
- iTunes is not repeatingRepeating Song
- iTunes is repeating the current songRepeating Playlist
- iTunes is repeating the current playlistShuffling
- iTunes is shuffling songs
The actions provided by the plugin are as follows:
Play
- start iTunes playingPause
- pause iTunesToggle Play/Pause
- toggle between playing and pausedNext Track
- move to the next trackPrevious Track
- go back to the previous trackRestart Track
- restart the current trackPause iTunes and Say
- pause iTunes (if it's running) and speak the supplied text. Restart only if it was paused to begin with.\\Set Volume
- set the volume to a specific level (0-100)Increase Volume
- increase the volume by a specific amount (0-100)Decrease Volume
- decrease the volume by a specific amount (0-100)Set Repeat
- set iTunes to repeat (or not)Set Shuffle
- set/unset shufflingNOTE: you can use the special variable substitution fields in the Pause iTunes and Say text field - see Variable Substitution for more information.
As with all plugins, actions defined by this plugin may be executed by Python scripts. Here's the information you need to script the actions in this plugin.
Plugin ID: com.perceptiveautomation.indigoplugin.itunes
Action id: play
No properties for scripting required.
Example:
itunesPlugin = indigo.server.getPlugin("com.perceptiveautomation.indigoplugin.itunes") if itunesPlugin.isEnabled(): itunesPlugin.executeAction("play", deviceId=135305663)
Action id: pause
No properties for scripting required.
Example:
itunesPlugin = indigo.server.getPlugin("com.perceptiveautomation.indigoplugin.itunes") if itunesPlugin.isEnabled(): itunesPlugin.executeAction("pause", deviceId=135305663)
Action id: playPause
No properties for scripting required.
Example:
itunesPlugin = indigo.server.getPlugin("com.perceptiveautomation.indigoplugin.itunes") if itunesPlugin.isEnabled(): itunesPlugin.executeAction("playPause", deviceId=135305663)
Action id: nextTrack
No properties for scripting required.
Example:
itunesPlugin = indigo.server.getPlugin("com.perceptiveautomation.indigoplugin.itunes") if itunesPlugin.isEnabled(): itunesPlugin.executeAction("nextTrack", deviceId=135305663)
Action id: prevTrack
No properties for scripting required.
Example:
itunesPlugin = indigo.server.getPlugin("com.perceptiveautomation.indigoplugin.itunes") if itunesPlugin.isEnabled(): itunesPlugin.executeAction("prevTrack", deviceId=135305663)
Action id: restartTrack
No properties for scripting required.
Example:
itunesPlugin = indigo.server.getPlugin("com.perceptiveautomation.indigoplugin.itunes") if itunesPlugin.isEnabled(): itunesPlugin.executeAction("restartTrack", deviceId=135305663)
Action id: pauseAndSay
Properties for scripting:
message | the string to speak, which may include variable substitution markup - ignored (and not required) if 'speakLastMessage' is True |
speakLastMessage | boolean specifying if the last spoken message should be repeated |
Example:
itunesId = "com.perceptiveautomation.indigoplugin.itunes" itunesPlugin = indigo.server.getPlugin(itunesId) if itunesPlugin.isEnabled(): myWeatherStation = indigo.devices[1798384204] outsideTemp = myWeatherStation.states['temperatureF'] currentCondition = myWeatherStation.states['currentCondition'] spokenString = "The current temperature is %s degrees. Current condition is %s." % (outsideTemp, currentCondition) itunesPlugin.executeAction("pauseAndSay", deviceId=135305663, props={'message':spokenString}) itunesPlugin.executeAction("pauseAndSay", deviceId=135305663, props={'speakLastMessage':True})
Action id: setVolume
Properties for scripting:
volume | a number from 0 to 100 representing the absolute volume |
Example:
itunesPlugin = indigo.server.getPlugin("com.perceptiveautomation.indigoplugin.itunes") if itunesPlugin.isEnabled(): itunesPlugin.executeAction("setVolume", deviceId=135305663, props={'volume':50})
Action id: increaseVolume
Properties for scripting:
volume | a number from 0 to 100 representing the amount to increase - so if the volume is currently at 50, and volume is set to 25, the volume will end up being 75 |
Example:
itunesPlugin = indigo.server.getPlugin("com.perceptiveautomation.indigoplugin.itunes") if itunesPlugin.isEnabled(): itunesPlugin.executeAction("increaseVolume", deviceId=135305663, props={'volume':25})
Action id: decreaseVolume
Properties for scripting:
volume | a number from 0 to 100 representing the amount to increase - so the volume is currently at 50, and volume is set to 25, the volume will end up being 25 |
Example:
itunesPlugin = indigo.server.getPlugin("com.perceptiveautomation.indigoplugin.itunes") if itunesPlugin.isEnabled(): itunesPlugin.executeAction("decreaseVolume", deviceId=135305663, props={'volume':25})
Action id: setRepeat
Properties for scripting:
repeat | a number representing the repeat type: 0 (no repeat), 1 (repeat song), 2 (repeat playlist) |
Example:
itunesPlugin = indigo.server.getPlugin("com.perceptiveautomation.indigoplugin.itunes") if itunesPlugin.isEnabled(): itunesPlugin.executeAction("setRepeat", deviceId=135305663, props={'repeat':0})
Action id: setShuffle
Properties for scripting:
shuffle | a boolean representing whether to shuffle or not |
Example:
itunesPlugin = indigo.server.getPlugin("com.perceptiveautomation.indigoplugin.itunes") if itunesPlugin.isEnabled(): itunesPlugin.executeAction("setShuffle", deviceId=135305663, props={'shuffle':True})
For usage or troubleshooting tips discuss this device on our forum.