Skip to content

Instantly share code, notes, and snippets.

@tsuzu
Last active July 9, 2016 10:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsuzu/85da327be541c9c1d8220b0fa439fb63 to your computer and use it in GitHub Desktop.
Save tsuzu/85da327be541c9c1d8220b0fa439fb63 to your computer and use it in GitHub Desktop.
Marantz NR1604 Auto PowerOff
AVReciever = require('marantz-avr')
mdns = require('mdns')
CronJob = require('cron').CronJob
clients = []
new CronJob '0 0 0 * * *', ->
for key, val of clients
for ip in val
reciever = new AVReciever(ip)
reciever.sendCommand("PutZone_OnOff/OFF")
, null, true, 'Asia/Tokyo'
ad = mdns.createAdvertisement(mdns.tcp('http'), 4321)
ad.start()
browser = mdns.createBrowser(mdns.tcp('raop')) # All Airplay Devices
browser.on 'serviceUp', (service)->
if service.name.match /Marantz/
clients[service.name] = service.addresses
browser.on 'serviceDown', (service)->
if service.name.match /Marantz/ && clients[service.name]?
delete clients[service.name]
browser.start()
all = mdns.browseThemAll()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment