Last active
July 9, 2016 10:00
-
-
Save tsuzu/85da327be541c9c1d8220b0fa439fb63 to your computer and use it in GitHub Desktop.
Marantz NR1604 Auto PowerOff
This file contains 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
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