Created
July 9, 2016 20:55
-
-
Save matsimitsu/72f42328d115f9b05488574f5adfe2bd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| require 'rubygems' | |
| require 'mqtt' | |
| MQTT::Client.connect('192.168.0.20') do |client| | |
| client.subscribe('components/plex/on', 'components/plex/off') | |
| client.get do |topic,message| | |
| case topic | |
| when 'components/plex/on' then `open -a /Applications/Plex.app` | |
| when 'components/plex/off' then `osascript -e 'quit app "Plex"'` | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment